The hardware is trivial to set up, the shield and the Arduino board just stack together and the only concern is supplying the GPRS boad from an external supply rather than the Arduino just in case it draws too much current in certain situations. I used a USB phone charger and split the output to supply the Arduino board and the GPRS board separately. The GPRS board, which I think is based on the one from GPRS shield V1.0 from Seedstudio (link below) comes with a switch which allows you to choose where the power of the GPRS board comes from.

To monitor the state of the pump I took a free auxiliary contact of the relay that drives the pump and used it as a switch connected between the GND of the Arduino board and Pin 11 of the Arduino. This pin was configured as an Input with enabled pullup resistors. In a future iteration I may protect the Arduino by including a logic buffer and perhaps a level shifter to use higher voltage for longer wire runs but this will hopefully do the job now. I used a small perfboard to connect three wires to Pin 11, Pin 12 (an additional input may be useful in the future) and Ground.

The software side took more time than anything else. The Sim900 is well documented and there are a number of good sources of examples on how to use it (see link below). Basically, the module does all the hard job and you just need to use AT commands to give it high level instructions such as "tell me you are alive", "open a TCP connection to this address", etc. A good way to learn how this works is to use the Arduino board as a serial repeater and connect to the Sim900 from your computer using Telnet to enter the commands manually.

The tricky part is getting the software in the Arduino to be robust and reliable enough to handle all possible things that may go wrong when trying to establish a TCP connection using the GPRS module. For instance, at times the network reception may be bad or the online server may not ba available. This requires you to make a little state machine that follows a series of commands and checks the response of the Sim900 to figure out if things are going well or not. And in case they are not, restart the whole process. This can be done the right way, by properly handling all messages from the Sim900 or it can be done using simple ugly workarounds. I don't have to tell you what was my choice, do I?

The source code of the Arduino can be found in the Pastebin link below. Basically, the Arduino runs through a series of states where it checks for the inputs to change and then proceeds to open a TCP connection to an internet server to inform about the change.

For the server side, I first thought I would set up a minimalistic server using netcat on a computer somewhere, but then I heard about Carriots, which is a company that offers services to create "Internet of Things" -kind of applications. Once you set up a free account from them, you can set up "devices" you own and the Carriots server will wait for HTTP Post messages carrying an API key and the device identifier and will log the data you send in a database. How to shape the POST message is relatively simple and is well explained in the tutorial in the Carriots web (link below).

POST /streams HTTP/1.1
Accept: application/json
User-Agent: Arduino-Carriots
Content-Type: application/json
Connection: close

The data Carriots receives from your device can be accessed through the Carriots control panel (see Screenshot). You can also set up "listeners" which will wait for your device to post data and will process this data, for example, to forward it elsewhere in the interwebs. I decided to forward the data to a Google Sheets spreadsheet by making the listener do an HTTP Post (link to a tutorial below) to a Google form I created (see screenshot). This is perhaps not a "safe"...

Read more »