Chuan Li
Published © LGPL

Don't Worry Bee Happy

Retrieves air moisture, temperature, detects the presence of the queen bee, and also gives the weight of the bee hive.

BeginnerFull instructions providedOver 8 days1,985
Don't Worry Bee Happy

Things used in this project

Hardware components

DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
STM32 Nucleo STM32 L432KC
×1
Sigfox Breakout TD1208R
×1
SparkFun Load Cell Amplifier - HX711
SparkFun Load Cell Amplifier - HX711
×1
Battery, 3.7 V
Battery, 3.7 V
×1
Solar Panel 2W
×1
Pololu
×1
Seeed Studio Seeed LiPo Rider Pro
×1
Seeed Studio Seeed Grove - Universal 4 pin connector
×1
SparkFun Female Header
×1
SparkFun Break away header - Straight
×1

Software apps and online services

Sigfox
Sigfox
arm MBED
Circuit Maker
CircuitMaker by Altium Circuit Maker
KiCad
KiCad
Ubidots
Ubidots

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
PCB Holder, Soldering Iron
PCB Holder, Soldering Iron
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)

Story

Read more

Custom parts and enclosures

Box of material

Error uploading file to Sketchfab.

Schematics

PCB card of source

Schematics about circuit of power support.

Document for print this card power support

We use LPKF ProtoMat S63 - PCB prototyping milling machine for printitng our card PCB.

Code

Main function

C/C++
Capteur of sound isn't completely finished in the programe.
#include "mbed.h"
#include "DHT.h"
#include "HX711.h"
/* Include arm_math.h mathematic functions */
#include "arm_math.h"
/* Include mbed-dsp libraries */
#include "arm_common_tables.h"
#include "arm_const_structs.h"
#include "math_helper.h"


/* FFT settings */
#define SAMPLES                 512             /* 256 real party and 256 imaginary parts */
#define FFT_SIZE                SAMPLES / 2     /* FFT size is always the same size as we have samples, so 256 in our case */
#define SEUIL                   0.6
#define TEMPS_ATTENTE_CAPTEURS  10 //mettre 10
#define TEMPS_ATTENTE_ENVOI_MSG_REINE  1

DigitalOut myled(LED1);
Serial pc(USBTX,USBRX); // Déclaration du port série USB
Serial device(D1,D0);
HX711 Balance(D5,D6);   // Déclaration de l'objet HX711
DHT sensor(A7,DHT22);   // Use the DHT22 sensor

Timer timerSon;
Timer timerCapteurs;
Timer timerEnvoiMsgReine;
bool msgReineEnvoye = false;
int reineEstPresente = 0;

/* Global variables */
float32_t Input[SAMPLES];
float32_t Output[FFT_SIZE];
bool      trig=0;

AnalogIn loudness(A6);
Ticker     timer;

/*Sensor variables*/
int err;


long valeurHx;
long valeurHxTare ;
double poids;

void sample(){
    trig=1;
}


void tacheCapteurs(void) {
    printf("\r\nDHT Test program");
    printf("\r\n*******Dont Worry Bee Happy***********\r\n");
    myled = 1;
         
    valeurHx = Balance.getValue(); // On récupère la valeur du module
    poids = ((double)valeurHx-(double)valeurHxTare)/11500;  // Conversion de la valeur de l'ADC en grammes
    poids = 1000*(poids/1.88);
         
    err = sensor.readData();
    printf("Temperature is %4.2f C \r\n",sensor.ReadTemperature(CELCIUS));
    printf("Humidity is %4.2f \r\n",sensor.ReadHumidity());
    printf("weight is %4.2f \r\n",poids);
        
    wait(1);
    
    printf("\r\nErr %i \n",err);
    myled = 0;            
        
    pc.printf("Valeur : %ld   valeurTar: %ld      Poids : %.3lf\n\r",valeurHx,valeurHxTare,poids);    // Affichage du poids
    
    //Envoi vers Sigfox
    device.printf("AT$SF=%02X%02X%04X%02X\r\n",(int)sensor.ReadTemperature(CELCIUS),(int)sensor.ReadHumidity(),(int)poids, (int)reineEstPresente);

}


int main() {
    pc.baud(9600);
    valeurHxTare = Balance.getValue(); 

    //timerSon.start();
    timerCapteurs.start(); 
    timerEnvoiMsgReine.start();
    
    wait(1); // wait 1 second for device stable status
    pc.printf("\nDebut Enregistrement\n");
    
    while (1) {
        //if(!msgReineEnvoye) {
         //   tacheSon();
        //}
        
        if (timerCapteurs.read() > TEMPS_ATTENTE_CAPTEURS) {
          tacheCapteurs();
          timerCapteurs.reset();
        }
        
        if(timerEnvoiMsgReine.read() > TEMPS_ATTENTE_ENVOI_MSG_REINE) {
            msgReineEnvoye = false;
            timerEnvoiMsgReine.reset();
        }
    }
}

Credits

Chuan Li

Chuan Li

1 project • 0 followers
Thanks to Quentin Rvln, Sebastian Garrido, and Joseph Pulin.

Comments