SigFox

From air
Jump to navigation Jump to search
Sigfox Node
Sigfox Nodes: Akeru And Airboard boards


http://www.sigfox.com/fr/

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

API Device

Arduino

Akeru Snooplab + DHT
Sigfox Traces

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