Download Latest Version gsmremote-0.3.tar.gz (13.6 kB)
Email in envelope

Get an email when there's a new version of gsmremote

Home
Name Modified Size InfoDownloads / Week
README 2013-03-16 9.2 kB
gsmremote-0.3.tar.gz 2013-03-16 13.6 kB
gsmremote_0_2.tar.gz 2013-02-01 12.6 kB
gsmremote_0_1.tar.gz 2012-12-29 10.1 kB
Totals: 4 Items   45.5 kB 0


To try this you need:
--------------------

* An (as off 2012) fairly modern computer that can do java and has usb.

* An arduino dev board, I used some clone with an ATmega328

* The Arduino dev packets (This was compiled successfully on arduino-1.0.2)

* A sim card with a working plan that is able to send and receive sms:es
  in your location.
  I strongly urge you to NOT use anything but pre-paid since any code errors
  or malicious use can get you an enormous phone bill with a subscrition!!

* A SIM300 module (I got mine from ebay)

* A normal cellphone (with its own plan) to be able to remote control the unit


You probably also need:
----------------------

* A realy board which amplifies the signal from arduino, (two relays are now recommended.
  one to control your application and one as a watchdog for the sim300)

* An editor to edit the config.h file

* A soldering iron and some basic soldering skills.

* A basic knowledge of electronic circuitry.

* The AT-commands guide for the SIM300 is floating around the 
  internet and can be handy if you want to test out some code
  of your own.


Hardware setup
--------------

This is setup to have the arduino board send characters to the SIM300 on its
pin 7 and receive on its pin 6 (using the SoftwareSerial library)

Don't forget to connect ground as well arduino <--> sim300

Be sure that you are not connecting to the sim300 via an MAX232 rs232
converter or similar!
This will not work since the levels are not the same, you need the cmos levels
on the sim300, alternatively you need to build some rs232 converter for
the arduino board side.

The signal you are controlling is on pin 1 and a zero on this pin is
considerd "ON" and a one is "OFF" (you can change this in gsmremote.ino)

For a test setup you need a LED and a some-few-hundred ohms resistor
connected to pin 1 and vcc. (Refer to arduino wiki or similar if you are new
to this, remember that toasted LED's have a horrible smell)

New from release 0.2: 
--------------------
The device now remembers if it was switched on or off after a power cycle,
this however requires you to init the eeprom via that command in the menu
before device is useable, use the 'i' command for this.

Since at least my version of the sim300 has a nasty habbit of hanging up the serial line
I have reserved a pin for a second relay (pin 3 as default) so don't use this for anyting else.
The relay I use is a two-throw which shorts the sim300 to ground when relay is un-activated.

 ctrl pin3   o-----... [usually a transistor to amplify arduino signal]


     ..  -\/\/\/\/- .. relay coil

VCC from power supply (relay activated)
O-----o
         \
          \
            o------- vcc of sim300
          .
         .
O-----o 
GND (will decharge the sim300 when relay is activated) 



New from release-0.3
--------------------
We now have watchdog support, but you need to re-program your bootloader for this. See arduino forum: http://arduino.cc/en/Tutorial/ArduinoISP for a simple way to re-program with another Arduino. 
Here is what I did to the arduino-1.0.1 code:
cd arduino-1.0.1/hardware/arduino/bootloaders/atmega
make clean
Change EEWE to EEPE in file ATmegaBOOT_168.c line 586 (won't compile otherwise)
in Makefile add '-DWATCHDOG_MODS' to end of line 156. 
atmega328: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600 ' <<=== add '-DWATCHDOG_MODS' here
make atmega328

After this you need to download the example sketch "ArduinoISP" to the programmer arduino (the one with direct connection to the serial of your computers)
Then you select Tools=>Burn bootloader from the arduino, the correct bootloader should now be downloaded.

N.B.
* Both arduinos should be of the same type since the boot loader to download is selected from the programmer type of arduino not the one being programmed. I have only tried this with two duemillanove's
* I have only been successful in programming chips of type "Atmega328P" not the "Atmega328" type.
* This is an example! Programming the bootloader can be done in many other ways, suit a way that works for you :-)

Finally you need to change the use_watchdog option in config.h (see below)
 and (re)compile and download your gsmremote.ino sketch the usual way.

SOFTWARE setup
--------------
Apart from getting your arduino environmnet going, that involves finding the
usb serial port on your system, normally COM1-2-3 or /dev/ttyUSB0-1-1 on 
windows and linux respectively.


You need to create your own "config.h" from the "config_start.h" file!!!

There are a bunch of files here but just load the "gsmremote.ino" into
the arduino gui. Only config.h and the .ino file are "real" files, the 
rest is for testing and debugging with gcc/gdb under linux.
(Documentation for this might be added some day)

If you can't upload the sketch, please refer to Arduino wiki for this also.

When the sketch is running, open the TOOLS => "Serial Monitor" in the
arduino gui.
You need to set the baud rate to 9600 and the "Both NL & CR" option from
the menu left of the baud rate setting.

You can also try something like hyperterm / putty / minicom terminal
programs or why not grandpa's old VT100 terminal (opps no, it does not come
with usb, lets not make this too complicated :-)

