Pascoal Kiangangu
Published © GPL3+

Open Ruche

This project consists in creating a connected hive

BeginnerProtip14 days351
Open Ruche

Things used in this project

Hardware components

DHT22 Temperature Sensor
DHT22 Temperature Sensor
×2
DS18B20 Programmable Resolution 1-Wire Digital Thermometer
Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer
×3
SparkFun Load Cell Amplifier - HX711
SparkFun Load Cell Amplifier - HX711
×1
Battery, 3.7 V
Battery, 3.7 V
×1
Solar Panel, 2.5 W
Solar Panel, 2.5 W
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Arduino MKR Fox 1200
Arduino MKR Fox 1200
×1

Software apps and online services

Ubidots
Ubidots
Sigfox
Sigfox
altium
Arduino IDE
Arduino IDE
Beep

Hand tools and fabrication machines

Solder Wire, Lead Free
Solder Wire, Lead Free
Breadboard, 170 Pin
Breadboard, 170 Pin
Soldering iron (generic)
Soldering iron (generic)
Drill / Driver, Cordless
Drill / Driver, Cordless
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Plier, Long Nose
Plier, Long Nose

Story

Read more

Schematics

PCB

Code

Codes sources

C/C++
#include <SigFox.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <HX711.h>
#include <OneWire.h>
#include <ArduinoLowPower.h>

int DEBUG = 1; //0 pour debug et 1 pour autonomie

#define LEDPIN 6
//===================================================================================================================================================== POIDS SUR HX711
#define LOADCELL_DOUT_PIN  2 // pour le capteur de poids
#define LOADCELL_SCK_PIN  3 // pour le capteur de poids
HX711 scale;
float calibration_factor = 21067; // pour 16,6 kg -> 21067 and for ~93,5 kg -> 21387, on a actuellement une marge de 300g
float zero_factor = 199457; //Numeric value of 0 Kg
//===================================================================================================================================================== POIDS SUR HX711
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//===================================================================================================================================================== TEMP ET HUM SUR DHT22 Externe
#define DHTPINE 4     // Pin digital connecte au DHT sensor
#define DHTTYPE    DHT22     // DHT 22 (AM2302)
DHT dhtE(DHTPINE, DHTTYPE);
//===================================================================================================================================================== TEMP ET HUM SUR DHT22 Externe
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//===================================================================================================================================================== TEMP ET HUM SUR DHT22 Interne
#define DHTPINI 7     // Pin digital connecte au DHT sensor
DHT dhtI(DHTPINI, DHTTYPE);
//===================================================================================================================================================== TEMP ET HUM SUR DHT22 Interne
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//===================================================================================================================================================== TEMP INTERNE SUR DS18B20
/* Broche du bus 1-Wire */
const byte BROCHE_ONEWIRE = 5; 

OneWire ds(BROCHE_ONEWIRE);
/* Adresses des capteurs de température */
const byte SENSOR_ADDRESS_1[8] = {  0x28, 0x46, 0xC8, 0x31, 0xC, 0x0, 0x0, 0xB9 };
const byte SENSOR_ADDRESS_2[8] = { 0x28, 0x2C, 0xDE, 0x75, 0xD0, 0x1, 0x3C, 0xC0 };
const byte SENSOR_ADDRESS_3[8] = { 0x28, 0x75, 0x91, 0x16, 0xA8, 0x1, 0x3C, 0x2C };
//===================================================================================================================================================== TEMP INTERNE SUR DS18B20
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//===================================================================================================================================================== BATTERIE
int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
float val = 0;  // variable to store the value read
float resultat= 0; // le resultat en volt
float pourcentage=0; //la charge de la batterie en pourcentage
//===================================================================================================================================================== BATTERIE
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//===================================================================================================================================================== STRUCTURE DU MESSAGE
//Struct to send values to Sigfox __attribute__ ((packed)) sigfox_message 
typedef struct {
  int8_t pourcentage;    //1 o
  int8_t HumiditeEXT;    //1 o
  int8_t tempEXT;        //1 o
  int8_t HumiditeINT;    //1 o
  int16_t temperature1;  //2 o
  int16_t temperature2;  //2 o
  int16_t temperature3;  //2 o
  int16_t poids;         //2 o
} SigfoxMessage;

