Subscribe via RSS
7Jun/180

Arduino – Don’t buy the SIM900A for Australia!

tl;dr = This is a 2G-only device. There's only one network left, which shuts down on the 30th of June, 2018!

...but I needed a connection for work and I bought this unit from a seller on eBay without researching... so... compounding the error, I then also bought a SIM card for the network that'll still work: Vodafone. Thanks to Happymacer on Instructables who posted an article discussing how to use this device in Oz!

Note that I'd previously tried to use both Optus and Telstra SIM cards and got the following output when running the COPS command.

AT+COPS=?
+COPS: (3,"VODAFONE","voda AU","50503"),,(0-4),(0-2)
OK

Yey! Vodafone! But I'm on Telstra/Optus? So I can see a Vodafone tower, but it's prepended with 3 which actually means I'm not allowed to use it. Sorta makes sense as Optus and Telstra switched off their 2G networks ages ago and Vodafone must have decided that lingering devices on other companies' plans aren't allowed to use their towers.

I bought a Vodafone SIM and ran the commands again...

AT+COPS=?
+COPS: (2,"VODAFONE","voda AU","50503"),,(0-4),(0-2)
OK

Woweee! It's there. 2 means Roaming... which is a little weird, but it must be trying to hint to my device that 2G isn't the best method and that there should be a 3G tower around somewhere. Of course, even if there was, we couldn't connect to it. So I forced the connection with the following command...

AT+COPS=1,2,"50503"
+CREG: 2
+CREG: 1
OK

Those CREGs afterwards were output because I had previously run AT+CREG=1. This command tells the device to report any changes to the carrier connection. What you can see is it connecting to the tower in roaming mode (aka 2) and then connecting correctly in local mode (aka 1.) We're on!

Testing SMS

If you wanna test an SMS, then you can do so pretty easily. Rig up a SoftwareSerial example in Arduino and make sure you can send commands to the SIM900A via the Serial Monitor. From here, you can use the following script to send an SMS.

AT+CMGF=1
OK
AT+CMGS="+61xxxxxxxxx"
>

Note above ... you'll get the > prompt to enter the message. Once you're done, the unit requires a CTRL-Z control character to realise it's the end of the message. To do this, you'll need to open your favourite text editor, type ALT+026 (hold down ALT and type 0 then 2 then 6) and then copy the resulting character. It will be a black SUB if you use Notepad++. Now paste this into the text entry field in the Serial Monitor and hit enter.

Sending Data

From here, Jens Christoffersen at All About Circuits has helped us greatly with his article: Using a SIM900A to Send Sensor Data to a Website. Scroll down far enough and you'll find his code to send data to a server. He uses printf statements, as he's using a PIC and talking direct to the serial port... we'll have to use SoftwareSerial and print(ln).

AT+CGATT=1
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"100.84.75.204"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="URL","http://www.website.com/index.php?data1=1&data2=4"
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,200,0
AT+HTTPTERM
OK

Above is an example chat with the unit to send data. Paste each AT line into the Serial Monitor first to make sure you get the expected responses. The URL above is rubbish, so put one in that'll work properly instead. The 200 in the HTTPACTION response is the happy HTTP code.

Filed under: Arduino Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


*

No trackbacks yet.