If you input a few 'm'  <enter> sequences you should see a menu from the
arduino, possibly it also comes up by itself if you are quick starting the
serial monitor.

Menu:
s        Send test sms
b        Ask for balance
a        Run AT command
f<str>   Fake incoming message <str> 
c        Clean all sms messages
i        init persistent storage (eeprom) needed for each new arduino... 

That is a good start, it means your Arduino board is probably working (or
grandpa is toying with you on the other end of that VT100 :-)

Next thing to do is to try to connect to the sim300 via the Arduino board.

You select the 'a' for AT commands, don't get too scared if you wheren't
around in the modem era, you just need to type "AT" and then <ENTER>
and get an affirmative "OK" from the sim module, that's it I build the
rest of the Hayes command "essays" into the sketch.

If you don't get the 

OK
OK
OK
...

from the monitor, you need to check a few things:

* Is the sim300 module flashing every now and then like most cellphones do.
* Is the sim300 powered properly, enough current and not to much voltage?
* Is the connection between sim300 and the arduino correct?
* Are the levels on the sim300 CMOS/TTL compatible? They must not be RS232
  voltages.

If you get stuck try to rewire the SIM300 directly to a serial connector,
either a USB<->RS232 or some older computer with a DB-9 should work, but 
now make sure that the pins from the sim300 ARE RS232 levels.. Grandpa's
VT100 might actually come in useful here...

You should set the baud to 9600 and turn off any handshake, then try to
type a few "AT" <ENTER> and see if the module answers with it's "OK"'s
and then work your way from there.


Done?


The arduino serial console actually returns the desired "OK" lines?
When you select 'a' from the smsremote menu and type your "AT"?

Great!

Now get yourself out of the AT mode but doing an <space>-<enter> sequence
if you haven't done that already, now hit 'm' <enter> to see the main menu.

Now it's time to do some more live testing, hopefully you put your cellphone
number (and not someone else's :-) in config.h and if this is doing something
real, like switching on and off the city's nuke plant, you did change the pin
to something beside 1234, didn't you?
When I think of it, don't use this to control nukes..

The "vendor_balance_string" is useful, but not necessary.
It is that sequence you usually use on a pre-paid phone with the "handset"
button.
You know like: "star-one-one-three-hash" to check your balance.

Here it is just prefixed with the "ATD" (Dial) command.

If you know you have credits on your phone, this is not essential.

What you do know is send an sms from your ordinary phone, such as this

1234 on

and select the number for your sim300 as receiver, (you know the number right?)

There should be some passing of lines on the console and then the LED should
light up, cooool, time to show this to someone who thinks it's useful.

Especially look for the "+CMTI...." line which indicates the sim300 got an
incoming sms

Unsuprisingly 

1234 off 

should turn off the diode.

There is also a

1234 status

which will attempt to send an sms to the number configured in config.h,
usually it is some "+44xxxxxx" style with 44 being the UK 46 Sweden etc.

It will look like this:

Status: ON/OFF
useful if you are suspecting some faults in the remote end.

You can also try the "s" option from the maintenance menu
sHello This Is Santa Calling

should get you a nice xmas message on your phone!



That's about it, for anything except this refer to the code and modify it
at will.


DISCLAIMER:
------------
The usual stuff:
If this catches your house on fire or start sending annoying or insulting
sms messages to your friends or making prank calls to your operator,
(or the emergency number) gives you an enormous phone bill or simply makes
you need a shrink.
There is no warrante whatsoever etc. blabla. Eggsalad. Don't sue me.

Source: README, updated 2013-03-16