RaphaelRami AlJed
Published © GPL3+

Plant Monitoring

An engineering school project.

IntermediateShowcase (no instructions)Over 1 day846
Plant Monitoring

Things used in this project

Hardware components

STM32 Nucleo Nucleo L432KC
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Modulo Temperature Probe
Modulo Temperature Probe
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
TSL2561
Luminosity sensor
×1
SOL2W
Solar Panel
×1
Lipo Rider Pro
Supply adapter
×1
ADA326
LCD display screen
×1
Accu Li-Ion 3,7 V 1050 mAh
3,7V Battery
×1

Software apps and online services

BlueMix
IBM BlueMix
Arm Mbed Mbed
FreeCad
EasyEDA

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

CAD

Schematics

Schematics and circuit diagrams

Code

Code of the plant monitoring

C/C++
// LIBRARY
#include "mbed.h"
#include "DS18B20.h"
#include "OneWireDefs.h"
#include "TSL2561.h"
#include "DHT22.h"
#include "bold_font.h"
#include "standard_font.h"
#include "ssd1306.h"

#define THERMOMETER DS18B20

// INITIALIZATION OF SENSORS AND NUCLEO'S PINS
Serial serie(SERIAL_TX, SERIAL_RX);
TSL2561 LUM(PB_7, PB_6); // Luminosité (I2C:SDA,SCL)
DHT22 Tem_Hum_A(PA_11); // Température & Humidité air
AnalogIn Humidite(PA_0);
SSD1306 ecran(D3 /* cs */, D6/* reset */, A5 /* dc */, A4 /* clock */, D2 /* data */);
//Serial PC(PA_2, PA_3);
Serial sigfox(PA_9, PA_10);
DigitalOut myled(LED1);

int i, Hum_sol, Temp_sol, Lum, Temp_air, Hum_air;

int main()
{   

    ecran.initialise();
    ecran.clear();
    ecran.set_contrast(255);
    ecran.set_font(bold_font, 8);
    
    serie.printf("New Program \r\n");
     // device( crcOn, useAddress, parasitic, mbed pin )
    THERMOMETER device(true, true, false, PA_8);
    
    while (!device.initialize());    // keep calling until it works
    
    while (true)
    {   
        myled = !myled;
        Tem_Hum_A.sample();
        
        // READING VALUES FROM SENSORS
        device.readTemperature(); 
        Temp_air = (int)(Tem_Hum_A.getTemperature()/10);
        Hum_air = (int) (Tem_Hum_A.getHumidity()/10);
        Hum_sol = (int)(Humidite.read()* 100) ;
        Temp_sol = (int)device.readTemperature();
        Lum = (int) LUM.lux();
        printf("Temperature air: %d\n\r", Tem_Hum_A.getTemperature()/10);
        printf("Hum air: %d\n\r", Tem_Hum_A.getHumidity()/10);
        serie.printf("\rLum: %f \r\n", LUM.lux());
        serie.printf("Temperature sol: %d \n\r",Temp_sol);
        serie.printf("Hum sol: %f \n\r",Humidite.read()*100);
        printf("------------------------------------------------------------\n\r");
        
        //SENDING VALUES USING SIGFOX
        sigfox.printf("AT$SS=%02x %02x %02x %02x %02x \r\n", Temp_sol, Temp_air, Lum, Hum_sol, Hum_air);
        
        //OLED : PRINT VALUES ON THE SCREEN
        ecran.set_font(bold_font, 8);
        ecran.printf("Valeurs");
        ecran.printf("\r\n"); 
        ecran.update();
        ecran.set_font(standard_font, 6);
        ecran.printf("Temp air = %d",Temp_air );
        ecran.printf("\r\n");
        ecran.printf("Hum air = %d", Tem_Hum_A.getHumidity()/10);
        ecran.printf("\r\n");
        ecran.printf("Lum = %f", LUM.lux());
        ecran.printf("\r\n");
        ecran.printf("Temp sol = %d",Temp_sol );
        ecran.printf("\r\n");
        ecran.printf("Hum sol = %f", Hum_sol);
        ecran.printf("\r\n");
        ecran.update();
        ecran.clear();
        
        
        
        wait(10);
    }
    return EXIT_SUCCESS;
}

Credits

Raphael

Raphael

1 project • 1 follower
Electronics and computer science student at Polytech Sorbonne. I'm doing an apprenticeship at RATP.
Rami AlJed

Rami AlJed

1 project • 1 follower
Engineering apprentice at Groupe Renault and Polytech Sorbonne (ex Polytech UPMC) Studying electronics and computer science.

Comments