SigfoxMessage ValeursCapteurs;
//===================================================================================================================================================== STRUCTURE DU MESSAGE
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= TEMP INTERNE SUR DS18B20 DEBUT
/**
 * Fonction de lecture de la température via un capteur DS18B20.
 */
float getTemperature(const byte addr[]) {
  byte data[9];
  // data[] : Données lues depuis le scratchpad
  // addr[] : Adresse du module 1-Wire détecté
  
  /* Reset le bus 1-Wire et sélectionne le capteur */
  ds.reset();
  ds.select(addr);
  
  /* Lance une prise de mesure de température et attend la fin de la mesure */
  ds.write(0x44, 1);
  delay(800);
  
  /* Reset le bus 1-Wire, sélectionne le capteur et envoie une demande de lecture du scratchpad */
  ds.reset();
  ds.select(addr);
  ds.write(0xBE);
 
 /* Lecture du scratchpad */
  for (byte i = 0; i < 9; i++) {
    data[i] = ds.read();
  }
  /* Calcul de la température en degré Celsius */
  return (int16_t) ((data[1] << 8) | data[0]) * 0.0625; 
}
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*
void getTempExt() {
  ValeursCapteurs.tempEXT = SigFox.internalTemperature() * 10;
  if(DEBUG == 0){
  Serial.print(F("Temperature: "));
  Serial.print(ValeursCapteurs.tempEXT);
  Serial.println(F("°C"));
  }
}
*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
void getTempInterne(){
   
  /* Lit les températures des trois capteurs */
  ValeursCapteurs.temperature1 = (int16_t)(getTemperature(SENSOR_ADDRESS_1)*10);
  ValeursCapteurs.temperature2 = (int16_t)(getTemperature(SENSOR_ADDRESS_2)*10);
  ValeursCapteurs.temperature3 = (int16_t)(getTemperature(SENSOR_ADDRESS_3)*10);

  if(DEBUG == 0){
      /* Affiche les températures */
      Serial.print(F("\n------------------------------------\n"));
      Serial.print(F("Temperatures internes : \n"));
      Serial.print(F("Temperature du capteur 1 : "));
      Serial.print(ValeursCapteurs.temperature1);
      Serial.print(F("° C, "));
      Serial.print(F("\nTemperature du capteur 2 : "));
      Serial.print(ValeursCapteurs.temperature2);
      Serial.print(F("° C, "));
      Serial.print(F("\nTemperature du capteur 3 : "));
      Serial.print(ValeursCapteurs.temperature3);
      Serial.println("° C");
      Serial.print(F("------------------------------------\n"));
  }
}
//============================================================================================================================================================================================= TEMP INTERNE SUR DS18B20 FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/

//============================================================================================================================================================================================= TEMP ET HUM SUR DHT22 Externe DEBUT
void getCapteurDHTEXT() {
  ValeursCapteurs.tempEXT = dhtE.readTemperature(); // temperature degrees
  ValeursCapteurs.HumiditeEXT = dhtE.readHumidity(); //humidite percent
 

  if (isnan(ValeursCapteurs.tempEXT)) {
    if(DEBUG == 0){
      Serial.println(F("Error reading temperature!"));
      }
    }
      
  if (isnan(ValeursCapteurs.HumiditeEXT)) {
    if(DEBUG == 0){
      Serial.println(F("Error reading humidity!"));
      }
    }

  if(DEBUG == 0){
  Serial.print(F("tempEXT: "));
  Serial.print(ValeursCapteurs.tempEXT);
  Serial.println(F("°C"));
       
  Serial.print(F("HumiditeEXT: "));
  Serial.print(ValeursCapteurs.HumiditeEXT);
  Serial.println(F("%"));
  }
}
//============================================================================================================================================================================================= TEMP ET HUM SUR DHT22 Externe FIN
//============================================================================================================================================================================================= TEMP ET HUM SUR DHT22 Interne DEBUT
void getCapteurDHTINT() {
  ValeursCapteurs.HumiditeINT = dhtI.readHumidity(); //humidite percent
      
  if (isnan(ValeursCapteurs.HumiditeINT)) {
    if(DEBUG == 0){
      Serial.println(F("Error reading humidity!"));
      }
    }

  if(DEBUG == 0){
       
  Serial.print(F("HumiditeINT: "));
  Serial.print(ValeursCapteurs.HumiditeINT);
  Serial.println(F("%"));
  }
}
//============================================================================================================================================================================================= TEMP ET HUM SUR DHT22 FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= POIDS SUR HX711 DEBUT
void getPoids(){
    //Get weight

    scale.power_up();
    ValeursCapteurs.poids = (int16_t) (scale.get_units() * 10);
    scale.power_down();

    
    if(DEBUG == 0){
    Serial.print("Reading: ");
    Serial.print(ValeursCapteurs.poids, 1);
    Serial.print(" kg ");
    Serial.println();
    }
  }
