Recently I bought an instance of adafruit’s SIM800 breakout board ‘fona’. This board allows for sending and receiving of SMS text messages (and a lot of other functionality, of course. But I covered only the text messages for scratch). For the text messages, I added an adapter for my scratchClient software.
For download and documentation, see [url]http://heppg.de/ikg/wordpress/?page_id=6[/url]
In scratch, a variable ‘sms_out’ is used to send messages, incoming messages are in the sensor value ‘sms_in’. Easy to use, and today I ignored provider cost and have sent me SMS every hour ‘scratch installation still running’. Could be more useful, but is fun when your computer gives you a call.
Connection of fona is by RX, TX to TX, RX of raspberry. You need to remove some getty processes from this line, there are documentations around describing this.
The sim800 uses an AT-protocol, like ‘at+cpin?’, and receives signals like ‘+CPIN: SIM PIN’.
For the initialization of the device, the adapter implements a state machine, which step by step initializes the modem, sets the pin and then waits for action.
Switching the modem on is done by pressing the ‘on’ key on the breakout board. Could be done by using GPIO, but I decided to need some additional access control.
The receiver side oft the serial protocol reads line by line, looks for known names and feeds the state machine with input.
The code is still experimental. There is no buffering for scratch input, so if scratch feeds too fast, there will be lines dropped. But It is not intended as a spam machine… The phone number being called on send events is fixed for the same reason.
If you want to run the software, be sure to have a backup phone which allows to reset the pin (in case it was forgotten to configure the pin in the adapters xml file, it might happen that after a few retries the device is blocked.)
And the manual of the sim800 is useful. Which is 300 pages.