I have an update on progress toward the RPi based personal goTenna to SMS gateway project.
@Tourmaline_Wireless has volunteered to help push this idea forward and we have worked together to refine the code for both the mobile SMS client and RPi gateway code. We also have a low-power hardware specification and have tested with a low cost SMS backend.
Mobile App
There is now a new version of the Mesh fork of the Signal App (gotenna branch) that I described earlier. When you have a goTenna connected and there is no mobile connectivity then this version of the app automatically sends SMS messages to the SMS Gateway GID (eg. 555555555) over the goTenna mesh.
Messages sent to the gateway are prepended with the phone number of the destination. When the gateway receives the message, it sends the original message via SMS to the pre-pended phone number. If someone replies via SMS to the gateway from a phone number that the gateway delivered a message to from the mesh, then the gateway can lookup the mesh GID and forward the reply to the original mesh message sender (see the diagram above).
Gateway
The gateway server code (sms_gateway.py) is a modification of sample.py from the USB SDK which runs on an RPi with an GSM modem attached. You run it with the following parameters:
- app token for goTenna SDK.
- geo region number you are in.
- serial port of the GSM modem
- speed of the serial port of the GSM modem.
For example:
$ ./sms_gateway.py <your SDK Token> 1 /dev/ttyS0 115200
Welcome to the SMS Mesh Gateway API sample! Press ? for a command list.SMS Gateway> ?
Notice the three added commands: send_sms, read_sms and delete_sms. You can use these commands to test connectivity with your attached GSM modem.
SMS Gateway> send_sms 2125551212 hello GSM user!
The gateway forwards messages it receives over the mesh to the phone number prepended to each mesh message by the Mesh Signal App. When the gateway receives an SMS, if the SMS came from a phone number the gateway previously sent a message to, then the gateway knows to forward it back to the mesh GID that sent the original message.
Hardware
I’ll let @Tourmaline_Wireless talk more about the hardware side of it, but I have done my testing on a RPi 3 with a goTenna Mesh and a DLink DWM-157 USB Dongle GSM Modem attached. Each of these items costs around $30. I used a Twilio Programmable SIM card for the GSM subscription. The SIMs cost around $3 each and maintaining a phone number costs $1 a month plus usage.
Trouble Shooting
- You can type AT commands directly to your GSM Modem using the screen command. You can use this to confirm you have the right serial port and that the modem is responding.
$ screen /dev/ttyS0 115200
AT
OK
- Make sure that the Mesh Signal App project uses the same goTenna SDK token as you use when you launch sms_gateway.py
- You might need to put your GSM modem and/or goTenna on a powered USB hub if the USB ports are not supplying enough power.
Future
We’d love to see more people testing and eventually building on what we have done so far. Some next steps for the software development are :
- The app should try to send messages first over the mesh network before sending to the SMS gateway
- Instead of prepending the remote phone number, add it as a new TLV
- After messages have been delivered, delete them from the GSM device
- End to end encryption when both ends of the conversation are using the Mesh Signal App.
I’d also like to have a map where people can register their SMS gateway locations and perhaps map out it’s coverage. If gateways and mobile apps all used the same SDK application token then people could use whichever gateway they were nearest too.
To help subsidize and encourage people to run gateways that other people can use, I would ultimately like to have them support messages that include Lot49 based micropayments. This would lay the groundwork to build a sustainable bottom up mesh network.