Emmanuel CollinThéo PaillierRené - Mervis MUDRYmeriem lagha
Published © GPL3+

NMF Atlantis

Flood detection system through water level measurements. Data transmission using Sigfox LPWAN. Real-time monitoring and alerts on Ubidots.

AdvancedShowcase (no instructions)24 hours817
NMF Atlantis

Things used in this project

Hardware components

Nucleo 144 STM32F7
ST STM32L4, STM32F7 Nucleo 144 STM32F7
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Sigfox Breakout board BRKWS01
×1
Grove - Ultrasonic Ranger
Seeed Studio Grove - Ultrasonic Ranger
×1
3.7V 1050mAh LiPo Battery
×1
2W Solar Panel
×1
Plastic Enclosure, Proj box
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Resistor 2.21k ohm
Resistor 2.21k ohm
×1
Pololu S7V8F5
×1
Capacitor 4.7 µF
Capacitor 4.7 µF
×2
MCP73831 Single Cell, Li-Ion/Li-Polymer Charge Management Controller
×1

Software apps and online services

Ubidots
Ubidots
Sigfox
Sigfox
Mbed Studio
Arm Mbed Studio
KiCad
KiCad
Solidworks

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)
Hot glue gun (generic)
Hot glue gun (generic)
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Custom parts and enclosures

Support

Schematics

Supply schematic

Nucleo connections

Supply PCB

Main board PCB

KiCad - PCB Microcontroller

Can be printed with an appropriate PCB printer

KiCad - PCB Power Supply

Can be printed with an appropriate PCB printer

Code

Main

C/C++
#include "mbed.h"
#include "DHT.h"
#include "Pulse.h"
#include "RangeFinder.h"
#include "WakeUp.h"


RangeFinder rf(D12, 10, 5800, 100000); //(Pin, duree du pulse en us, distance [m] = pulse width [us] / 5800 [us / m] , temps de fonctionnement)

DigitalOut led(LED1);
Serial serial(D1, D0);
Serial pc(USBTX, USBRX);
DHT HTSensor(D10,22);
AnalogIn battery(A1);


int main()
{

    pc.printf("Starting...\n\r\n\r");

    float d;
    int dInt;
    
    float temperature;
    int tInt;
    float humidity;
    int hInt;
    float b;
    int bInt;
    int cpt = 0;
  
      
    // En fonction du cours d'eau
    float Limite_sensor = 4.0*100.0;
    float Limite_danger = 50.0; 
    int Temps_danger = 900; 
    int Temps_default = 1800;
    int Intervalle_envoi = 3600; //Toutes les heures (1h = 3600 s)
    while (1)   
    {   
        //Mesure niveau batterie réduite (entre 0 V et 1.85 V) 
        b = battery.read()*3.3f;
        bInt = (int)(b*100/3.3f);
        
        pc.printf("Voltage = %f volts\r\n\r\n", b);
        pc.printf("Voltage code = %d percentage\r\n\r\n", bInt);
                 
        //Mesures de temperature et humidite
        
        HTSensor.readData();
        wait_us(500);
        
        temperature = HTSensor.ReadTemperature(KELVIN) - 273,15;
        tInt = (int) (temperature + 40);
        humidity = HTSensor.ReadHumidity();
        hInt = (int) humidity;
        
        
        pc.printf("Temperature = %f degre C.\n\r", temperature);
        pc.printf("temp code = %d\n\r", tInt);
        pc.printf("temp Hex = %02x\n\r\n\r",tInt);
        pc.printf("Humidity = %f percentage.\n\r", humidity);
        pc.printf("hum code = %d\n\r", hInt);
        pc.printf("hum Hex = %02x\n\r\n\r",hInt);
        
        //Mesure distance
        
        d = rf.read_m();
        d = d*100;
        if (d < 0)  
        {
            d = 0;
            WakeUp::set(Temps_default); //temps en secondes
            deepsleep();
            cpt += Temps_default; 

        } 
        else if (d >= Limite_sensor) 
        {
            d = Limite_sensor;
            
            // Seeed's sensor has a maximum range of 4m, it returns
            // something like 7m if the ultrasound pulse isn't reflected.
            WakeUp::set(Temps_default); //temps en secondes
            deepsleep();
            cpt += Temps_default; 
        }
        else if (d <= Limite_danger) // Flood
        {
            dInt = (int)d;
            
            //Envoi des informations
            serial.printf("AT$SF=%04x%02x%02x%02x\r\n",dInt,tInt,hInt, bInt);
          
            //Si danger, on l'envoie à chaque fois
            WakeUp::set(Temps_danger); //Temps en secondes
            deepsleep();
            cpt += Temps_danger;
        }
        else
        {
            
            WakeUp::set(Temps_default); //temps en secondes
            deepsleep();
            cpt += Temps_default;
        }
        
        if (cpt >= Intervalle_envoi)
        {
            dInt = (int)d;
            serial.printf("AT$SF=%04x%02x%02x%02x\r\n",dInt,tInt,hInt, bInt);
            cpt = 0;
        }

    }
}

NMF Atlantis Code

Files to be added to your mbed compiler

Credits

Emmanuel Collin

Emmanuel Collin

1 project • 2 followers
Théo Paillier

Théo Paillier

1 project • 2 followers
René - Mervis MUDRY

René - Mervis MUDRY

0 projects • 1 follower
meriem lagha

meriem lagha

0 projects • 1 follower

Comments