Week 15: Networks and communications

This week, I take part to a summer school devoted to Networked Sensors . I'll give a talk about FabLabs, and their role in spreading sensors networks worldwide, for participative science and for Smart Cities. But before the talks, two days are devoted to tutorials. It is a good way to learn new protocols.

Tutorial by Prof. Congdug Pham, Université de Pau

Two major technologies allow long range-low energy consumption: LoRa and SigFox. In the context of developping countries, LoRa is preferred (no subscription, self-deployable gateways etc.). The LoRa module used in the tutorial is a
Modtronix InAir9, connected to an Arduino UNO through SPI. Arduino programs are downloaded from Congduc Pham Github repository. Additional libraries are downloaded from here

Use of the Arduino_LoRa_Gateway sketch

The Arduino_LoRa_Gateway sketch is compiled and flashed, after uncommenting the line: #define IS_SEND_GATEWAY The Arduino then serves as a gateway between the PC/Mac it is connected to and the LoRa module. Select the baud rate in serial monitor: 38400 baud (consistent with the code flashed Serial.begin(38400);) The serial monitor is used as a console to talk to the module. A gateway is configured with a Rasperry Pi, and receives the messages from all the participants.

Use of the Arduino_LoRa_Simple_temp sketch

The node_addr is defining the identification of the emitting node. It is an integer. 1 is reserved for the Gateway itself. The Gateway displays the packets informations: dst, type, src, seq, len, SNR, RSSIpkt etc. The node_addr is src.

Use with ThingSpeak

After creating an account, after creating a "channel", the API tab allows to find out a "Write API key". The key (e.g. N34Y5DK90JMFLJF3) is to be inserted in the Arduino sketch, line 343:
#ifdef FLOAT_TEMP
ftoa(float_str,temp,2);
#ifdef NEW_DATA_FIELD
// r_size=sprintf((char*)message+app_key_offset, "\\!#%d#TC/%s", field_index, float_str);
r_size=sprintf((char*)message+app_key_offset, "\\!N34Y5DK90JMFLJF3#%d#TC/%s", field_index, float_str);
#else
Field index can also be adjusted within the Arduino sketch (default value is 4). The measures obtained from the Arduino board are then recevied on the web interface. Nice.

Final thought

Following the tutorial is relatively easy. Participants were not especially prepared to this exercice, and most of them succeded, essentially thanks to mutual help.

However, the intrinsic difficulty is high, and any little glitch, in a library, in a sketch or in the server config can break the whole chain, and then most of the participants would clearly be unable to fix by themselves.

That is one advantage of using technologies spread through a network (of people): it increases the robustness to changes and evolutions, providing a wider support to non-techincal users. FabLabs appear crucial here.

Previous week
Back to index
Next week