BlocNotes

Notepad of a tinker, maker, hacker or whatever you call it :)

Use Sigfox, Arduino (Akeru), PHP and callbacks

A friend of mine asked me for some help on an Akeru device, it is an Arduino + Sigfox modem.

After few tinkering we succeed to do what he wanted and share it : gather some sensors data and collect it in a PHP webpage.
The Arduino code is quite easy thanks to the Akeru library but Sigfox callback is a bit more tricky. The callback is parsed by a PHP script on my friend's server, but I also played a bit with it to able to use ioPush, my IoT logger/push notification server.

An extract of the C code we used:

// Structure declaration
struct myData {
  float   humidity;
  float   temp;
  float   pressure;
};

// Set data to be send
myData dataToSend = {humidity, temperature, pressure};
// Send them
Akeru.send(&dataToSend,sizeof(myData));

Then you can add a custom data configuration in Sigfox's callback page to let them parse it (in one line):

humidity::float:32:little-endian
temp::float:32:little-endian 
pressure::float:32:little-endian

Now select the page to be called with the required format:

http://serverAdress/page?id={device}&time={time}&humidity={customData#humidity}&temperature={customData#temperature}&pressure={customData#pressure}

Post requests can also be issued as explained in ioPush examples.