SmartEverything SigFox GPS
Example code showing of to send any datatype - 12 bytes max - (in this example, a struct of GPS coordinate) to SigFox network with a SmartEverything prototyping board (http://www.smarteverything.it/).
- GPS frame decoding is made with TinyGPS library (https://github.com/mikalhart/TinyGPS).
- SigFox modem communication is done through direct AT commands. This code is minimalist : it doesn't manage downlink messages, and it's error management is sort of non existant.
Why don't I use official SmartEverything libraries ?
Note : you can find them here : https://github.com/ameltech/
- Amel Technology's GPS official library is sometimes unable to parse NMEA frames. It can read altitude, number of locked satellites, but sometimes lacks latitude and longitude.
- Amel Technology's SigFox official library can only send to SigFox network an array of char. If it's OK to send "Hello" messages, it's rather limited when you want to send any other datatype. Moreover, this library fails to send message smaller than three characters.
How is the data encoded ?
SigFox data frame is limited to 12 bytes max. The data we send to SigFox network is composed of
- latitude, float datatype, 4 bytes,
- longitude, float datatype, 4 bytes,
- altitude, integer datatype, 4 bytes (SmartEverything prototyping board uses an ARM Cortex M0, which is a 32 bits MCU).
All the bytes of these data are concatenated in the reverse order, into an hexadecimal encoded string. Example :
- float value : 1.5345 - bytes values : 37 71 45 66 - reversed bytes values : 66 45 71 37 - hexadecimal representation : 42 2D 47 25
As the byte order is reversed, the data is reversed too. In the struct, we have the following order : latitude, longitude, altitude. In the data frame sent to SigFox, we have the following order : altitude, longitude, latitude.
The following SigFox frame 000000923fc46152422d46e6 is
- 00000092 : hexadecimal value of altitude, in reverse order : 146 - 3fc46152 : hexadecimal value of longitude, in reverser order : 1.5342199802399 - 422d46e6 : hexadecimal value of latitude, in reverse order : 43.319236755371
##Decode the data on the Sigfox cloud
Edit your Device Type, and set the Display Type to
Then set the custom configuration to
alt::uint:32 lng::float:32 lat::float:32
The Sigfox cloud will automatically parse the received frames & display the associated alt, lat & lng.
What can I find in this repository ?
- sigfox_gps : the Arduino sketch + TinyGPS library.
- decode.php : example code to show how to decode sigfox data sent by the Arduino sketch.