//============================================================================================================================================================================================= POIDS SUR HX711 FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= BATTERIE DEBUT
void getBaterie(){
  analogReadResolution(10);
  val = analogRead(analogPin);  // read the input pin
  //map(value, fromLow, fromHigh, toLow, toHigh)
  if (val>0)
  {
  ValeursCapteurs.pourcentage = map(val,0,403,0,100);
  }
  else
  ValeursCapteurs.pourcentage=(int8_t)0;

  if(DEBUG == 0){
    Serial.println("val :"); 
    Serial.println(val); 
    Serial.println("Pourcentage batterie :");          // debug value
    Serial.println(ValeursCapteurs.pourcentage);
  }
}
//============================================================================================================================================================================================= BATTERIE FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= ENVOIE SIGFOX DEBUT
void envoi(){ //protocole pour envoyer un message à Sigfox
 SigFox.begin();
 SigFox.beginPacket();
 SigFox.write((uint8_t*)&ValeursCapteurs, sizeof(SigfoxMessage));
   if(DEBUG == 0){
     Serial.print("Status: ");
     Serial.println(SigFox.endPacket());
   }
   else{
      SigFox.endPacket();
   }
 SigFox.end();
}

void reboot() {
 NVIC_SystemReset();
 while (1);
}
//============================================================================================================================================================================================= ENVOIE SIGFOX FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= SETUP DEBUT
void setup() {
  if(DEBUG == 0){
      Serial.begin(9600);
  }

  pinMode(LEDPIN, OUTPUT);
  digitalWrite(LEDPIN, HIGH);
  delay(1000);
  digitalWrite(LEDPIN, LOW);
  delay(1000);
  dhtE.begin();
  dhtI.begin();
    if(DEBUG == 0){
         while (!Serial);
    }

   if (!SigFox.begin()) {
       if(DEBUG == 0){
           Serial.println("SigFox error, rebooting");
       }
   reboot();
   }
   delay(100); // Wait at least 30ms after first configuration
   // Enable debug prints and LED indication
   SigFox.debug();
  //Set weight sensor
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  scale.set_scale(calibration_factor);
  scale.set_offset(zero_factor);

  pinMode(analogPin, INPUT); //For the battery, configuration of ADC

   SigFox.status();
}
//============================================================================================================================================================================================= SETUP FIN
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
//============================================================================================================================================================================================= MAIN
void loop() {
  Serial.print(F("------------------------------------------------------------------------------------------------------------\n"));
  getBaterie();
  getCapteurDHTEXT();
  getCapteurDHTINT();
//  getTempExt();
  getTempInterne();
  getPoids();
  envoi();
  Serial.print(F("------------------------------------------------------------------------------------------------------------\n"));
  //delay(60000);
  LowPower.sleep(720000);
  //LowPower.deepSleep(720000);
  //LowPower.deepSleep(30000);
  }

Codes sources

Credits

Pascoal Kiangangu

Pascoal Kiangangu

1 project • 0 followers

Comments