SigFox: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Image:SigfoxNode.jpg|200px|thumb|right|Sigfox Node]] |
|||
[[Image:sigfox_snooplab.jpg|200px|thumb|right|Sigfox Nodes: Akeru And Airboard boards]] |
|||
http://www.sigfox.com/fr/ |
http://www.sigfox.com/fr/ |
||
Line 4: | Line 8: | ||
Les applications sont la télérelève, suivi logistique, ... |
Les applications sont la télérelève, suivi logistique, ... |
||
Plus sur [[EA2014 IoT Communication]] |
|||
=Platines de développement= |
|||
* [http://snootlab.com/shields-snootlab/829-akeru-beta-33-fr.html Snooplab Areku] : board compatible Arduino intégrant un modem Sigfox Telecom Design. |
|||
* [http://www.theairboard.cc/ Airboard] |
|||
=API Device= |
|||
==[[Arduino]]== |
|||
[[Image:sigfox_snooplab+dht.jpg|200px|thumb|right|Akeru Snooplab + DHT]] |
|||
[[Image:sigfox_trace.png|200px|thumb|right|Sigfox Traces]] |
|||
Avec un capteur [[DHT11/DHT21/DHT22 etc. Temperature & Humidity sensors]] (Température et Humidité) |
|||
<pre> |
|||
#include <SoftwareSerial.h> |
|||
#define RX_PIN 5 |
|||
#define TX_PIN 4 |
|||
#include "DHT.h" |
|||
#define DHTPIN 2 // what pin we're connected to |
|||
// Uncomment whatever type you're using! |
|||
#define DHTTYPE DHT11 // DHT 11 |
|||
//#define DHTTYPE DHT22 // DHT 22 (AM2302) |
|||
//#define DHTTYPE DHT21 // DHT 21 (AM2301) |
|||
// Connect pin 1 (on the left) of the sensor to +5V |
|||
// Connect pin 2 of the sensor to whatever your DHTPIN is |
|||
// Connect pin 4 (on the right) of the sensor to GROUND |
|||
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor |
|||
DHT dht(DHTPIN, DHTTYPE); |
|||
SoftwareSerial sigfox(RX_PIN,TX_PIN); |
|||
// Sigfox message size is 12 bytes max. |
|||
#define BUFFERSIZE 256 |
|||
char downlinkbuffer[BUFFERSIZE]; |
|||
// Send message every 11 minutes (max 140 messages per day) |
|||
#define PERIOD 660000 |
|||
void getDownlinkLine(char * buffer) |
|||
{ |
|||
uint8_t idx = 0; |
|||
char c; |
|||
do |
|||
{ |
|||
while (sigfox.available() == 0) ; // wait for a char this causes the blocking |
|||
c = sigfox.read(); |
|||
buffer[idx++] = c; |
|||
} |
|||
while (c != '\n' && c != '\r' && idx >= BUFFERSIZE); |
|||
buffer[idx] = 0; |
|||
} |
|||
void setup(){ |
|||
Serial.begin(9600); |
|||
sigfox.begin(9600); |
|||
dht.begin(); |
|||
} |
|||
void loop(){ |
|||
// Reading temperature or humidity takes about 250 milliseconds! |
|||
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) |
|||
float fh = dht.readHumidity(); |
|||
float ft = dht.readTemperature(); |
|||
// check if returns are valid, if they are NaN (not a number) then something went wrong! |
|||
if (isnan(ft) || isnan(fh)) { |
|||
Serial.println("Failed to read from DHT"); |
|||
} else { |
|||
Serial.print("Temperature: "); |
|||
Serial.print(ft); |
|||
Serial.println(" *C"); |
|||
Serial.print("Humidity: "); |
|||
Serial.print(fh); |
|||
Serial.println(" %\t"); |
|||
Serial.print("Send message\n"); |
|||
sigfox.write("AT$SF="); |
|||
sigfox.print((byte)ft, HEX); |
|||
sigfox.write(" "); |
|||
sigfox.print((byte)fh, HEX); |
|||
sigfox.write("\n"); |
|||
getDownlinkLine(downlinkbuffer); |
|||
Serial.print(downlinkbuffer); |
|||
Serial.print("\n"); |
|||
Serial.print("Wait "); |
|||
Serial.print(PERIOD/1000); |
|||
Serial.print(" second before next uplink\n"); |
|||
} |
|||
delay(PERIOD); |
|||
} |
|||
</pre> |
|||
=API Backend= |
|||
==[[Node.js]]== |
|||
TODO |
|||
* https://github.com/nicolsc/sigfox-callback-demo |
|||
* https://github.com/nicolsc?tab=repositories |
Latest revision as of 10:06, 21 November 2015
opérateur de communication (uplink seulement) longue distance (plusieurs kms) pour les objets connectés (ie basse consommation électrique).
Les applications sont la télérelève, suivi logistique, ...
Plus sur EA2014 IoT Communication
Platines de développement
- Snooplab Areku : board compatible Arduino intégrant un modem Sigfox Telecom Design.
- Airboard
API Device
Arduino
Avec un capteur DHT11/DHT21/DHT22 etc. Temperature & Humidity sensors (Température et Humidité)
#include <SoftwareSerial.h> #define RX_PIN 5 #define TX_PIN 4 #include "DHT.h" #define DHTPIN 2 // what pin we're connected to // Uncomment whatever type you're using! #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22 (AM2302) //#define DHTTYPE DHT21 // DHT 21 (AM2301) // Connect pin 1 (on the left) of the sensor to +5V // Connect pin 2 of the sensor to whatever your DHTPIN is // Connect pin 4 (on the right) of the sensor to GROUND // Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor DHT dht(DHTPIN, DHTTYPE); SoftwareSerial sigfox(RX_PIN,TX_PIN); // Sigfox message size is 12 bytes max. #define BUFFERSIZE 256 char downlinkbuffer[BUFFERSIZE]; // Send message every 11 minutes (max 140 messages per day) #define PERIOD 660000 void getDownlinkLine(char * buffer) { uint8_t idx = 0; char c; do { while (sigfox.available() == 0) ; // wait for a char this causes the blocking c = sigfox.read(); buffer[idx++] = c; } while (c != '\n' && c != '\r' && idx >= BUFFERSIZE); buffer[idx] = 0; } void setup(){ Serial.begin(9600); sigfox.begin(9600); dht.begin(); } void loop(){ // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float fh = dht.readHumidity(); float ft = dht.readTemperature(); // check if returns are valid, if they are NaN (not a number) then something went wrong! if (isnan(ft) || isnan(fh)) { Serial.println("Failed to read from DHT"); } else { Serial.print("Temperature: "); Serial.print(ft); Serial.println(" *C"); Serial.print("Humidity: "); Serial.print(fh); Serial.println(" %\t"); Serial.print("Send message\n"); sigfox.write("AT$SF="); sigfox.print((byte)ft, HEX); sigfox.write(" "); sigfox.print((byte)fh, HEX); sigfox.write("\n"); getDownlinkLine(downlinkbuffer); Serial.print(downlinkbuffer); Serial.print("\n"); Serial.print("Wait "); Serial.print(PERIOD/1000); Serial.print(" second before next uplink\n"); } delay(PERIOD); }
API Backend
Node.js
TODO