3Gbee apn connect

I’m using the 3Geebee and the example SodaqMoja/Sodaq_3Gbee/examples/test_3Gbee.
It seems to be communicating with the modem OK but I can’t get it to connect to the apn. I have tried several variations on the apn (both Telstra and Aldi which is where the SIM is from). I didn’t have these problems with the 2G modems (SIM800 and 900) so I’m not sure if the problem is the library or a different setup needed for communicating with 3G networks. Here is the output

**Bootup**

[init] started.

[initBuffer]

>> AT

[rdResp]: timed

out

>> AT

[rdResp]: timed

out

>> AT

[rdResp]: timed

out

>> AT

[rdResp]: timed

out

>> AT

[rdResp]: timed

out

>> AT

[rdResp]: AT



[rdResp]: OK

>> AT E0

[rdResp]: AT E0



[rdResp]: OK

>>

AT+IPR=57600

[rdResp]: OK

Main: changing

baudrate to 57600

>> AT+CMEE=2

[rdResp]: OK

>>

AT+UDCONF=1,1

[rdResp]: OK

>>

AT+UGPIOC=16,2

[rdResp]: OK

>> AT+CPIN?

[rdResp]: +CPIN:

READY

[rdResp]: OK

>> AT+CSQ

[rdResp]: +CSQ:

99,99

[rdResp]: OK

>> AT+CSQ

[rdResp]: +CSQ:

99,99

[rdResp]: OK

>> AT+CSQ

[rdResp]: +CSQ:

99,99

[rdResp]: OK

>> AT+CSQ

[rdResp]: +UMWI:

0,1

>> AT+CSQ

[rdResp]: +UMWI:

0,2

>> AT+CSQ

[rdResp]: +UMWI:

0,3

>> AT+CSQ

[rdResp]: +UMWI:

0,4

>> AT+CSQ

[rdResp]: +CSQ:

99,99

[rdResp]: OK

>> AT+CSQ

[rdResp]: +CSQ:

18,1

[rdResp]: OK

>> AT+COPS?

[rdResp]: +CSQ:

19,1

>> AT+COPS=0

[rdResp]: OK

>> AT+COPS?

[rdResp]: +CSQ:

18,1

Modem failed to

connect to the apn!

OK



+CSQ: 20,1



OK



+CSQ: 19,0



OK



+COPS:

0,0,“Telstra Mobile”,2

OK



OK



+COPS:

0,0,“Telstra Mobile”,2

OK

Kees, Gabriel - any thoughts. Hope you aren’t too busy worrying about the EU!

I’ll try running the same sketch this evening.

One question, is there further output after these final lines?

no that is the end of the output.

I have had a response from someone on the telecoms forum here in Oz. He wants me to send individual AT commands so we can debug the network connection.
I have tried Serial1.println(“AT+CREG=2;+CREG?;+CREG=0”); but I don’t think this is going to the modem correctly. Instead of >> AT+CREG=2;+CREG?;+CREG=0 I am just getting >> AT. Any suggestions as to how to send the AT commands?

You should just send the commands one at a time eg: “AT+CREG?” with the required line ending.
The println() method will add the correct line ending for you.

There seems to be a bug in the enableAutoRegistration() method.

As a temporary fix, I suggest you comment out or remove lines 477-480 of Sodaq_3Gbee.cpp.

These lines:

477            else {
478                // Still no operator name. What can we do?
479                return false;
480            }

OK this worked - thanks

This fix is now also available at github. It should show up as an update in Arduino IDE as well.

One thing to notice is that the connect function has changed. It now has no parameters anymore. You must set the APN parameters (once) during setup. Something like this:

sodaq_3gbee.setApn(APN, APN_USER, APN_PASS);
if (sodaq_3gbee.connect()) { ...

I noticed with the version I have been using that when I set the serial output to serial2 instead of USB the modem would no longer connect to the network. I think this is a bug.

#define MySerial SerialUSB    >>   #define MySerial Serial2

Also can you explain the http get command to me. In the example it looks like this
size_t size = sodaq_3gbee.httpRequest(“httpbin.org”, 80, “/ip”, GET, httpBuffer, sizeof(httpBuffer));
and I’m not sure how to use the “/ip” (I think its the endpoint, but I’m not sure what this means)

thanks Andrew

OK the new library now works with serial2 so ignore the first part of the previous post

The first parameter is the HOST, the second parameter is the PORT and the third parameter labelled ENDPOINT is effectively the location on the HOST.

In this example the full URL is:

httpbin.org/ip

or

httpbin.org:80/ip

with the PORT included.

thanks

so for ThingSpeak it would be

sodaq_3gbee.httpRequest(“http://api.thingspeak.com”, 80, “/update?key=XXXXXXXXXXXX&field1=123”, GET, httpBuffer, sizeof(httpBuffer));

if I understand this right

Yeah that looks about right. I’m not sure if the “http://” prefix is required in the HOST field.

is there a way to turn this modem off and on during the program (ie when it wakes from sleep) without it having to go through the whole autoconfigure process?

You can switch on and off the device directly, and you also have control over connecting and disconnecting from the network. If you wish to use the network, and not just query the 3Gbee device, you will have to go through the connection procedure everytime the 3Gbee is powered up.

You will not have to go through the whole connection procedure for each action you take (e.g an. HTTP Post), providing you don’t make the call to disconnect until you are finished.

I am still having difficulty with the Sodaq_3Gbee library using serial2 instead of serialUSB. I think it is something to do with the httpget command and deleting the http_last_reponse_0 file - the program works with USB but not with serial2. Any help much appreciated.

Here’s the error when using serial2

Modem connected to the apn successfully.
>> AT+UHTTP=0
[rdResp]: OK
>> AT+UDELFILE="http_last_response_0"
[rdResp]: OK
>> AT+UHTTP=0,1,"api.thingspeak.com"
[rdResp]: OK
>> AT+UHTTPC=0,1,"/update?key=XXXXXXXXXXXXXXXXXXXX&field1=4229.81",""
[rdResp]: ABORTED
[rdResp]: OK
>> AT
[rdResp]: +UUHTTPCR: 0,1,0
HTTP Result for request type 1: 0
[rdResp]: OK
[ERROR]: An error occurred with the http request!

and here it is with the USB

Modem connected to the apn successfully.
>> AT+UHTTP=0
[rdResp]: OK
>> AT+UDELFILE="http_last_response_0"
[rdResp]: OK
>> AT+UHTTP=0,1,"api.thingspeak.com"
[rdResp]: OK
>> AT+UHTTPC=0,1,"/update?key=XXXXXXXXXXXXXX&field1=4225.06",""
[rdResp]: OK
>> AT
[rdResp]: OK
>> AT
[rdResp]: OK
>> AT
[rdResp]: OK
>> AT
[rdResp]: OK
>> AT
[rdResp]: OK
>> AT
[rdResp]: +UUHTTPCR: 0,1,1
HTTP Result for request type 1: 1
[rdResp]: OK
>> AT+ULSTFILE=2,"http_last_response_0"
[rdResp]: +ULSTFILE: 637
[rdResp]: OK
>> AT+URDFILE="http_last_response_0" 
[rdResp]: OK
HTTP/1.1 200 OK

I tried replicating your issue with an Autonomo sending output via Serial2, through an Mbili.

I was using the test_3Gbee sketch that comes with the library. Unfortunately, I was unable to replicate the issue.

Is the ABORTED response seen every time you run it with the debug output sent to Serial2?

Yes it is. All I am doing is changing
#define MySerial SerialUSB
to
#define MySerial Serial2
and it stops working!
When I change it back to SerialUSB it works again.

One further thing I have found is that the 3g modem ABORT does not occur with serial2 if verbose mode is off
(ie sodaq_3gbee.setDiag(MySerial); is commented out)

?does this mean something in the modem dialog requires sending to USB?