Thomas RioFranck-upmc
Published

Connected Hive

Creation of an embedded system that allows monitoring a hive through a sigfox module connected to an IoT platform.

IntermediateFull instructions providedOver 2 days718
Connected Hive

Things used in this project

Hardware components

Nano 33 BLE Sense
Arduino Nano 33 BLE Sense
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×2
DS18B20 Temperature Sensor 1m
HARDWARIO DS18B20 Temperature Sensor 1m
×2
Photo resistor
Photo resistor
×1
TPL5110 nano-power system timer
Texas Instruments TPL5110 nano-power system timer
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
Male-Header 5 Position- 1 Row- Long (0.1")
Male-Header 5 Position- 1 Row- Long (0.1")
×3
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1
Machine Screw, M3
Machine Screw, M3
×8
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×5
Carte BreakOut Sigfox BRKWSO1
×1
SparkFun Load Cell Amplifier - HX711
SparkFun Load Cell Amplifier - HX711
×1
Bosch Single point load cell H40A
×1
Solar cell SOL2W
×1
Seeed Studio Lider Pro Card
×1
Through Hole Resistor, 33 kohm
Through Hole Resistor, 33 kohm
×1
Through Hole Resistor, 56 kohm
Through Hole Resistor, 56 kohm
×1
Through Hole Resistor, 100 kohm
Through Hole Resistor, 100 kohm
×1
Through Hole Resistor, 330 kohm
Through Hole Resistor, 330 kohm
×1
Ceramic Disc Capacitor, 470 pF
Ceramic Disc Capacitor, 470 pF
×1
Capacitor 2.2 µF
Capacitor 2.2 µF
×1
Voltage regulator 5V to 3.3V
×1
1-pin MTE Cable (5-pack)
Digilent 1-pin MTE Cable (5-pack)
×3
Test Cable Assembly, Alligator Terminated Test Lead Set
Test Cable Assembly, Alligator Terminated Test Lead Set
×1

Software apps and online services

Arduino IDE
Arduino IDE
powerful IDE which concentrate the whole functionalities we've needed to develop the system
beep
Ubidots
Ubidots
Microsoft Azure
Microsoft Azure
Sigfox
Sigfox

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Drill, Screwdriver
Drill, Screwdriver
Laser cutter (generic)
Laser cutter (generic)
3D Printer (generic)
3D Printer (generic)
Cable Cutter, 12.7mm
Cable Cutter, 12.7mm

Story

Read more

Custom parts and enclosures

socle

dht22-enclosure

Schematics

gerber files

link it to your typon machine to print the pcb for the arduino

shecmatic

pcb top view

Code

BumbleBeez main code

C/C++
This code is implemented for the Arduino nano 33 BLE Sense. It has been created on the Arduino 1.8.16 IDE.
#define MAXIMWIRE_EXTERNAL_PULLUP
#define PIN_BUS 5

#include "DHT.h"
#include "HX711.h"
#include <Arduino_APDS9960.h>
#include <MaximWire.h>

// Humidity Sensors
DHT dht_ext(D4, DHT22);
DHT dht_int(D3, DHT22);


// Temperature Sensors
MaximWire::Bus bus(PIN_BUS);
MaximWire::DS18B20 device("2892486F09000092");  
MaximWire::DS18B20 device1("28CBE96E0900005B"); 

// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = D7;
const int LOADCELL_SCK_PIN = D9;
HX711 scale;


void setup() {
  pinMode(A7,OUTPUT);
  digitalWrite(A7,LOW);
  Serial1.begin(9600);
  delay(3000);
  digitalWrite(LED_PWR, LOW);               // turn off power LED
  digitalWrite(LED_BUILTIN,LOW);
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW); // turn off IC pullup
  
    
  /* Humidity sensors's initialization*/
  dht_ext.begin();
  dht_int.begin();
  
  /* Scale initialization */
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  scale.set_scale(28983.1604f);
  scale.set_offset(126846.686f);

  /* Proximity sensor */
  APDS.begin();
  
}

/* Read the battery statement */
int ReadBat(){
  int sensorPin = A0;   
  int sensorValue=0;
  float Vin,Vbat;
  int PourcentageBat;
  sensorValue = analogRead(sensorPin);
  Vin=(float(sensorValue)/1024)*3.3;
  Vbat=Vin*1.303241442;
  PourcentageBat=int(float((Vbat-3.3)/0.715)*100.0);
  if (PourcentageBat>100){PourcentageBat=100;}
  if (PourcentageBat<0){PourcentageBat=0;}

  return PourcentageBat;
}

/* Read the exterior luminosity */
int ReadLum(){
  int sensorLum = A5;   
  int ValueLum=0;
  float Luminosite;
  
  ValueLum = analogRead(sensorLum);
  Luminosite=(float(ValueLum)/1024)*3.3;
  return Luminosite*1000;
}


void loop() {  
  /* Variable initialization */
  int temperature_ext,temperature_int1,temperature_int2,temperature_int3;
  int humidite_ext,humidite_int1;
  int poids,batterie,rien,proximity;
  int payload[3];
  char buffer[100];
  int alerte=0;

  /* Temperature bus update */
  device.Update(bus);
  device1.Update(bus);

  delay(1000);
  
  
 /* measurement of all sensors */
 
  float hum_ext = dht_ext.readHumidity();                // External humidity
  float hum_int_1 = dht_int.readHumidity();              // Internal humidity
  
  float temp_ext = dht_ext.readTemperature();            // Outside temperature (DHT22)
  float temp_int_1 = dht_int.readTemperature();          // Internal temperature 1 (DHT22)
  float temp_int_2 = device.GetTemperature<float>(bus);  // Internal temperature 2 (DS18B20)
  float temp_int_3 = device1.GetTemperature<float>(bus); // Internal temperature 3 (DS18B20)
  float poids_tot = scale.get_units(5);                  // Scale
  float bat_conv = ReadBat()/1.5625;                     // Battery state
  int luminosite = ReadLum();                            // Luminosity
  
  proximity = APDS.readProximity();                      // Proximity
  delay(3000);
  scale.power_down();
  
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);             // We turn off all the 3.3 ports of the arduino board
  
  /* We format the measured data to send them with a good accuracy. */
  temperature_ext=round((temp_ext+20)*10);
  temperature_int1=round((temp_int_1+10)*10);
  temperature_int2=round((temp_int_2+10)*10);
  temperature_int3=round((temp_int_3+10)*10);
  
  humidite_ext=round(hum_ext/1.5625)-1;
  humidite_int1=round(hum_int_1/1.5625)-1;
  
  poids = round(poids_tot*10);
  batterie = (round(bat_conv)-1);
  
  if(proximity > 200){
  alerte = 1;
  }
  
  if(poids_tot<20){
  alerte = 5;
  }
  
  rien = 15;
  
  /* Creation of the payload */
  payload[0]=(temperature_ext << 22) | (temperature_int1 << 13) | (temperature_int2 << 4) | (temperature_int3 >> 5);
  payload[1]=(temperature_int3 << 27) | (poids << 17) | (batterie << 11) | (luminosite >> 9);
  payload[2]=(luminosite << 23) | (rien << 15) | (alerte << 12) | (humidite_ext << 6) | (humidite_int1);
  
  sprintf(buffer,"AT$SF=%08x%08x%08x\r\n",(int)payload[0],(int)payload[1],(int)payload[2]);
  Serial1.write(buffer);
  
  /* We wait until the Sigfox frame is completely sent before putting the module in sleep mode */
  delay(11000);
  while(1){
    digitalWrite(A7,HIGH);
    delay(10);
    digitalWrite(A7,LOW);
    delay(10);
  }

}

