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 OK |
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.
Oleg.
[…] Interfacing Arduino to USB GPRS modem @ Circuits@Home. Oleg writes – 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. Filed under: arduino — by adafruit, posted October 21, 2011 at 5:17 am Comments (0) […]
Does it happen to have the M2M firmware version?
I don’t know, this is what +CGMR shows:
at+cgmr
SW ver: 1.80
HW ver: 1.00
FS ver: 1.00
Build Date: 2004/6/25
Build Time: 18:40:37
OK
If there are any other commands which give more information, let me know – I’ll run it and post results here.
Perhaps
AT$TIMEOUT=2000
A full example from a BenQ AT command manual:
I successfully configured everything. Except that I’m getting garbage after “ATD”. It connects and then I get:
CONNECT
~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~~รฟ}#ร!}!}#} }3}”}&} } } } }#}%ร#}%}’}”}(}”หรฉ~
NO CARRIER
I read somewhere that it is a PPP stake return and I should implement PPPD or something to decode it. Any idea what I’m getting and how to fix it? I’m using the same modem as Oleg has used.
Thanks in advance.
-AJ
I can’t find any PPP examples for Arduino. I’m afraid you’d have to implement your own.
Very cool, Oleg, thanks. Looking forward to the upcoming articles on this.
You can also skip the USB part and tap directly into the serial line on the board as detailed on the (Probably) The Cheapest way to add SMS to an Arduino page. That page is also notable for containing links to the BenQ M32 data sheet and AT command reference documents. Sadly, his promised library never materialized so I’m looking forward to yours ๐
Hey Oleg,
I’m trying to connect to a Huawei E160 modem using your USB Host libs and a Seeeduino Mega ADK.
The problem is that the acm_terminal sketch seems to parse unsuccessful for an acm device.
Using a Nokia E52 I get a rcode=5 (Stall) from ‘rcode = pacm->SetControlLineState(3);’ very close before starting the teminal.
This is what the USB_desc sketch says parsing the E160:
“Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 12D1
Product ID: 1001
Revision ID: 0000
Mfg.string index: 03
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 006C
Num.intf: 04
Conf.value: 01
Conf.string: 01
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Addr:1(0.0.1)”
Any ideas to get this stick running?
Thanking you in anticipation.
Chris
We have discussed this device in comments to this article -> http://www.circuitsathome.com/mcu/programming/interfacing-arduino-to-a-cellular-phone
I use ZTE MF626 modem to switch on I must give this message
########################################################
# ZTE MF622 (aka “Onda MDC502HS”)
# ZTE MF626
# ZTE MF628+ (tested version from Telia / Sweden)
# ZTE MF633
# ZTE MF636 (aka “Telstra / BigPond 7.2 Mobile Card”)
# ZTE MF637
# and probably others not listed here
#
# Contributor: Joakim Wennergren and others
DefaultVendor= 0x19d2
DefaultProduct= 0x2000
TargetVendor= 0x19d2
TargetProduct= 0x0031
MessageContent=”5553424312345678000000000000061e000000000000000000000000000000″
MessageContent2=”5553424312345679000000000000061b000000020000000000000000000000″
NeedResponse=1
########################################################
can u say how to do it please Oleg?
AT^U2DIAG=n Turns on and off the first interface starting is CD to load drivers from usb modem. for n n=8 off and n=9 on
With above switch off
USB result
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 19D2
Product ID: 0031
Revision ID: 0000
Mfg.string index: 02
Prod.string index: 01
Serial number index: 03
Number of conf.: 01
Configuration descriptor:
Total length: 006C
Num.intf: 04
Conf.value: 01
Conf.string: 00
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Addr:1(0.0.1)
but still not seem as MODEM Oleg?
You not take my comment now Oleg ?
Funny can’t post result after above?
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 19D2
Product ID: 0031
Revision ID: 0000
Mfg.string index: 02
Prod.string index: 01
Serial number index: 03
Number of conf.: 01
Configuration descriptor:
Total length: 006C
Num.intf: 04
Conf.value: 01
Conf.string: 00
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Addr:1(0.0.1)
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 19D2
Product ID: 0031
Revision ID: 0000
Mfg.string index: 02
Prod.string index: 01
Serial number index: 03
Number of conf.: 01
Configuration descriptor:
Total length: 006C
Num.intf: 04
Conf.value: 01
Conf.string: 00
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
try post usb result but not accepted
The site took 3 other comments from you. Try again – maybe you were posting too fast?
Try again maybe long? Takes short post sorry
This with usb_desc – is it switched now ?
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 19D2
Product ID: 0031
Revision ID: 0000
Mfg.string index: 02
Prod.string index: 01
Serial number index: 03
Number of conf.: 01
Configuration descriptor:
Total length: 006C
Num.intf: 04
Conf.value: 01
Conf.string: 00
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Addr:1(0.0.1)
No tried 3 times and tried agn now – here is small bit may be fault in copy . is it switch now?
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Not any help wait for you !
One post just show up.
What is answer please Oleg
You write programs ,what does the output mean?
I can see two proprietary interfaces and two mass storage interfaces. If you think proprietary interfaces are in fact ACM, you’ll need to modify config descriptor parser in Init().
Thank you reply
How to do “modify config descriptor parser in Init()” exactly -still work through you aricals -very complex
No intention of helping really just want to sell !
April stop spamming and using google translate, please.
What rubbish I seek an answer You will not give a straight answer ! What else can I do but ask ?
How do you โmodify config descriptor parser in Init()โ exactly . Please explain further
Read lines 95,96 in confdescparser.h -> https://github.com/felis/USB_Host_Shield_2.0/blob/master/confdescparser.h
Hello to everyone,
I’m about to buy this gprs modem from DX, I need it to send and receive SMS from a PC using java. Am I going to see this modem as a COM# (serial) device?? Im used to work with the PL-2303 USB to serial, since my laptop doesnt have any serial ports, but everything I’ve connected with this adapter has behave as a serial device.
I know you guys are arduino hardcores! but a little help please? I dont want to mess around with usb libraries in java, serial is too easy!
Thanks in advance
Your USB-desc code seems to cycle through each interface and describe it . Fine .
I wish to modify your ACM code to go to a particular interface -say interface 02 endpoint 84
How do I do that Oleg ?
ConfigDescParser() doesn’t take interface number. You give it properties contained in your interface’s descriptor and it fills endpoint data structure when it finds this interface in configuration descriptor. Take a look at the code on github, there is plenty of ConfigDescParser() usage examples.
ะะปะตะณ,
ะฑะพะปััะพะต ัะตะปะพะฒะตัะตัะบะพะต ัะฟะฐัะธะฑะพ ะทะฐ ัะฐะบะธะต ะฟะพะดัะพะฑะฝัะต ะพะฟะธัะฐะฝะธั ะฟะพ ะธัะฟะพะปัะทะพะฒะฐะฝะธั ะฐัะดัะธะฝะพ ะธ usb ั ะพััะฐ.
ะัะตะฝั ะดะพั ะพะดัะธะฒะพ ะธ ะฟะพะฝััะฝะพ.
ะฃะดะฐัะธ ะฒ ะดะฐะปัะฝะตะนัะธั ะธััะปะตะดะพะฒะฐะฝะธัั :)
ะกะฟะฐัะธะฑะพ ะทะฐ ะดะพะฑััะต ัะปะพะฒะฐ. ะัะปะธ ะฑัะดัั ะฒะพะฟัะพัั – ะฝะต ััะตัะฝัะนัะตัั, ะทะฐะดะฐะฒะฐะนัะต ๐
Hi Oleg,
I am new in this business, I bought this usb shield last weekend. It would be very nice if some one can help me step by step how to make this shield work with my Uno, please. Thank you.
Have you seen this already -> http://www.circuitsathome.com/usb-host-shield-hardware-manual
Hi Oleg, thank you for prompt reply!
Yes, I’ve already read the manual.
I manage to upload pl2303_gprs_terminal.pde to Uno (stacked with USB host shield) but nothing comes up on Putty (8-N-1 9600baud).
Sorry if this is a silly question ๐
You need to set your terminal to 115200. If you want different speed, you can set it in line 60 of the sketch.
Still nothing comes up in Putty.
BTW, what the sketch should do?
Is it should show output text like above when I plug Uno (+usb shield and gsm modem) usb cord? Or I should press RESET button on usb shield?
It should at the very least print “Start” on the terminal, even without a shield installed.
Hi again Oleg,
Now it print “start” on the Terminal screen.
and unstopable “Ret: 0D”. Baud is 9600 at line 60.
I also try different gsm modems, some times only “start” at terminal window.
What’s wrong now?
thanks
I remember seeing this behaviour when a modem (actually, it was a phone) has incompatible SIM card, like TMobile locked phone with AT&T SIM card.
0D means no response, could be power issue as well. Can you get anything from the device, like a descriptor?
How to get a descriptor from the device/modem?
USB_desb or hub_demo from examples can be used for this purpose. Hub_demo waits for quite some time to get all potentially connected hubs enumerated but doesn’t actually require any, just plug your device and run the sketch.
Hey mate
ive got a 3g 4-port modem with a MC8780 Sierra Wireless mini-pci card.
i cut the usb lines running from the minipci card to the main cpu “BCM6359XXXX”and soldered some pins from usb+ and – and ground i left power as the the modem powers the card and hooked up a usb lead and pluged it into my pc hopeing not to blow anything up and it worked up came a few ports and a minicard in device manger so i installed some drivers and it works i can issue AT commands via “putty” and the little bugger responds like a champ so…..
๐ i would like to use my usb sheild with this unit so i tried your code just hopeing it might work but no dice :/ but i was able to get the device descriptor info useing your hub code i hope this can help
[code]
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 1199
Product ID: 6832
Revision ID: 0002
Mfg.string index: 01
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0043
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: E0
Max.pwr: 00
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 07
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 03
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0010
Polling interval: 80
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 05
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Addr:1(0.0.1)
[/code]
also when i run your code i get the same spam as homer about the repeating Ret: 0D
its goes something like
start
PL init
Ret: 0D
Ret: 0D
Ret: 0D
Ret: 0D
Ret: 0D
….ect
^ect
ok i hope ive given you enough info to help me ๐ & thanks for your great library and hard work best stuff ive seen for awhile and fun to think of what can be done
Sierra Wireless is proprietary, I don’t have a driver for it.
๐ oh fair enough i just though it was as simple as finding the endpoints and stuff for this port http://www.tom-bmx.com/img/jss/rd/20120319-f82-29kb.jpg then chucking AT commands at it lol i am very new to this though so i just jumped ahead of myself there , guess i’ll start looking for a serail port on the board maybe or just buy one of the same units you used , its sad to see it go to watse though , what do you need from the Sierra Wireless driver and would it be naughty to look at in asm and decompile it ?
You don’t need to decompile. There is a Linux driver for this chipset, you can write your driver from Linus source code.
nice so your saying it can be done :)? if so is this something i would be able to do “im really new to this” ie im a call of duty modder and gsc is the only code i know lol
Only you can answer this question.
im sorry ,have i done something to offend you?
i am new to this and really have no idea if it can be done so i can not answer this question
you can however but you dont seem too keen on giveing me any help or even answering a question . you have come across very arrogant
who helped you when you where starting and where they so nasty to you?
Hi,
I want to use your shield with the DE modem. However I’m quite new to arduino. Is there a complete example to send and receive sms for a newbie?I hope I’m not missing already given sketch.Thanks.
You are looking at one – it’s in the article, right above the comment section.
Thanks for your quick reply. I think given examples are over terminal, not arduino itself.
You can replace keyboard input with your own strings – the transport stays the same.
Hi Oleg,
I wonder if this sketch works fine using a different USB GPRS Modem, as for example, an ZTE MFxxx series. I’m working on a proyect to connect an Arduino Nano to a local database through the ZTE Modem using a USB Host shield. Thanks in advance!
I don’t have any data about your modem. Can you read USB descriptors off of it and send them to me?
Thanks for your prompt reply Oleg. You can access the descriptors data in http://www.lucascolo.com.ar/MF110.html
According to the descriptors this device is mass storage (AKA flash drive) so it won’t work with any of the serial drivers. You need to find out how to switch it from mass storage to serial mode.
I managed to disable mass storage mode. For those who have the same issue, use the following code:
AT+ZOPRT=5
AT+ZCDRUN=8
To enable mass storage again, replace 8 with 9 in ZCDRUN.
I upload the descriptors again in http://www.lucascolo.com.ar/MF110-1.html
Please check it out Oleg! Thanks in advanced!!
Now all interfaces but one show vendor-specific class. They may still be compatible with one of the supported chips but you’ll need to change Init() to trigger on vendor-specific class instead of generic one.
Trying to get the reply button to put this where I want it .It doesnt work it seems .
@luc If you get the mass storage to switch off and are able to access the modem proper please post back what you did with init()
Since DealExtreme publishes no data on the modem that I could find, I wonder if you knew the power draw of the modem…
Several GPRS daughtercards I looked at require high amp draws on startup (up to 2A). If this USB stick is better behaved and operates at 5VDC, that could be a really important distinction…
I haven’t measured the current but since it works with Arduino powered from USB it certainly consumes less than 2A.
If you get this to run please post back what you did with init()
Hey its hector again
about the MC8780, i found the linux sierra.c file and had a read through .
but im still unable to answer that question ๐ , well i can half answer it and say I caint do it . however is it something that could run on the arduino if someone clever enough ported it ?
heres a link to the c code i found http://lxr.free-electrons.com/source/drivers/usb/serial/sierra.c line 273 is my card.
The modem won’t require much resources on the MCU side so I believe it can be done.
thanks man i appreciate your respose ๐ .
i’ll post up on the arduino forums and see if anyone can guide me through where to even begin lol.
Got my shield, looking forward to using it! … Just need the modem now…
Quick question: is there a way to get system time easily from the phone company network? Or do you need to dial into a ntp server via GPRS?
I was unable to find a direct way to get time from the network. One way to do it is to send or receive an SMS and then read the timestamp. This will be accurate to a couple of seconds.
Hi,
I have been going through this project but I think i need to develop more understanding about the tool that are being used.
I need to communicate with a modem ( be it 2G or 3G ) but I want to communicate directly from the Micro controller ( Arduino Platform )and not from a PC. I have read the detail of your project and what I wanted to know was whether you are using the Arduino alon to communicate with the Modem or your using the PC to communicate with the PC.
Moreover, are there any libraries through which we can execute AT commands for a particular Modem via USB connection with the Arduino
My question may sound a bit dumb but I am a newbie and I hope you can help me ๐
BR,
Vik
Hello Oleg,
Thanks first for the support you provide. I managed to set everything and the configuration seems ok, however, I don’t get any response from the modem. Here is my usb descriptions:
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 08
Vendor ID: 067B
Product ID: 0609
Revision ID: 0000
Mfg.string index: 00
Prod.string index: 00
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0027
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: A0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: 00
Intf. Protocol: 00
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 000A
Polling interval: 01
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 83
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Addr:1(0.0.1)
I am in Canada and I am using a Wind Mobile sim card…(I think it’s of a similar network as T-Mobile). Any Help is appreciated as I plan on donating my kit to a school after I understand its workings.
Make sure your card is working. IIRC, modem stops responding when it receives “service declined” response or similar. Put the modem inside a metal enclosure so that it will be in “searching for network” state permanently and see if it responds to at commands.
Hello Oleg
Thank you for the library. It’s great.
I’m making a project that would need to send SMS automatically. Do you have any idea how I could do that?
Thank you for your support!
Thomas
Hello Oleg,
I tried encasing the kit and launched the PuTTY.exe program which returned the following:
——
Start
PL Init
Addr:1
NC:1
Conf:1
PL configured
——
It was configured on “serial” at 115200 (com6 in my case), but I don’t get the option to input anything. I get an input field in the Arduino IDE serial monitor, but it doesn’t return anything. The card is working as it is the sim card I use in my mobile phone.
I am going to read this page once more as I may have missed something…
Thanks,
Just a detail I may have missed: do I need to modify the modem in anyway? I just plugged it the way I received it from dealextreme. I only inserted a sim card…and followed through the steps (run the arduino sketch you provided and downloaded puTTY.exe for windows). Going through the article again as I don’t think I am missing something.
Have you tried to enter ‘at’ and press Enter? It is hard to use serial monitor interactively, putty is a good choice. You can also try to connect this modem to a PC, just install modified Prolific driver (check DE ) or use Linux.
One other thing: The receiver on this modem is not very sensitive. Shouldn’t affect command mode though.
I haven’t used mine for a while, will try to find some time, connect it and see how it behaves in different situations.
Hi Oleg,
I modified the modem (de-solded one pin) as shown at http://www.brodyradford.com/2011/01/hacking-the-dealextreme-gprs-modem/
Up to point 8 only.
From there I downloaded the Modified driver at
http://www.prolific.com.tw/eng/downloads.asp?id=31
which installed well (I found a connection at COM9). However, puTTY.exe is still not allowing me to input anything. The is a green box (cursor) but it doesn’t respond. I typed AT and pressed Enter, but nothing happens… I don’t want to good the the removal of the PL2303 as suggested in the website before seeing at least a little response. Has anyone posted a video? I find it better to follow…just a suggestion.
G
Hello Oleg,
I have implemented CDC ACM logic from your source code to our Stellaris Cortex M3 platform.
I can now communicate with Benq M23.
I’m having problem detecting when socket is closed.
We are used to detect this using DCD pin on other serial communication modems.
I have noticed that CDC ACM has this capability with interrupt endpoint.
When I first open a socket I receive data on interrupt endpoint:
A1 20 00 00 00 00 02 00 83 00
By USB Class Definition for Comminication Devices pdf, this is a Class-Specific Notification 0xA1 with “Serial State” notification 0x20, indicating that DCD signal is high.
But if the socket is closed I stop receiving endpoint interrupts.
Are you familiar with this modem interrupt endpoint behavior?
Best Regards
Peter
I’m not familiar with ADC interrupt endpoint specifically but in other devices interrupt endpoint talks only when there is data to send; you’ll probably getting DCD low notification once at some point. Are you receiving DCD High notification just once also?
I receive DCD high notification only once when socket is opened. The second time when socket is closed DCD low is not present, which would be useful for detecting if other side has disconnected. Now, I have implemented a NO CARRIER detection. But interrupt would be more elegant. Thanks for all the information.
Peter
Hi,
I was trying to compile your code for PL2303 and I am getting the following errors
In file included from C:\Users\EWAQAMU\Desktop\arduino-1.0\libraries\UsbHostShield\/adk.h:27,
from C:\Users\EWAQAMU\Desktop\arduino-1.0\libraries\UsbHostShield\adk.cpp:20:
C:\Users\EWAQAMU\Desktop\arduino-1.0\libraries\UsbHostShield\/usbhost.h:64: error: ISO C++ forbids declaration of ‘pioWr’ with no type
C:\Users\EWAQAMU\Desktop\arduino-1.0\libraries\UsbHostShield\/usbhost.h:64: error: expected ‘;’ before ‘void’
C:\Users\EWAQAMU\Desktop\arduino-1.0\libraries\UsbHostShield\/usbhost.h:130: error: no ‘void MAX3421e::gpioWr(uint8_t)’ member function declared in class ‘MAX3421e’
Do you have any idea where I might be going wrong ?
You need a fresh copy of the source code. The original line 64 defines
gpioWr
, what you see is a typo. https://github.com/felis/USB_Host_Shield_2.0/blob/master/usbhost.h#L64Hi Oleg,
I finally got to try out the USB host shield with the Dealextreme GPRS modem and a pre-paid SIM from embedded works. I uploaded the PL2303_GPRS terminal program successfully and it boots with the following message:
“Start
PL Init
Addr:1
NC:1
Conf:1
PL configured”
when I tried the CREG command I get the following:
“AT+CREG?
+CREG: 0, 5
OK”
Any idea what the 5 response means?
Have you checked the M23 manual already?
Hi Oleg,
So that 5 turns out to be the “registered but roaming” indicator. Using the COPS=? command, I was able to find my provider (cingular) and then bond to it using the COPS command.
BTW, that is one giant manual that BenQ put out. I am using a SIM from embeddedworks, and I have yet to configure the APN because the provided APN server address is invalid. I presume that the APN configuration has to happen before GPRS services are enabled?
OK, experimented further. Looks like the BenQ does a lot of the heavy lifting for the user. For example, after registering the APN, one can define the destination and just go (see the M2M section). My next steps are to get the thing to connect to Pachube using a modified version of your terminal program, i.e. not one that uses the Serial as a input, but rather one that uses the serial only for output.
We’ll see if I get there. Have you ever tried getting the M32 to connect via GPRS and Jasper to pachube?
I haven’t tried to do anything beyond SMS. GPRS is very cool, please keep us posted :-).
Hi,
I am waiting for my modem to be shipped. But I wanted to ask whether you would be producing some work on actually connected to the internet (I think PDP Activ context can be achieved via internet) and post something on it. Moreover, do u have any plans of working on activating PPP via the modem ?
BR,
Vik
i just wanna ask that you have included .h files but i can’t find link for them , can you please reply with their link , thanks
Which files specifically?
#include
#include
#include
#include
#include
#include
#include
#include
/* CDC support */
#include
#include
/* Debug support */
#include
#include
#include
#include
Do you know if the USB shield would also be able to use a CDMA aircard such as this one?
http://www.ebay.com/itm/Sprint-U300-USB-3G-4G-Broadband-Aircard-Modem-WiFi-/400219102308?pt=PCC_Modems&hash=item5d2eeadc64
My ultimate goal is to use a cheap data-only plan like this one…
http://www.embeddedworks.net/pdetail.php?mn=wsim&mid=mwsim4039&prod=wsim295
…so that I can send data to an Arduino advice at a remote location, and I’d prefer not to be stuck with only GSM providers since CDMA seems to have much better coverage.
I would certainly welcome your input or any helpful advice that may set me off in the right direction.
i have tried the code but after “Start” i receive “OSCOKIRQ failed to assert” , what does this message mean , does it indicates the failure of initializing the modem , i use ZTE MF190 , but its driver is customized to Mobinil ( the network service provider) , Thanks ๐
โOSCOKIRQ failed to assertโ means MAX3421E initialization has failed, most likely because SPI is wired incorrectly but can also be caused by faulty component.
http://www.sparkfun.com/products/9628 , this is the type of shield i use . Could it be the problem Oleg ?? it states that “the shield connects the Arduino’s hardware SPI pins (D10-13) to the MAX3421E” , thanks ๐
i don’t support this shield.
So this is the only shield ypu support oleg http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino/ ? thanks ๐
So this is the only shield ypu support oleg http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino/ ?
This, and other circuits that I design and manufacture.
Hi,
I recieved my Modem today and I inserted in to the Arduino via the USB host shield. I am getting the below mentioned in the Serial monitor of Arduino
Start
PL Init
Addr:1
NC:1
Conf:1
PL configured
ATAT
The ATAT in the end is the two times i entered AT command and it returned the same value in the monitor. Can you provide me with any help what might be the problem. Should I used putty or it is do with something else. Moreover I have tried to use the modem with and without the SIM card but the same thing happens on the serial monitor.
Waiting for your expert opinion
BR,
Vik
What you see is called “an echo”. Type ‘ate0’ to turn it off in the modem. If you keep seeing after that, find out how to turn it off in your terminal program.
Thanks for your help. I tried to use it with putty and now its working really fine. I have not till put in the sim but the AT command returns an OK and I have also had a non zero IMEI as well.
I hope I can activate GPRS successfully as well. Have u worked on using PPP for posting data on the internet ?
Hi,
Do you have the AT Command manual for the BenQ M32 Modem ?
BR,
Muhammad
The link to the BenQ manual is in the article.