Connects the CELLv1.0 to the Arduino without any additional wiring!
The ShieldAv1.0 is a shield or connecting board that connects the CELLv1.0 to the Arduino without any additional wiring. It also provides LEDs for the CELLv1.0 status lines.
In addition, breakouts are provided for the four additional SparqEE boards (ACCELv1.0, GPSv1.0, POWERv1.0, RELAYv1.0) if the user prefers to directly connect any of those boards to the shield.
Plug the CELLv1.0 into the Arduino Shield and the Arduino Shield into the Arduino Uno. USB cable to the Arduino and USB cable to the CELLv1.0 is required. The CELLv1.0 must also have an antenna attached and SIM card in order to communicate over the cellular network.
Test script output plus annotation:
SETUP COMPLETE! <Initial turn-on sequence complete> -------------------- Time: 7 LED Analog BLUE (3G): 644 OFF LED Analog RED (Unregistered): 159 ON <ON – before network connected, this is ok> LED Analog GREEN (2G): 471 OFF Module Wakeup AP: 1 - Awake Module Poweron: 1 - On Module Ready: 0 - Awake -------------------- ***** MODULE: ALL GOOD :) <Validation of module signals> ate1 at Response Check: FALSE <BAD: means CELLv1.0 response didn’t match> Response Check: FALSE <BAD: means CELLv1.0 response didn’t match> -------------------- Time: 20 LED Analog BLUE (3G): 102 ON <ON - 3G network joined (OFF is ok if 2G ON)> LED Analog RED (Unregistered): 481 OFF <OFF – not unregistered> LED Analog GREEN (2G): 513 OFF <OFF – not on 2G (OFF is ok if 3G ON)> Module Wakeup AP: 1 - Awake Module Poweron: 1 - On Module Ready: 0 – Awake <0 or 1 acceptable> -------------------- ***** MODULE: ALL GOOD :) ate1 at Response Check: TRUE <GOOD: means CELLv1.0 response does match> Response Check: TRUE <GOOD: means CELLv1.0 response does match>
Before Power-on:
The five yellow LEDs should all be lit.
Power-on, before network connected:
The RED LED should be lit.
Power-on, network connected:
The BLUE or GREEN LED should be lit (Blue is 3G, green is 2G).
Compile the code and it should work out of the box. Make sure to read the following note:
NOTE: You will need a TTL to RS232/USB converter in order to use this example.
A TTL to RS232/USB converter is a must-have for hardware engineers working with embedded systems. I have used both of these options, but my favorite are the first two as they take any voltage.
#include <avr/pgmspace.h> //save SRAM by putting strings in FLASH #include <SoftwareSerial.h> #include "shieldA_lib.h" #include "MemoryFree.h" //----------------------------------------------------------------------------- // GLOBALS -------------------------------------------------------------------- //----------------------------------------------------------------------------- unsigned long time; //program run time void debug2(String cmd, byte ret) { debug_print ( cmd, LEVEL_DEBUG, 1, 1 ); debug_printP( PSTR(" ---> CMD RET --->: "), LEVEL_DEBUG, 1, 0 ); debug_print ( String(ret), LEVEL_DEBUG, 0, 1); util_printBuffer(); } //----------------------------------------------------------------------------- // SETUP ---------------------------------------------------------------------- //----------------------------------------------------------------------------- void setup() { mySerial.begin(115200); mySerial.println(""); glob_debug = 5; //Override global debug print level cmd_setup(); //set-up shield GPIO cmd_power(); //power on cmd_connection(); //check cellular connection } //----------------------------------------------------------------------------- // LOOP ----------------------------------------------------------------------- //----------------------------------------------------------------------------- byte ret; void loop() { //DEBUG LOOP STATEMENT debug_printP( PSTR("--- LOOP ---"), LEVEL_DEBUG, 1, 1 ); util_time(); //DEBUG FREE MEMORY - (A VALUABLE RESOURCE!!!... which is why we're using PROGMEM) debug_printP( PSTR("FREE MEMORY()="), LEVEL_DEBUG, 1, 0 ); debug_print( String(freeMemory()), LEVEL_DEBUG, 0, 1 ); //----- //BASIC AT COMMANDS //Nickname //at command //Description util_time(); debug_print( "ECHO", LEVEL_DEBUG, 1, 1 ); ret = at_ate1(); //at_echoOn //Enable command echo debug2("ECHO", ret); util_clearBuffer(); util_time(); debug_print( "STATUS", LEVEL_DEBUG, 1, 1 ); ret = at_at(); //at_status //Quick status debug2("STATUS", ret); util_clearBuffer(); util_time(); debug_print( "REG", LEVEL_DEBUG, 1, 1 ); ret = at_creg(); //at_reg //Network registration status debug2("REG", ret); util_clearBuffer(); util_time(); debug_print( "NETS", LEVEL_DEBUG, 1, 1 ); ret = at_cops(); //at_nets //List available networks debug2("NETS", ret); util_clearBuffer(); util_time(); debug_print( "TECH", LEVEL_DEBUG, 1, 1 ); ret = at_cnti(); //at_tech //Current tech debug2("TECH", ret); util_clearBuffer(); util_time(); debug_print( "SIG", LEVEL_DEBUG, 1, 1 ); ret = at_csq(); //at_sig //Signal Quality debug2("SIG", ret); util_clearBuffer(); delay(60000); }
#include <avr/pgmspace.h> //save SRAM by putting strings in FLASH #include <SoftwareSerial.h> #include "shieldA_lib.h" #include "MemoryFree.h" //----------------------------------------------------------------------------- // GLOBALS -------------------------------------------------------------------- //----------------------------------------------------------------------------- unsigned long time; //program run time void debug2(String cmd, int ret) { debug_print ( cmd, LEVEL_DEBUG, 1, 1 ); debug_printP( PSTR("---> CMD RET --->: "), LEVEL_DEBUG, 1, 0 ); debug_print ( String(ret), LEVEL_DEBUG, 0, 1); util_printBuffer(); } //----------------------------------------------------------------------------- // SETUP ---------------------------------------------------------------------- //----------------------------------------------------------------------------- void setup() { mySerial.begin(115200); mySerial.println(""); glob_debug = 5; //Override global debug print level cmd_setup(); //set-up shield GPIO cmd_power(); //power on cmd_connection(); //check cellular connection } //----------------------------------------------------------------------------- // LOOP ----------------------------------------------------------------------- //----------------------------------------------------------------------------- int ret; void loop() { //DEBUG LOOP STATEMENT debug_printP( PSTR("--- LOOP ---"), LEVEL_DEBUG, 1, 1 ); util_time(); //DEBUG FREE MEMORY - (A VALUABLE RESOURCE!!!... which is why we're using PROGMEM) debug_printP( PSTR("FREE MEMORY()="), LEVEL_DEBUG, 1, 0 ); debug_print( String(freeMemory()), LEVEL_DEBUG, 0, 1 ); //----- //BASIC SMS util_time(); debug_print ( "SMS", LEVEL_DEBUG, 1, 1 ); ret = at_sms("+12223334444", "20140905 1:00am testing sms"); debug2 ("SMS", ret); util_clearBuffer(); delay(60000); }
For people using the SparqSIM
This option uses SMS-over-IP which essentially creates a TCP connection and used an SMS gateway to send the text to an endpoint. It functions just like a web query using the following for the message:
msg = "SABCDWXYZ+12223334444 Hello!\n\n" ret = at_zipwrite(msg); //at_webmsg
You’ll notice the line:
msg = "SABCDWXYZ+12223334444 Hello!\n\n"
The user is ABCD and the pass is WXYZ. You’ll have to use your credentials which are available under your SparqSIM account under “Services”->”Source Credentials”. That line will look something like the following for non ASCII characters:
msg = String("S" + 0x41 + 0x42 + 0x43 + 0x44 + 0x57 + 0x58 + 0x59 + 0x5a + "+12223334444 Hello!\n\n")
Where 0x41 = ‘A’ … 0x5a = ‘Z’
#include <avr/pgmspace.h> //save SRAM by putting strings in FLASH #include <SoftwareSerial.h> #include "shieldA_lib.h" #include "MemoryFree.h" //----------------------------------------------------------------------------- // GLOBALS -------------------------------------------------------------------- //----------------------------------------------------------------------------- unsigned long time; //program run time int ret; void debug2(String cmd, int ret) { debug_print( cmd, LEVEL_DEBUG, 1, 1 ); debug_printP( PSTR(" ---> CMD RET --->: "), LEVEL_DEBUG, 1, 0 ); debug_print ( String(ret), LEVEL_DEBUG, 0, 1); util_printBuffer(); } //----------------------------------------------------------------------------- // SETUP ---------------------------------------------------------------------- //----------------------------------------------------------------------------- void setup() { mySerial.begin(115200); mySerial.println(""); glob_debug = 5; //Override global debug print level cmd_setup(); //set-up shield GPIO cmd_power(); //power on cmd_connection(); //check cellular connection } //----------------------------------------------------------------------------- // LOOP ----------------------------------------------------------------------- //----------------------------------------------------------------------------- void loop() { //DEBUG LOOP STATEMENT debug_printP( PSTR("--- LOOP ---"), LEVEL_DEBUG, 1, 1 ); util_time(); //DEBUG FREE MEMORY - (A VALUABLE RESOURCE!!!... which is why we're using PROGMEM) debug_printP( PSTR("FREE MEMORY()="), LEVEL_DEBUG, 1, 0 ); debug_print( String(freeMemory()), LEVEL_DEBUG, 0, 1 ); //----- //BASIC WEB QUERY //Nickname //at command //Description ret = at_ate0(); // //diable echo to save space in buffer debug2 ("WEBOPEN", ret); util_clearBuffer(); util_time(); ret = at_zipcallOpen(); //at_webopen //start call - state 1 open debug2 ("WEBOPEN", ret); util_clearBuffer(); util_time(); ret = at_zipopen(1,0,"www.dbunplugged.com",9999); //at_websetup //socket id,type(UDP=1,TCP=0),hostname/IP,Port debug2 ("WEBSETUP", ret); util_clearBuffer(); util_time(); ret = at_zipsend(1); //at_websend //send data debug2 ("WEBSEND", ret); util_clearBuffer(); util_time(); String msg = "/put/<username>/<password>/testNum/1/testStr/TCP"; //String msg = "GET " + msgURL + " HTTP/1.1\r\nHost: www.dbunplugged.com\r\n\r\n"; //this string would be used for port 80, web request ret = at_zipwrite(msg); //at_webmsg debug2 ("WEBMSG", ret); //Parse the HTML response, removing the header and leaving the body //cmd_parseHtmlResponse(); util_clearBuffer(); util_time(); ret = at_zipcallClose(); //at_webclose //stop call - state 0 close debug2 ("WEBCLOSE", ret); util_clearBuffer(); delay(60000); }