Using a Cellular/Mobile Phone Network to Send Data with Arduino/Embedded

Today I used an Arduino repro­gram­ma­ble elec­tron­ics board and a GSM/GPRS modem to send data to the Inter­net. This will be use­ful for the sen­sors I intend to build.

You can see a video of it oper­at­ing below. One win­dow shows the out­put from the ser­i­al inter­face as it makes a request to my web serv­er and out­puts the response, and the oth­er win­dow dis­plays the access logs on my web serv­er.

I used a soft­ware UART (par­al­lel and ser­i­al data con­vert­er), as using the Arduino’s built-in ser­i­al inter­face caused con­flicts. Learn­ing to use a soft­ware UART is going to be very use­ful for the next step in the project.

I did con­sid­er mak­ing a Cat Facts for Arduino, but I resist­ed the dis­trac­tion.

I didn’t have any issues with pow­er spikes caus­ing a reset (the GSM board uses a lot of pow­er) as this is a ver­sion 2 board with soft start cir­cuit­ry:

Soft Start Circuitry
Soft Start Cir­cuit­ry (Source)

I also used AT codes to send SMS text mes­sages. A full list of AT codes are avail­able here, and I used these:

Send a text

Set to human read­able text mode:
AT+CMGF=1

Set phone num­ber:
AT+CMGS=“447944581307”

Enter the mes­sage

Send hex 1A to escape mes­sage.

List texts

AT+CMGL

Read a text

AT+CMGR=<index> (index­es start at 1)

Delete a text

AT+CMGD=<index>

 

The only stum­bling point I had was when the GSM modem was set to a dif­fer­ent baud rate than my soft­ware ser­i­al inter­face. To change this, I sent the AT com­mand AT+IPR=9600 to recon­fig­ure the modem.

I learnt that AT com­mands are also used to send and receive via TCP/UDP. This made it much more straight­for­ward than some kind of low lev­el sys­tem I had imag­ined. All that is required from the Arduino is to send AT com­mands (e.g. AT+CIPSEND=) and lis­ten for incom­ing respons­es.

Explanation for non-techies:

I made an elec­tron­ic cir­cuit that can send infor­ma­tion to the Inter­net. This will be use­ful for mak­ing a sen­sor e.g. a tem­per­a­ture sen­sor for an office that is acces­si­ble on any computer/smartphone.