Sending /Receiving AT commands to/from 3G Shield

Hi,

I have the Itead 3G 5216J board.

I’m using the arduino nano.

I’m trying to get the arduino to send “AT” commands to the 3G shield.

So far I’ve been trying to use the following code:

#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8); // RX, TX

void setup()
{
  GPRS.begin(115200);
  Serial.begin(115200);
}

void loop()
{
  while(GPRS.available()) 
    Serial.write(GPRS.read());

  while (Serial.available()) 
      GPRS.write(Serial.read());
}

I know it works to some degree because if I type the commands “AT+CHTTPSSTART” into the serial monitor, the led on the shield starts flashing fast which is the same response I get when using a terminal program to enter the same command.

I don’t get an ‘OK’ response from the 3G shield when using the arduino, but I do the an OK response when using a terminal program. This is my issue.
Eventually I want the arduino to tell the shield to get some data from the web (such as time) and then display it to the serial monitor. If I can’t get the “OK” response from the shield when using AT commands then I think there is little chance that it will display the GET request from the specified website.

Any help? I’ve been scouring the web for a few nights now after work.

Any help is much appreciated.
Thanks

In general, software serial ports cannot run at 115200. It is barely possible, but only when your sketch does nothing else. In your case, you are also sending and receiving from the Serial port. You must reduce the shield baud rate to 38400 or lower.

Another problem could be that SoftwareSerial cannot transmit and receive at the same time. While transmitting to the shield, all characters from the shield will be lost. And transmitting always takes precedence over receiving.

You should avoid SoftwareSerial, because it is very inefficient. It disables interrupts for long periods of time, when a character is sent or received. Disabling interrupts for 1ms is an eternity for a 16MHz Arduino. It can't do anything else but wait for the character to finish. It could have executed 10,000 instructions during that time.

Both AltSoftSerial and NeoSWSerial are much more efficient, and they can send and receive at the same time.

If you could connect it to pins 8 & 9, use AltSoftSerial instead. It can be used reliably up to 19200, and then increasingly less reliably up to 115200, depending on how many interrupts are being handled.

If you cannot move it to those pins, use my NeoSWSerial instead. It is almost as efficient as AltSoftSerial, but still much, much better than SoftwareSerial. It can use any two pins, but only at baud rates 9600, 19200 and 38400. It's available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries.

Cheers, /dev

Thanks for your help,

I found a post regarding changing the baud rate for this shield, and have now changed it to 9600, unfortunately I still have the same issue.

If I type "AT" into the serial monitor and press enter, I see no response

If I type "AT+CHTTPSSTART" into ther serial monitor and press enter, I see no "OK" return from the shield, but I do see the led blinking fast again.

If I type "AT+CHTTPSSTOP", the light stop blinking but still no "OK" response.

From what I can tell, the 3G Itead shield is receiving the AT commands. In terms of sending a response back the options seem to be either

  1. Itead 3G Shield not transmitting the response back to the arduino (the response is supposed to be "OK" or "ERROR").
  2. The arduino is not recieving the response from the 3G Itead shield - potential issue with softwareserial?

I've been trying every night after work for the last 5 nights, no luck.

I've tried a few different codes that people have put up online, changed baud rates as per above, tried troubleshooting step by step with very simple code. I just can't seem to get a response using the arduino. I can still get a response using the Hyperterminal windows program.

Did you try replacing SoftwareSerial, like I suggested? NeoSWSerial is a drop-in replacement:

#include <NeoSWSerial.h>
NeoSWSerial GPRS(7, 8); // RX, TX

Everything else is the same.

AltSoftSerial is better, but you would have to move the shield to pins 8 & 9.

It seems like there might be an AT command for enabling/disabling the echo of what you send. Maybe there’s a setting for the responses.

If it works when you use HyperTerm (and a serial-to-USB converter?), and doesn’t work when connected to the Arduino, the wiring is wrong. Show us a drawing or pic.

Hi Dev, thanks for the response.

I’ve just tried the neoswserial. Just to make sure I have it correct, here is what I changed the code to:

#include <NeoSWSerial.h>


NeoSWSerial nss(7, 8);

void setup()
{
  nss.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  while(nss.available()) 
    Serial.write(nss.read());

  while (Serial.available()) 
      nss.write(Serial.read());
}

Ok, I tried to send a few commands, such as

AT
AT+CHTTPSSTART
AT+CHTTPSSTOP

I get no response on the serial monitor but I can see that the led is responding to the commands on the 3G shield, so it seems to behave the same as softwareserial so far.

Attached are some photos of the wiring.

I’ve got external 5v to power the shield
USB power to power the nano
common grounds between 3g sheild and nano are connected
I’ve got the Tx Jumper on pin 0 of the shield
I’ve got the Rx jumper on pin 1 of the shield

Pin 0 of the shield connected to pin 7 of the nano
Pin 1 of the shield connected to pin 8 of the nano

I've also have "Both NL & CR" selected in the serial monitor in the bottom right hand corner drop down list of the serial monitor.

I've tried: - different jumper positions - different cables - different arduino boards (I have a leonardo and have tried this)

I have not used the D0 and D1 pins on the arduino as I understand these don't work when using serial monitor?

From the manual for this sim5216 chip, it states the following

“Information responses start and end with , i.e. the format of information responses is
“”. Inside information responses, there may be one or more .
Throughout this document, only the responses are presented, and are intentionally omitted.”

Does this help with with my issue?

When you use HyperTerm and "it works", did you use a serial-to-USB converter instead of the Arduino?

Hi Dev,

The 3G shield has a mini USB port: 1. I plugged the mini USB to USB into my computer. 2. Found the com port in device manager 3. Configured the HyperTerminal settings for that com port.

I did a 'strange' experiment just now.

  1. I connected the arduino to the 3G shield using the digital pins and neoswserial to send commands
  2. I then connected the mini usb from the 3G shield to usb on computer
  3. Opened HyperTerm and configured settings for the relevant com port.
  4. Sent the CHTTPSSTART command with the arduino: 4i. The 3G shield lights blink in response 4ii. No "OK" appears on Arduino Serial Monitor 4iii. No "OK" appears on HyperTerm
  5. Sent the CHTTPSSTOP command with the HyperTerm: 5i. The 3G shield lights stop blinking in response 5ii. HyperTerm recieves "OK" 5iii. Arduino recieves no response (Nothing appears on serial monitor).

I'm starting to think the 3G shield isn't working correctly? There isn't a lot of info on the wiki page linked from the website I bought it from. The wiki page is here: https://www.itead.cc/wiki/ITEAD_3G_Shield

Images embedded for our convenience:

bc76626748f15927edb93ac0622391d1814bf32b.jpg

4682136f3e60ad35b4bc9c795dec47b9191ac853.jpg

Technique described here.

Does the shield respond to any other commands from the Arduino?

You might try enabling “echo” with “ATE1”. You should see every command you send.

You could request the current configuration with “AT&V”. This means the Serial monitor line ending should be “Carriage Return”.

If nothing ever comes back, I wonder if the shield TX pin is damaged. I don’t know how this pin is different from the USB data lines. Check the schematic or look at the shield to follow traces. If it is a different signal, that could explain why the USB TX works and the TX pin doesn’t.