Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

NMF Atlantis

Added to IoTplaybook or last updated on: 04/16/2020
NMF Atlantis

Story

What is NMF Atlantis ?

NMF Atlantis is an embedded system that aims to warn users of an incoming flood so they can prepare and get safe before it happens. It is a student project realised at Polytech Sorbonne.

Why this project?

Floods are an increasing threat because of the rise of the sea level. They are occurring more frequently and their damage is tremendous. The point of this project is to warn people soon enough so they are prepared when the flood arises. This way, lives will be saved and some damage might get avoided.

NMF Atlantis

Things used in this project

Hardware components

Nucleo 144 STM32F7
ST STM32L4, STM32F7 Nucleo 144 STM32F7
 
× 1

ST.com

DHT22 Temperature Sensor
DHT22 Temperature Sensor
 
× 1

SparkFun

 
Sigfox Breakout board BRKWS01
 
× 1

Yadom

Grove - Ultrasonic Ranger
Seeed Grove - Ultrasonic Ranger
 
× 1

Seeed

 
3.7V 1050mAh LiPo Battery
 
× 1  
 
2W Solar Panel
 
× 1  
 
Plastic Enclosure, Proj box
 
× 1  
Resistor 10k ohm
Resistor 10k ohm
 
× 2

Newark

Resistor 2.21k ohm
Resistor 2.21k ohm
 
× 1

Newark

 
Pololu S7V8F5
 
× 1

Pololu

Capacitor 4.7 µF
Capacitor 4.7 µF
 
× 2

Newark

 
MCP73831 Single Cell, Li-Ion/Li-Polymer Charge Management Controller
 
× 1

Microchip

Software apps and online services

Ubidots
Ubidots
 
 

Ubidots

Sigfox
Sigfox
 
 

Sigfox

Mbed Studio
Arm Mbed Mbed Studio
 
  Mbed Studio
KiCad
KiCad
 
 

KiCad

 
Solidworks
 
  SOLIDWORKS

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
 
   
Solder Wire, Lead Free
Solder Wire, Lead Free
 
 

Newark

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
 
 

Newark

Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
 
 

Newark

How does it work?

The core of our system is the microcontroller that is running the program and that is connected to all the sensors, the battery, and the Sigfox module. Using a Low-Power Wide-Area Network (Sigfox's LPWAN) and a rechargeable power supply were the specifications ventured by our teachers. Therefore, we focused on reducing power consumption. In order to do that and yet having a reliable product, the program is carrying on measurements every 15 minutes and send the results every hour (default settings).

General aspect
General aspect

 

Inside view of the components assembled
Inside view of the components assembled

With the support of our teachers, we managed to achieve our goal and create an automous device able to warn users of a potential flood as well as giving them details about temperature and humidity.

Main features:

  • Level measurement,
  • Temperature measurement,
  • Humidity measurement,
  • LPWAN data sending,
  • Fully autonomous.

Code

We wanted the code to be easily adaptable to a local situation. Therefore, five variables rule the program operation. Those five variables are:

// Depending on the waterway
float sensor_limit = 4.0*100.0;
float danger_limit = 50.0;
int danger_time = 15;
int default_time = 30;
int sending_interval = 3600; //every hour (1h = 3600 s).

The first limit (sensor_limit) indicates the reach of the rangefinder used. The second limit is the danger_limit and as to be set according to the threat of the waterway you are willing to monitor. The danger_time and default_time are the intervals between two measurements in case of danger or by default. Finally, the sending_interval indicates the time between two messages. You will find the whole code in the Attachments or by clicking on the following link.

Electronic

The STM32 Nucleo-L432KC development board has to be linked with the sensors following the schematic below. The Power Supply has its own circuit (that can be found below as well). The main purpose of this circuit is to recharge the Li-Ion battery thanks to a solar panel and a charge manager, the MCP73831. The second purpose is to retrieve the battery level and send it to one of the microcontroller pins.

Microcontroller, sensors and Sigfox module wiring plans
Microcontroller, sensor, and Sigfox module wiring plans

Power Supply Circuit
Power supply circuit

Feel free to plan the pins the way it suits you. However, do not forget to modify the code so the microcontroller take it into account.

To make the wiring more reliable, we designed Printed Circuit Board for both the microcontroller and its sensors and the power supply. The KiCad files are available in the attachments.

Power Supply PCB design
Power Supply PCM design

Microcontroller and sensors PCB
Microcontroller and sensors PCB

Data Processing

Data is sent through a 10-bit bus:

  • 4 bits for the distance,
  • 2 bits for the temperature,
  • 2 bits for the humidity,
  • 2 bits for the battery level.

Then, callbacks have to be configured on the Sigfox backend platform:

Callbacks settings
Callback settings

 

The data received is not representative of the reality yet. Two synthetic variables are needed :

  • Vbat = (vreduced*3.3*2/100)/3.7*100the battery voltage,
  • Temperature = temperature-40the real temperature.

Next step is to configure your Ubidots dashboard to make it look the way you want. You will also be able to configure on what level an alert is sent to your mailbox or phone.

Ubidots dashboard example
Ubidots dashboard example

You are now able to monitor any waterway and save lives!

About the name: NMF stands for No More Flood and Atlantis is an obvious reference to the mythical submerged city.

Custom parts and enclosures

support_capteur_3wpCxxYRHo.STL

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

Mand-Alor / NMF_Atlantis

NMF Atlantis Code — Read More

Latest commit to the master branch on 1-20-2020 - Download as zip

Credits

Emmanuel Collin

Emmanuel Collin 

Théo Paillier

Théo Paillier 

René - Mervis MUDRY

René - Mervis MUDRY 

 

 

 

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 04/16/2020.