Interfacing Arduino to USB GPRS modem



Cheap GPRS modem from Dealextreme

USB GPRS modem
by Oleg via Circuits@Home

Some time ago I started writing about connecting Arduino to cellular network. Using standard GSM AT commands, a program running on Arduino can place and take calls, send and receive SMS, shoot pictures, access the Internet while monitoring phone’s battery level, signal strength and connection status. For many of these tasks any old phone works quite well, however, there are times when a specialized piece of hardware is desired. Today I’m going to talk about one such piece of hardware which can be connected to Arduino board using USB Host Shield.

USB Tri-band GPRS Modem from DealExtreme is just an ordinary GSM cell phone minus keyboard, display, battery, and built-in microphone/speaker. What is left makes inexpensive (~$25), lightweight (25 grams) and compact (see title picture) GSM/GPRS module to use in DIY projects. It supports a standard subset of GSM commands as well as some proprietary ones. The modem is built around BenQ M23 GSM/GPRS Wireless module and uses Prolific PL-2303 USB-to-serial converter. As explained on this page, the PL-2303 in the modem uses non-default USB PID; make sure to grab the latest version of my library, which transparently supports both PIDs.
To explore the functionality of this device I wrote a simple program which is based on Xbee terminal. The program initializes the PL-2303 and waits for user input passing keystrokes to the modem and displaying replies to the screen. Let’s run it and see what this little modem is capable of.

The hardware arrangement is shown on title picture. During normal operation the system can be powered from USB; depending on your Arduino board you may need to disconnect the modem during programming. All interactions occur via terminal emulator running on a PC – I use putty on Windows and minicom on Linux. Using serial monitor built into Arduino IDE is not recommended. The modem needs activated SIM card to function, I use prepaid SIM from T-Mobile and also successfully used it with AT&T.
If everything is connected correctly sketch will output the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Start
PL Init
Addr:1
NC:1
0000: 09 02 27 00 01 01 00 A0 FA 09 04 00 00 03 FF 00
0010: 00 00 07 05 81 03 0A 00 01 07 05 02 02 40 00 00
0020: 07 05 83 02 40 00 00 Conf.Val: 01
Iface Num: 00
Alt.Set: 00
Endpoint descriptor:
Length:         07
Type:           05
Address:        81
Attributes:     03
MaxPktSize:     000A
Poll Intrv:     01
Conf.Val: 01
Iface Num: 00
Alt.Set: 00
Endpoint descriptor:
Length:         07
Type:           05
Address:        02
Attributes:     02
MaxPktSize:     0040
Poll Intrv:     00
Conf.Val: 01
Iface Num: 00
Alt.Set: 00
Endpoint descriptor:
Length:         07
Type:           05
Address:        83
Attributes:     02
MaxPktSize:     0040
Poll Intrv:     00
Conf:1
PL configured

The last message (line 38) shows that PL-2303 has been recognized and successfully configured. Type at on the keyboard and press Enter. If you see OK on the next line the modem is alive and answering.
...
Conf:1
PL configured
at
OK
Now let’s see if a modem is connected to a network. Type at+creg? and press Enter:
at+creg?
+CREG: 0, 1
 
OK
The second number in reply indicates the state of registration. My output (1) means the modem is happily registered with home network. Other numbers you may see are “0″ – no service, “2″ – searching for operator, “3″ – registration denied.
If modem is registered, it is possible to determine the cell operator:
at+cops?
+COPS: 0,0,"T-Mobile 260"
 
