Shopping Cart

Posts

Interfacing Arduino to USB GPRS modem

Cheap GPRS modem from Dealextreme

Cheap GPRS modem from Dealextreme


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.

No related posts.

197 comments to Interfacing Arduino to USB GPRS modem

  • Vik

    Hi,

    The link point towards the user guide. There is a separate manual for the AT commands. I have the access for manual for M22 M23 version but I am unable to found AT commands for M32.

  • Sherif Ahmed

    hey oleg i have purchased the shield , and i have soldered the pin headers which are 2*6 pin headers and 2*8 pin headers , put i didn’t solder the 1*6 pin header that is connected the ICSP , and it keeps on giving me start , OSCOKIRQ failed to assert :(

  • Sherif Ahmed

    Oreg it gets into infinite loop of Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    what does that mean ?? Is it the modem , i have purchased the dealxtreme modem you used , but i am waiting for the order to be processed , now i am using the ZTE MF190 , knowing that it uses software that is customized to our local service provider , thanx :)

    • Tim

      For what it’s worth, I’ve run into the same thing several times.

    • Tim

      Try unplugging and re-plugging in the modem, and if that doesn’t work, try a different USB port. I’ve got other issues going on, but that at least solved the stream of Ret: 0Ds.

    • P.P.Tsaknakis

      Dear Sherif Ahmed

      I have the same problem with infinite loop of Ret: 0D
      Ret: 0D

      Did you find any solution

      Thank you for your time
      P.P.Tsaknakis

  • Sherif Ahmed

    Hey oreg , i want to make some changes in your code so that i can send message automatically by the micro controller without the use of hyperterminal, so i read in the shield description that the digital pins are unused , so what i want to do is to declare one of the as an input , so as it comes high , it send a message with a certain content to a certain number ,i knew from your description to the project that these are the AT commands used:
    AT+CMGF=1
    “19725555555″
    > test from T-Mobile to google
    but i want to save into the micro controller memory , i tried to do it many times but you are using “uint8_t data= Serial.read();” in your code , and am not really familiar with “uint8_t” as i was always coding using micro-C , Thanks :)

  • Sherif Ahmed

    (Sorry i misspelled your name in the previous comment)
    Hey Oleg , i want to make some changes in your code so that i can send message automatically by the micro controller without the use of hyperterminal, so i read in the shield description that the digital pins are unused , so what i want to do is to declare one of the as an input , so as it comes high , it send a message with a certain content to a certain number ,i knew from your description to the project that these are the AT commands used:
    AT+CMGF=1
    “19725555555″
    > test from T-Mobile to google
    but i want to save into the micro controller memory , i tried to do it many times but you are using “uint8_t data= Serial.read();” in your code , and am not really familiar with “uint8_t” as i was always coding using micro-C , Thanks :D ,

  • Vik

    Hi,

    Do you know any 3G USB modems which are using this PL-2303 ?

    BR,
    Vik

  • Vik

    I have been trying to connect to GPRS but I keep getting the message of NO CARRRIER from the modem. You have mentioned some more programming for that thing. Can you give some headsup what sort of programming we need to do. and do u have any idea why this NO CARRIER message is coming from the modem

  • Constantin

    Hi Oleg,
    As a FYI, I think I am pretty close to getting GPRS to work with Jasper / Embeddedworks and the BenQ GPRS modem as the Arduino successfully connected to a FTP server in Taiwan and commands there were being executed also.

    As I refined the program further to allow a connection to Pachube, something weird happened. Even though all the setup code (i.e. anything before the loop()) is the same, when the code now tries to execute, the USB init () sequence at the beginning of the loop() no longer throws out the expected 144 (which seems to signal a running USB host controller) but rather returns a “32″ – whatever that means.

    Have you experienced this sort of issue before? I wonder if I am running out of SRAM memory as the Flash part of the program is only 16K. Your terminal program still works, so it does not appear to be a hardware failure of either the modem or the USB modem… Any help / insight would be appreciated. Cheers!

  • Constantin

    Hi Oleg,

    Allow me to be more specific, it is Usb.getUsbTaskState() that is not returning the expected 144 code, i.e.

    void loop() {
    Usb.Task();
    if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
    {
    //connect to GPRS Network, etc.
    }
    }

  • Vik

    @Constantin

    Can you elobarate what sort of stuff do we need to do in order to connect and use GPRS service via BenQ using the PL2303 library ?

    • Constantin

      You can see Oleg’s example up top re: turning a modem on, etc. to send SMS messages.

      The next step towards GPRS involves using the commands in the BenQ manual to set destinations, turn on GPRS, etc. I wrote a small function called Transmit that takes strings and sends them one byte at a time. Additionally, it waits on demand after writing a command for the modem to respond.

      Transmit(“at+cgatt=1\r\n”,500);
      //Turn on GPRS, wait 500ms Transmit(“at+cgdcont=1,\”ip\”,\”embeddedworks.globalm2m.net\”\r\n”,500);
      //register on network, wait 500ms
      Transmit(“at$gled=1,100,200\r\n”,500);
      //make yellow LED blink faster to show that the modem is receiving these commands
      Transmit(“at$destinfo=\”api.pachube.com\”,80,1\r\n”,1000);
      //set destination, wait for 1 second for the connection to be made
      Transmit(“atd*97#\r\n”,10000);
      //tell the modem to go to the destination, wait 10 seconds.

      During waits, the Arduino is continuously checking on the USB host to see if the modem is spitting anything back. I’m using millis() to establish the wait time, still have to address the rollover issue after 50 days of operation. HTH

      • Vik

        Hi,

        Thanks for the help. I have asked people about how to connect to internet and people say that I need to implement PPP protocol to connect to internet since I get the NO Carrier when i dial for a connection.

        I have seen new commands of at$gled and at$destinfo. the first one seems to work but the second one keeps me giving the error. Can you tell me what are you trying to do with these commands. And the number that you are using to dial is it the number for the service operator ? Have u been able to post something ?

        at$gled=1,100,200
        $GLED: 1

        OK

        ERROR
        at$destinfo=”api.pachube.com”,80,1
        EXT: I

        ERROR

      • khali

        Hi Constantin
        I have been trying to use the Benq M23 based USB GPRS Modem to connect with the GPRS network and send/receive packets. However, I have been unsuccessful so far. Could you please elaborate how this works for you? I tried to use commands in this fashion:
        AT+CGDCONT=1,”IP”, “xyz-apn-name”
        AT$DESTINFO=”122.52.17.122″,1,1300
        AT$NOSLEEP=1
        ATD*97#

        I get No Carrier! Any help from you or Oleg or anyone else would be really great!
        Cheers
        Khali

  • Tim

    Hey there Oleg,

    I purchased your USB shield, and I’d love to get my hands dirty on this project, but I’m having trouble getting off the ground. I downloaded the library and ran the pl2303_gprs_terminal.pde but it was saying it couldn’t find the includes, which I thought shouldn’t be an issue if the files were in the same folder as the PDE file, but eventually, I just specified the full system path….except for the avr/pgmspace.h, which seems to work just fine without specifying the full path.

    Anyway, now I’m getting the following error:

    avrdud: ser_send(): wreite error: sorry no info avail

    Any ideas about what I’m running into here?

    • Your avrdude programming utility is acting up. Could be caused my many things, like no connection from PC to Arduino, wrong board selected in IDE, etc. Search the Arduino board -> http://arduino.cc/forum/index.php

      • Tim

        Lol, that was definitely my blond moment for the day. I was using COM6 instead of COM4…

        Now I’m getting the following:

        Start
        PL Init
        Addr:1
        NC:1
        Conf:1
        PL configured

        …but when I type in the at command, the at doesn’t show up in the serial monitor and the unit doesn’t reply with OK.

        Do you think this might be related to the fact that I’m not specifying the full path to the avr/pgmspace.h file? I’m a little unclear on where this file is located exactly.

        Any input you could provide would be greatly appreciated, and I certainly appreciate your time.

        In the meantime, have a good one.

        Cheers,
        Tim G.

        • Tim

          I should also mention that I’m using a SIM card from a company called Tru, which is a global GMS provider, and they specify that the SIM card needs to be used with unlocked GSM phones. Since there’s nothing propriety about the GPRS modem, I assumed it was ‘unlocked’, but I’m wondering now if this might be related.

          I also neglected to thank you for your help with my first minor issue, so thank you for that. I appreciate your input.

          • Tim

            I’m sorry, I guess I should also mention that I’ve tested this SIM card on an unlocked GSM phone, and it does function without any special setup.

        • Tim

          In case any one else is having this issue, what seems to have resolved it in my case was to turn the ‘Both NL & CR’ option in the serial monitor of the Arduino IDE.

          I’m still having issues getting it to behave properly when I try to send a text through the Arduino the same way I did through HyperTerminal without the Arduino, but that’s probably beside the point.

          • Vik

            Hi Tim,

            What actually is the response of the modem when you send an AT command ? Have you tried to use Putty to send commands ?

            BR
            Vik

          • Tim

            I finally got it working, actually. I believe what did the trick was using a different USB port and wiggling the cord in the socket a bit. I knew this was the case because after taking the Arduino out of the picture and accessing the modem directly through the computer, everything worked just fine, so then it only seemed likely that the commands just weren’t reaching the Arduino.

            Now I just need to work on interpreting the incoming texts so that I can build the rest of my logic.

            Thanks for asking.

            How are things going with your internet connection?

  • Vik

    I am trying to incorporate AT commands in the code rather than taking it from the Serial input. I have gone till the point of registering with the GPRS network but after that when I dial it gives me the error of NO CARRIER. I have researched about that a little bit and what seems to be the issue is the fact that there is no PPP implementation for the Arduino. Still trying to figure out how to do it.

  • Vik

    Hi,

    I have been using the PL2303 GPRS library for sending commands to the modem and receiving the replies via serial input and output. Now I want to send commands by just passing the AT commands in the code to the function and get the reply on the serial output. The code from the library is given below

    Code:
    uint8_t rcode;

    /* reading the keyboard */
    if(Serial.available()) {
    uint8_t data= Serial.read();

    /* sending to the phone */
    rcode = Pl.SndData(1, &data);

    In the command line uint8_t data= Serial.read(); I want to skip the serial read and pass the string value such as AT ot AT+CREG to the Pl.SndData function. Any idea how I can do that by using uint8_t because when i try char it gives me error because all the pointers and variables in the library have been defined as uint8_t

    BR,
    Vik

  • Vik

    I am trying to understand the code given in the link.

    Should sending letter one by one as in the below mentioned code work to sent AT and then enter

    uint8_t data={65} ;
    rcode = Pl.SndData(1, &data);
    uint8_t data={84} ;
    rcode = Pl.SndData(1, &data);
    uint8_t data={13} ;
    rcode = Pl.SndData(1, &data);

    BR,
    Vik

    Should i used decimal equivalent for the characters or hexadecimal equivalents ?

  • Vik

    Thanks Oleg.

    It works !

  • Vik

    Hi,

    I have been able to send the AT commands by using the above casting functionality. I have given below the modification to the code that I have done

    Usb.Task();

    if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
    {
    uint8_t rcode;

    if (c==4)
    {

    const char* recv = “at+creg?\r”;
    rcode = Pl.SndData( strlen( recv ), (uint8_t *)recv );
    delay(1000);

    }
    if (c==5)
    {

    const char* recv = “at\r”;
    rcode = Pl.SndData( strlen( recv ), (uint8_t *)recv );
    delay(1000);

    }
    if (c==6)
    {

    const char* recv = “at+cgatt=1\r”;
    rcode = Pl.SndData( strlen( recv ), (uint8_t *)recv );
    delay(1000);

    }
    /* reading the keyboard */
    if(Serial.available()) {
    uint8_t data= Serial.read();

    /* sending to the phone */
    rcode = Pl.SndData(1, &data);
    if (rcode)
    ErrorMessage(PSTR(“SndData”), rcode);
    }//if(Serial.available()…

    /* reading the converter */
    /* buffer size must be greater or equal to max.packet size */
    /* it it set to 64 (largest possible max.packet size) here, can be tuned down
    for particular endpoint */
    uint8_t buf[64];
    uint16_t rcvd = 64;
    rcode = Pl.RcvData(&rcvd, buf);
    if (rcode && rcode != hrNAK)
    ErrorMessage(PSTR(“Ret”), rcode);

    if( rcvd ) { //more than zero bytes received
    for(uint16_t i=0; i < rcvd; i++ ) {
    Serial.print((char)buf[i]); //printing on the screen
    }
    }//if( rcvd …
    }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING..
    c=c+1;
    }

    I have defined c=4 just before void setup(). However, instead of stopping the execution of the three AT commands, the program goes in to a loop and keeps sending the three AT commands. I have put the c=c+1; condition to avoid sending the command again and again but its not working. Do you have any idea about this ?

    Should I put an If condition before calling the USB task function ?

  • Vik

    I am trying to send the Control Z via the micro-controller to send the SMS. Should I pass ^Z as a string on should I pass the decimal value of 26 as uint8 ?

  • Vik

    I have done it succesfuly by passing 26 in the original uint8_t variable. Do you have any plans for the PPP implementation for connection with the GPRS ?

  • Vik

    Hi,

    I have checked your work on USB Disconnect. I am thinking of using it with Modem. Do you think it would work Ok if I used it with the Modem ?

  • Sherif Ahmed

    Hey Oleg,
    Start
    PL Init
    getDevDescr:D
    This is what the serial sent me after connecting it to the arduino , i used your USB host shield and the modem you got from dealXtreme , so what does mean ?
    Thanks :)

  • Sherif Ahmed

    I use USB power , but i have tried also an external 5V up to 2.5 amps power supply
    and it doesn’t solve the problem.

  • Arizona

    Hello
    I’m new in using arduino. I bought the following form:
    https://www.circuitsathome.com/mcu/interfacing-arduino-to-usb-gprs-modem
    I have the Arduino UNO and I don´t know what code I need in order to receive sms. All I want for now is to be able to receive a text message, such as OK and store that data in a variable.
    I have seen so many examples but I still haven´t found what I´m looking for.
    please help
    Thanks

  • Arizona

    I really don´t understand this article becouse I don´t want to send sms, I only want to receive a message and then save it in a variable. That´s why I´m asking for help.

  • Arizona

    I really need to do this small project and I don´t know a lot about electronic devices, that´s the reason why I ask everything about it.
    So if you could help me I´ll really appreciate.
    Thanks

  • Arizona

    Where is the library for the USB host shield 2.0?

  • Arizona

    Because there is a lot of libraries but I don´t know which one is the one.
    What protocol uses USB HOST SHIELD 2.0
    Thanks

  • DezWeb52

    Hello,
    I’ve been trying to debug through the source code for hooking up a Huawei E220 modem (popular in the UK). Once I got it up and working I was getting the dredded Ret: 0D error, however I found this to be caused by the lines below in cdcprolific.cpp:

    if (((USB_DEVICE_DESCRIPTOR*)buf)->idVendor != PL_VID && ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct != PL_PID ) {
    return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;

    Once I updated the PL_VID and PL_PID in the cdcprolific.h I stopped getting Ret: 0D. Not sure why it looped this way, but this is how I certainly got it to stop doing this.

    However, now I have a slight issue with progressing further on in the code. I’ve debugged further and I find that the variable bNumEP is not getting set to anything higher than 1. Therefore I’m getting back USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED in line 151 in cdcprolific.cpp.

    My question is, where do I update the configuration so that I can get my modem accepted? Or am I missing something simple with regards to getting the code to work?

    Any and all help will be much appreciated !

  • DezWeb52

    Hi,
    I ran your USB descriptor example and got this. I hope it helps? If not let me know and I’ll dig further!

    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: 12D1
    Product ID: 1003
    Revision ID: 0000
    Mfg.string index: 01
    Prod.string index: 02
    Serial number index: 00
    Number of conf.: 01

    Configuration descriptor:
    Total length: 0020
    Num.intf: 01
    Conf.value: 01
    Conf.string: 00
    Attr.: A0
    Max.pwr: FA

    Interface descriptor:
    Intf.number: 00
    Alt.: 00
    Endpoints: 02
    Intf. Class: 08
    Intf. Subclass: 06
    Intf. Protocol: 50
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 83
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 00

    Endpoint descriptor:
    Endpoint address: 04
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 00

    Addr:1(0.0.1)

    • This is mass storage device. Why are you trying to make Prolific driver work with this? There is (incomplete) mass storage driver in the code – you can get Init() from there and modify it to your needs.

  • DezWeb52

    Ah. The Huawei E220 modem does have a mass storage on it to install the networks software and drivers. By the looks of things, it switches into the mode when plugged into a USB port. It may be a case of working out if the driver changes it from mass storage to modem after the software has been installed, or if the device needs something sent to it to change the state.

  • DezWeb52

    That was the issue I was having. I installed the software to a PC to allow the modem to be set up, telnet’d over to the com port that was configured and sent the command: AT^U2DIAG=0 down to the device (NOTE: this is only for the E220 modem – your favorite search engine should help find commands for others that have similar functionality), this stops the device being a mass storage device on power up and seems to keep it set even after power down.

    Device seems to be talking properly over the USB host board but seems to keep passing back status messages every so often. Not a problem but “^BOOT” and “^RSSI” keep coming back I think this is for the software installed on a PC? But I’m guessing I can use RSSI to see if the signal is OK.

    Thanks for the code Oleg!

    • Kareem

      I have Huawei E220 & I have turned off the mass storage mode by using the command AT^U2DIAG=0

      But still got on infinite loop of Ret: 0D
      Ret: 0D
      Ret: 0D
      Ret: 0D
      Ret: 0D
      Ret: 0D
      and from ACM example I got just only
      Start
      ACM Init
      Addr:1
      NC:1

      Could you tell me what I’m missing :(

  • Sergei

    This USB GPRS Modem is no more available from Dealextreme, something else compatible can you recommend ? Thanks all. Sergei

  • Sammy

    Hello, great article.

    1- Is there any way to connect the USB GSM Module to Arduino without using the USB Shield to save costs?

    2- How much power does the GSM Module draw? I am wondering if I can power both using AA batteries?

    Thanks,

    • Dezweb52,

      Sorry, thing posted before I got a chance to type. Sergei. I used the Huawei E220, usually sold in the past by big mobile companies. You’d probably be able to pick them up in ebay quite cheaply now. As long as you turn off mass storage mode, it should work with the posted code.

      Sammy, I ain’t tried the GSM module with regards to current. Not sure how long it would last, but from my experience the arduino is quite power hungry anyway. It might run off of AA batteries, but I don’t think it would last that long. Someone may be able to put more info forward.

      With regards to not using a USB shield, this is required as the arduino board cant talk directly to a usb device. Unless you build your own usb shield…

  • Laxap

    Hi Oleg,

    First, thank you for all these great articles, libraries and sketches.

    Trying to connect the USB dongle (RF access point) of a TI eZ430 Chronos watch to the Arduino USB host shield, I thought it would be a good basis to take your acm_terminal.pde.

    On the PC, I can turn the RF access point by these 2 lines of Python:

    ser = serial.Serial("/dev/ttyACM0", 115200,timeout=1)
    ser.write(array.array('B', [0xFF, 0x07, 0x03]).tostring())

    On the Arduino, the usb host init seems correct, as seen on the console:

    Start
    ACM Init
    Addr:1
    NC:1
    Conf:1
    ACM configured

    Then, after modifying your sketch to send the {0×42, 0xFF, 0×07, 0×03} sequence, no error is reported, but it seems to have no effect on the access point.

    The dongle provides two interfaces:

    Device descriptor:
    Descriptor Length: 12
    Descriptor type: 01
    USB version: 0110
    Device class: 02
    Device Subclass: 00
    Device Protocol: 00
    Max.packet size: 20
    Vendor ID: 0451
    Product ID: 16A6
    Revision ID: 0009
    Mfg.string index: 01
    Prod.string index: 02
    Serial number index: 03
    Number of conf.: 01

    Configuration descriptor:
    Total length: 0043
    Num.intf: 02
    Conf.value: 01
    Conf.string: 00
    Attr.: 80
    Max.pwr: 19

    Interface descriptor:
    Intf.number: 00
    Alt.: 00
    Endpoints: 01
    Intf. Class: 02
    Intf. Subclass: 02
    Intf. Protocol: 01
    Intf.string: 00

    Unknown descriptor: ...
    Unknown descriptor: ...
    Unknown descriptor: ...
    Unknown descriptor: ...

    Endpoint descriptor:
    Endpoint address: 82
    Attr.: 03
    Max.pkt size: 0040
    Polling interval: 40

    Interface descriptor:
    Intf.number: 01
    Alt.: 00
    Endpoints: 02
    Intf. Class: 0A
    Intf. Subclass: 00
    Intf. Protocol: 00
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 84
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 01

    Endpoint descriptor:
    Endpoint address: 04
    Attr.: 02
    Max.pkt size: 0040
    Polling interval: 01

    How is the ACM support targetting the right interface and endpoints?

    Do you think that ACM is the right way to go for me?

    Thanks in advance for any help!

  • Jay Rabe

    Struggling & fumbling. Pretty illiterate about all this stuff.
    Using a SparkFun USB Host shield which does not have the 2×3 ICSP header. Jumpered (from Uno) ICSP-4 (MOSI) to D11 (on top of USB Host shield), ICSP-1 (MISO) to D12, & ICSP-3 (SCK) to D13. Also took earlier advice that USB power was insufficient, so powered Uno from AAA-battery pack.
    Could not figure out how to set IP address that Putty needed, so using serial mon at 115200. Seems to sort of work…
    Upon power/reset:
    Start
    PL Init
    Addr:1
    NC:1
    Conf:1
    PL configured
    I don’t get all the other endpoint descriptor stuff.
    Then every 5 seconds I get
    Ret:FF

    Sending at or anything else does nothing.

    Thanks for any help.

    P.S. I ordered the USB Host from CAH just so I don’t have to mess with jumpering ICSP.
    :-)

  • Kareem

    I have these list from USB Modems:
    ZTE MF180
    Huawei e303
    ZTE MF1805
    Huawei k3565
    Huawei K3770
    Huawei k3765

    I used them with the examples ACM and pl2303_gprs_terminal

    with PL2303 example
    I got infinite loop of Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    Ret: 0D
    and from ACM example I got just only
    Start
    ACM Init
    Addr:1
    NC:1

    I got from the USB descriptor example

    Intf. Class: 08
    Intf. Subclass: 06
    Intf. Protocol: 50

    which is mass storage device !!

    so I’ve made advanced search on the modems, I found that all of them have many subsystems on the same device like modem & flashmemory and CD
    I found there are some AT Commands which I can use them to control the mode of my USB Modem
    with Huawei k3765 I connect it to my pc and open Tera Term and sent an AT command AT^U2DIA=0 which run the USB device on the modem mode only

    then I run again ACM and pl2303_gprs_terminal after run the USB in only modem modem
    I got from pl2303_gprs_terminal again infinite loop of Ret: 0D
    and from ACM just only
    Start
    ACM Init
    Addr:1
    NC:1

    I got from the USB descriptor
    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: 0055
    Num.intf: 03
    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

    Addr:1(0.0.1)

    so kindly could you help me in this case

    Any and all help will be much appreciated !

  • Kareem

    After I’ve run my USB Stick in the Modem mode only
    I’ve run USB descriptor example

    and got
    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: 0016
    Revision ID: 0000
    Mfg.string index: 03
    Prod.string index: 02
    Serial number index: 00
    Number of conf.: 01

    Configuration descriptor:
    Total length: 0055
    Num.intf: 03
    Conf.value: 01
    Conf.string: 01
    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: 03
    Intf. Class: FF
    Intf. Subclass: FF
    Intf. Protocol: FF
    Intf.string: 00

    Endpoint descriptor:
    Endpoint address: 83
    Attr.: 03
    Max.pkt size: 0040
    Polling interval: 05

    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

    Addr:1(0.0.1)

    • Kareem

      Then I have modified the PL_VID & PL_PID in cdcprolific.h and run again pl2303_gprs_terminal

      Just got

      Start
      PL Init
      Addr:1
      NC:1
      Conf:1
      PL configured

      but when sending AT Commands I didn’t get any back OK response

      just got “^BOOT” and “^RSSI” keep coming back (I don’t know what’s it !!!)

      I have tried all of these USB Modems list:
      ZTE MF180
      Huawei E220
      Huawei E303
      Huawei k3565
      Huawei k3765
      Huawei K3770
      but now one of them didn’t work

      Also I’ve installed the USBlyzer on my PC to sniff the USB data and know about the endpoints

      URB Select Configuration succeeded
      Device Object USBPDO-8
      Driver Object usbhub

      URB Function URB_FUNCTION_SELECT_CONFIGURATION
      URB Status USBD_STATUS_SUCCESS

      Configuration 1

      Interface 0 / Alt 0 Vendor-Specific, 2 pipes
      Endpoint 81h 1 In, Bulk 512 bytes
      Endpoint 01h 1 Out, Bulk 512 bytes

      Interface 1 / Alt 0 Vendor-Specific, 2 pipes
      Endpoint 82h 2 In, Bulk 512 bytes
      Endpoint 02h 2 Out, Bulk 512 bytes

      Interface 2 / Alt 0 Vendor-Specific, 3 pipes
      Endpoint 83h 3 In, Interrupt 64 bytes
      Endpoint 84h 4 In, Bulk 512 bytes
      Endpoint 03h 3 Out, Bulk 512 bytes

      Kindly please could anyone just guide me to modify the ACM_terminal or pl2303_gprs_terminal or tech me how to write a driver to get my modem work.

      • Dezweb52

        Hi.
        It’s been a while since I have tried this. However I do remember having problems using the serial monitor in the programming software. It seemed to screw with the data being sent to the modem.

        Try using hyperterminal or putty to talk to it. I’ll give it a go at some point and see if I can remember any more.

  • Dezweb52

    I had a look at your screenshot on another forum and think what I have suggested will work. The inbuilt serial monitor does seem to screw up what is being passed to the modem.

    Give it a good. Good luck!

    • Kareem

      I understood from your reply that it’s working on putty or hyperterminal not the inbuilt serial monitor, am I right?

      Thanks for your time.

    • Kareem

      Dezweb52,
      Many thanks, it’s working now (Thanks GOD)but still having some problems
      like the “^BOOT” which keep going to show up and sometimes I didn’t got “PL configured”
      Just got
      “Start
      PL Init
      Addr:1
      NC:1″

      so in this case I can’t send any commands so I repeated RESET the modem till got it configured, I mean got “PL configured” so I can send AT Commands

      Screenshot for the result
      http://s6.postimage.org/7jnebgla9/E220.jpg

      Thanks again Dezweb52.

      Best Regards,
      Kareem

  • Dezweb52

    Hi.
    Glad you got it working! Not sure on why your modem doesn’t configure first time tho. Maybe double check the power going into the board or a code edit to check that it’s booted correctly? Although someone else here might of had the same problem and been able to fix it.

    With regards to the boot message. I still get that to. I just ignore it and things seem fine. I haven’t found a way yet to turn it off as yet. Doesn’t seem to stop my commands tho.

    Talking of commands. The modem doesn’t seem to like a lot if them. A little play to see which ones give you the right response might be in order.

    Have fun, good luck and remember to tell us what you are building!

  • Kareem

    I’ll try to solve these bugs.

    off course when I finished my project, I’ll tell you :)

    Thanks again my dear friend.

  • Greetings,
    can i make a video call using this grps modem and arduino if i had the essential components?
    or can i somehow use a chat program to communicate with arduino and my mobile using 3g instead of sending sms messages?

  • Jose

    The link to the “simple program” in Github does not work.

  • Jan

    Hi,

    I managed to get a usb gsm modem (not from DX, but banggood) with the same VID and PID, but i get no PL init etc, i get the start and the 3 lines 0000, 0010 and 0020:

    Start
    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 07058103000A010705020200400007058302004000

    Some times i can send AT commands, but the result can take a minut before showing in eg putty, but often i get no results after typing AT commands, i have also tried without simcard. So is my usb modem correct configured to work with arduino/hostshield?

    Regards Jan

Leave a Reply

  

  

  



You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">