DS18B20 identification

C/C++
This code is an exemple from the MaximWire library which allows to discover the identity code of a DS18B20 sensor.
// multiple devices OR single parasite powered device requires external pull up of 1.7~2.2 kOm

#define MAXIMWIRE_EXTERNAL_PULLUP

#include <MaximWire.h>

#define PIN_BUS 5

MaximWire::Bus bus(PIN_BUS);
MaximWire::DS18B20 device;

void setup() {
    Serial.begin(9600);
}

void loop() {
    MaximWire::Discovery discovery = bus.Discover();
    do {
        MaximWire::Address address;
        if (discovery.FindNextDevice(address)) {
            Serial.print("FOUND: ");
            Serial.print(address.ToString());
            if (address.IsValid()) {
                Serial.print(" (VALID)");
            } else {
                Serial.print(" (INVALID)");
            }
            if (address.GetModelCode() == MaximWire::DS18B20::MODEL_CODE) {
                Serial.print(" (DS18B20)");
                MaximWire::DS18B20 device(address);
                if (device.IsParasitePowered(bus)) {
                    Serial.print(" (PARASITE POWER)");
                }
                float temp = device.GetTemperature<float>(bus);
                Serial.print(" temp=");
                Serial.print(temp);
                Serial.println();
                device.Update(bus);
            } else {
                Serial.println();
            }
        } else {
            Serial.println("NOTHING FOUND");
        }
    } while (discovery.HaveMore());
    delay(1000);
}

README.md

Markdown
# Ruche_connect_RRLL
Project of embedded systems with sigfox module to scan different parameters like weight, temperature etc.

### Table of content
1. [Starting Point](#starting-point)
2. [Prerequisites](#Prerequisites)
3. [Installation](#installation)
4. [Made with](#made-with)
5. [Versions](#versions)
6. [Authors](#authors)
7. [License](#license)

## Starting Point

Our system works with an Arduino NANO BLE 33 Sense board, which is connected to
an LPWAN transmitter from sigfox which allows a wireless transmission at low energy cost.

![Image text](https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse2.mm.bing.net%2Fth%3Fid%3DOIP.sGXy-NlOStrLy6MeyubsAAHaEK%26pid%3DApi&f=1)

## Prerequisites

This system allows an online visualization in 'real time' (a weave sent every 10min)
on different platforms (for the moment Ubidots Stems _https://ubidots.com/stem/_ and in the future on Beep _https://beep.nl_) 
with Microsoft's Azur service as an intermediary

## Installation

No installation required, 
to load a new code on the arduino board, you have to unscrew the box, connect the board to the software.
To see the live activity you'll have to enter the password and show the dashboard.

## Made with

* [Arduino Software (IDE)](https://www.arduino.cc/en/software/) - Text editor and arduino download

## Versions

**Latest stable version :** 1.1
**Latest version :** 1.1
List : 

## Authors

* **Thomas Rio** _alias_ [@thomasrPPS](https://github.com/thomasrPPS)
* **Bruce Rosier** _alias_ [@brosier01](https://github.com/brosier01)
* **Youssef Lakhdhar** _alias_ [@Youscoutt](https://github.com/Youscoutt)
* **Franck Laurent** _alias_ [@Franck-upmc](https://github.com/Franck-upmc)

## License
none

Credits

Thomas Rio
1 project • 0 followers
Contact
Franck-upmc
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.