OK
When modem is online, we can do something useful. I’ve already sent several text messages to this number, let’s take a look at them by using +CMGL command:
at+cmgl=1 +CMGL: 1,1,,50 07912160130320F8040B919127163673F500001101814190044A23F3F61C6496BFDBA0F3FB7D6697152D503BACAFCBDF76C0B91D4EB35DE3771B +CMGL: 2,1,,57 07912160130320F5040B919127163673F500001101814124244A2B66F9BB0D3ABFDF677619447F83885850FB4D2EB7152D503BACAFCBDF76C0B91D4EB35DE3771B +CMGL: 3,1,,53 07912160130320F8000B919127163673F500001101817184554A26F4F29C0E9A81CCF2771B747EBFCFECB2A2056A87F575F9DB0E38B7C369B66BFC6E03 +CMGL: 4,1,,53 07912160130320F8040B919127163673F500001101817145154A26F4F29C0EA281CCF2771B747EBFCFECB2A2056A87F575F9DB0E38B7C369B66BFC6E03   OK
What you see is output in so-called PDU format. Many GSM devices have this format turned on at power-up. It is OK for computers but not so easy for humans. Luckily for us, this modem also supports SMS text mode, which can be turned on using +CMGF command:
at+cmgf=1
OK
at+cmgl="ALL"
+CMGL: 1,"REC READ","19725555555",,"11/10/18,14:09:40-36",145,35
sms from google- m...v@gmail.com
+CMGL: 2,"REC READ","19725555555",,"11/10/18,14:42:42-36",145,43
from google to DX modem - m...v@gmail.com
+CMGL: 3,"REC READ","19725555555",,"11/10/18,17:48:55-36",145,38
test 3 from google- m...v@gmail.com
+CMGL: 4,"REC READ","19725555555",,"11/10/18,17:54:51-36",145,38
test 4 from google - m...v@gmail.com
 
Sending messages is also easy. It is done using +CMGS command. The command takes recipient’s phone number as a parameter and outputs a prompt where a message can be entered. End of message is indicated by pressing Ctrl+z, make sure your terminal program passes this code unchanged to the modem (putty works correctly here). Here is an example:

at+cmgs="19725555555"
> test from T-Mobile to google
> +CMGS: 34
OK


There is much more that can be done with this little modem (or to any GSM phone for that matter). Some things, like placing or receiving calls, are pretty easy to do, while others, like accessing internet, would require some extra programming. In coming weeks I’m planning to develop code to support a cell phone in unattended mode; in the mean time, try to talk to your phone via terminal and let me know if you have any issues.

GPRS modem hack for use with standard prolific drivers


By Brody Radford

DealExtreme sells a USB GPRS modem for $25.35… good value. I bought one for my UAV project. It uses the BenQ M32 GPRS module (pdf) and Prolific PL-2303 USB-TTL UART bridge (pdf).

Too bad the device’s PL-2303 USB<->UART bridge has a custom PID (0609, instead of the factory-default 2303; the VID 067B is unchanged), and the supplied software and documentation that work with it aren’t much use. To be useful I need direct access to the device.

I tried modifying the driver, but Windows (7, x86) returned an error to the effect that it wasn’t going to work on my system. But there’s always another way, so… out with the toolkit. The device has an EEPROM which stores custom settings for the PL-2303, so disconnecting it would solve my problem, with the added benefit that if I reinstall Windows or plug the device into another machine it will work with standard drivers.

Hacking the GPRS modem
Time: 5 minutes
Tools:
  • Small Philips screwdriver
  • Soldering iron
  • Solder
  • A sharp pick or tweezers
  • Optional: solder wick to remove any stubborn solder
1) Toss out the supplied user guide and CD.
2) Open the case (three small Philips screws).
3) Locate the PL-2303′s external 24C02 EEPROM:


4) De-solder pin 5, shown below. I added a little solder for heat transfer, and pulled the leg up with tweezers.
Lift this pin on the 24C02

5) Download and install the PL-2303 driver from Prolific.

6) Plug in the device, wait for drivers to install.
7) Open a terminal program with the new COM port (check device manager if your terminal doesn’t detect it) at 115200bps (Update: supposedly the module has autobaud rate detection from 1200 — 115200bps, so others may also work… I can’t remember a specific reason for using 115200, so just try what suits) with other settings left to their defaults.]
8) Start typing AT commands to send SMS messages etc. Look here (PDF) for the command set.
Connecting to a microcontroller
To do this you’ll need to isolate/disable the PL-2303. Here are some ideas:
  • Remove the chip and solder to the TX and RX pads. Careful not to tear up the pads (flood each side with solder and lift, mop up with wick). This is the easiest in terms of soldering, but you can’t go back to USB so easily.
  • Lift the TXD pin (1) and solder wire to the pad. Solder directly to the RX pin.
  • Solder to the TX and RX pins and tie RESET_N to GND to tri-state the TX pin.
Tips
  • Don’t forget to connect GND between the two systems!
  • The M32 module TX & RX pins appear to be 3.3V logic, and may or may not be 5V tolerant… Be careful! If your microcontroller has 5V I/O, you’ll need to run it at 3.3V or convert logic levels.

Synapse Wireless


There’s a New SheRifF in Town and Their Name is Synapse Wireless

By skaterj10


It seems that we in the hobby industry have been a little naive as to think that Digi International’s reign as RF Networking King would last forever? Not only have Roving Networks under cut them on pricing with their new WiFi node but they now have some stout competition from Syanpse Wireless in the 802.15.4, 2.4 GHz node market as well. Many companies are closing the gap on Digi, and even surpassing them in some cases.


The 802.15.4 RF network node that I’d like to talk about is the Syanpse Wireless RF100PC6 RF Engine. These nodes are very unique in that they not only house a RF network transceiver chip but also a user-programmable microcontroller (uC) as well. The RF100 nodes are actually configured by uploading code to the uC in the form of SNAPpy scripts (a programming language that is python based) using the freely downloadable Portal Software. These scripts can very quickly uploaded to the nodes and will configure the network without the need for a serial monitor, API, or drop-down system. Although, in Portal they do include a drop down system if you’d like to program nodes that way.

One huge benefit is that the nodes can do self-healing mesh networking right out of the box and can also do an RPC (Remote Procedure calls) to make another nodes in the mesh toggle or generate a pulse on an unrelated pin and do transparent serial communication at the same time. This feature is like both Xbee AT and API modes at the same time. One other amazing feature is the massive transmission range, they can transmit even further than WiFi nodes.

Another benefit of the RF100 nodes is that they can be configured OTA (Over the Air) as long as you have a node that is fresh (meaning it’s been erased or has never been user-programmed yet) and hooked the PC/Laptop side via a COM port (or through a USB-serial device). So say you want to modify the code on a node that you just recently placed on the roof of a building, no worries, because it doesn’t even matter how it’s configured the Portal Software will pick it up (making sure you have a fresh node on the PC-side) and you can re-upload to it.

The RF100 nodes have several other interesting features and applications including, as we just recently found out, being able to wirelessly program the Arduino UNO when setup up as a transparent serial link (with other additions) and when using Arduino1. The SB Freeduino and Arduino Duemilanove can also be programmed wirelessly using the same SNAPpy scripts but with minor changes to the UART baud rate (from 115220 to 57600).

And for all the Arduino hateboys out there, the fact is that Arduino is just a Atmega328p with a serial bootloader that talks to a free and simple IDE. These Syanpse Wireless nodes can be used to program ANY uC with a serial bootloader and all that may be needed is an adjustment to the reset timing. Oh yes, and level shifting for the serial lines (Tx/Rx) would be a good idea if a 5V logic uC was being used with these 3.3V based RF100 modules.

Notable Specifications and Info

Power consumption: Down to 1.6 uA with internal timer running.

General purpose Input/Output Pins: 19 GPIO with 8 being available for 10-bit ADC (Analog to Digital Conversion).

Code space: 60kB programmable flash, with 20kB available free for user applications , the rest of the flash holds the code for the Self-healing mesh networking and other synapse features.

Range specs: 3 mile outodoor LOS (Line of Sight) Range, 1000 ft. indoor range with an F type PCB antenna. Note: even the newest 2.4 Ghz Xbee modules with external antennas can not meet this kind of transmission specification.

Operating temp: -45 to 85 degrees Celsius (a very healthy range for outdoor applications)

Other communication types: Has SPI and I2C capabilities but unfortunately they aren’t tied directly to the onboard microcontroller SPI/I2C lines, rather they are common I/O transmitting these signals that are bit-banged out which makes them more of a one way communication. The RF100s also have an extra UART for a second serial communication link to other devices.

Code examples: Along with many code examples included with the Portal Software, Synapse Wireless has also sponsored an open source repository of SNAPpy scripts.

Warning: Because of their increased transmission range there’s a silver lining which is that you’ll have to be aware that Synapse nodes do have an FCC warning that they should not be within 20 cm of the body when active.

Purchasing Options: Currently there are only 2 places in the world to buy these modules, Future Electronics and the Open-source Hardware and BEAM robotics company Solarbotics. I’m not sure why all the nodes have “Call for Pricing” at Future, but at Solarbotics pricing is available.

I think this up and coming company Synapse Wireless is definitely going to give Digi a run for their money in the industrial and hobbiest communities.