Hardware components | ||||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
Software apps and online services | ||||||
![]() |
| |||||
| ||||||
| ||||||
![]() |
| |||||
![]() |
| |||||
Hand tools and fabrication machines | ||||||
![]() |
| |||||
We are 3 students in Electronics and Computer Engineering at Polytech Sorbonne : our project consists in doing an autonomous system in energy in order to measure ground movements thanks to simple datas (temperature, ground humidity). In fact, the more soil is wet, the more likely a landslide will occur.
We realized this system in a school project : temperatures and humidity datas are collected and shaped thanks to Ubidots.
Ubidots
Datas are received by Ubidots thanks to Sigfox Backend :
Backend Sigfox
We have drawn our own box in 3D with Solidworks. We also designed a box for the battery and the solar panel.
ANYOLA Box
Here some upgrades we want to make:
- Add a button to switch on/off the OLED Screen
- Accelerometer sensor
- Readapt our box which needs to protects sensors and the screen from water
Main
C/C++Ceci est le programme principal.
Dans un premier temps, nous déclarons des variables globales qui pourront être modifier par toutes les fonctions.
Par la suite, nous récoltons les données, qui seront affiché sur un écran et envoyé par un modules Sigfox .
Dans un premier temps, nous déclarons des variables globales qui pourront être modifier par toutes les fonctions.
Par la suite, nous récoltons les données, qui seront affiché sur un écran et envoyé par un modules Sigfox .
#include "mbed.h"
#include <stdint.h>
#include "WakeUp.h"
#include "bold_font.h" // 6. lcd OLDE Display 128x64
#include "standard_font.h" // 6. lcd OLDE Display 128x64
#include "ssd1306.h" // 6. lcd OLDE Display 128x64
#include "DHT22.h" //air
#include "fichier.h"
//6.OLED
SSD1306 ecran(PB_0 /* cs */, PA_6/* reset */, PA_11 /* dc */, PA_5 /* clock */, PA_7 /* data */); //DC = PB_5
//Humidity sol
int mymin = 370;
int mymax = 780;
float Pourcentage;
//Humidity et temp Air
float Tab[2]; //Tab[0] = Humi , Tab[1] = Temp
//Temp sol
float Temp_sol;
//Magneto
float XYZ[3];
//Pression
float Valeur_pressions;
//Ticker pour sleep mode.
bool expired = false;
Ticker EventWakeUp;
void callback(void) {
printf("end sleep\r\n");
expired = true;
}
//Ticker pour envoie du msg toutes les x secondes.
Ticker EventSend;
void Send(void) {
Sigfox(Pourcentage, Tab[0], (Temp_sol+20)*10, (Tab[1]+20)*10, Valeur_pressions, XYZ[0], XYZ[1], XYZ[2] );
}
int main()
{
//EventSend.attach(&Send, 30.0); //15min = 900sec
int compteur =0;
ecran.initialise();
ecran.clear();
ecran.set_contrast(255); // max contrast
ecran.update();
ecran.set_font(bold_font, 8);
ecran.printf("\r\n");
ecran.printf("\r\n");
ecran.printf("----------------\r\n");
ecran.printf("UPTADE DONNEES\r\n");
ecran.printf("----------------\r\n");
while (1)
{
//RECUPERATION DES DONNEES
Humidite_sol(&mymax,&mymin,&Pourcentage);
TempSol(&Temp_sol);
TempAndHumi(Tab);
//magneto(XYZ);
Fonction_Pression(&Valeur_pressions);
//----- SOL ------
ecran.clear();
ecran.set_font(bold_font, 8);
ecran.printf("Humidite Sol\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("Humidite = %.1f%% \r\n",Pourcentage);
ecran.printf("\r\n");
ecran.printf("--------------------\r\n");
ecran.printf("\r\n");
ecran.set_font(bold_font, 8);
ecran.printf("Temp sol\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("Temp = %.1f C \r\n",Temp_sol);
ecran.update();
wait(2);
ecran.clear();
//------ AIR ------
ecran.set_font(bold_font, 8);
ecran.printf("Humidite air\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("Humidite = %.1f%% \r\n",Tab[0]);
ecran.printf("\r\n");
ecran.printf("********************\r\n");
ecran.printf("\r\n");
ecran.set_font(bold_font, 8);
ecran.printf("Temp air\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("Temp = %.1f C \r\n",Tab[1]);
ecran.update();
wait(2);
ecran.clear();
//------ MAGNETO ------
ecran.set_font(bold_font, 8);
ecran.printf("Champs magnetique\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("X = %.1f \r\n",XYZ[0]);
ecran.printf("Y = %.1f \r\n",XYZ[1]);
ecran.printf("Z = %.1f \r\n",XYZ[2]);
ecran.update();
wait(2);
ecran.clear();
//------ PRESSIONS ------
ecran.set_font(bold_font, 8);
ecran.printf("PRESSIONS\r\n");
ecran.set_font(standard_font, 6);
ecran.printf("X = %.1f \r\n",Valeur_pressions);
ecran.update();
wait(2);
ecran.clear();
EventWakeUp.attach(&callback, 10.0);
while(!expired){
ecran.off();
sleep();
//or
//standby();
//NVIC_SystemReset();
}
ecran.on();
ecran.initialise();
ecran.clear();
ecran.set_contrast(255); // max contrast
ecran.update();
expired = false;
EventWakeUp.detach();
compteur ++;
if(compteur >15){
Send();
compteur =0;
}
printf("----------------------------------------------\r\n\n");
//------ FIN/UPTADE DONNEES ------
ecran.set_font(bold_font, 8);
ecran.printf("\r\n");
ecran.printf("\r\n");
ecran.printf("----------------\r\n");
ecran.printf("UPTADE DONNEES\r\n");
ecran.printf("----------------\r\n");
ecran.update();
}
}
void TempAndHumi(float *Tab);
void Humidite_sol(int* mymax, int* mymin, float * Pourcentage);
void TempSol(float * Temp_Sol);
void magneto(float *XYZ);
void Fonction_Pression(float * Valeur_Pression );
void Sigfox(unsigned int HumiditySol,unsigned int HumidityAir, float TempSol, int TempAir, unsigned int Pression, int X, int Y, int Z);
Température et humidité air
C/C++Grâce à la bibliothèque mbed du DHT22, On peut lire les données de température et d'humidité de l'aire.
#include "mbed.h"
#include "DHT22.h"
DHT22 cap(PA_3); //avant PB_4
void TempAndHumi(float * Tab)
{
cap.sample();
wait(0.2);
Tab[0]=cap.getHumidity()/10.0;
Tab[1]=cap.getTemperature()/10.0;
printf("AIR humidite: %.1f , temperature: %.1f\r\n",Tab[0],Tab[1]);
return;
}
#include "mbed.h"
void Sigfox(unsigned int HumiditySol,unsigned int HumidityAir, float TempSol, int TempAir, unsigned int Pression, int X, int Y, int Z) {
Serial lpwan(PA_9, PA_10); //tx , rx
char text[4];
lpwan.printf("AT\r\n");
lpwan.scanf("%s",text);
printf("Sigfox: AT : %s\r\n",text);
if (strcmp(text,"OK")==0){
lpwan.printf("AT$SF=%02x%02x%04x%04x%04x%04x%04x\r\n",HumidityAir, HumiditySol, (int)TempSol, TempAir,Pression,X,Y);
printf("msg sigfox envoye: ");
printf("AT$SF=%02x%02x%04x%04x%04x%04x%04x\r\n",HumidityAir, HumiditySol, (int)TempSol,TempAir,Pression,X,Y);
}
else
printf("Erreur, pas d'OK Sigfox\r\n");
}
#include "mbed.h"
// Capteur humidite sol
//AnalogIn Humidite(PA_0);
//Millieu sec base (air) = 775
//Millieu humide base (verre d'eau) = 375
AnalogIn Humidite(PA_0);
void Humidite_sol(int* mymax, int* mymin, float * Pourcentage) {
int Moisture;
Moisture = Humidite * 1000; //take the value, translate float to int
if (Moisture > *mymax){
*mymax = Moisture; //if a new mymax appear
}
if (Moisture < *mymin){
*mymin = Moisture;//if a new min appear
}
*Pourcentage = 100-(((float)Moisture - (float)*mymin)/((float)*mymax - (float)*mymin))*100; //make a %
printf("Valeur humidite sol: %0.1f%%\r\n", *Pourcentage);
return ;
}
#include "mbed.h"
// Capteur humidite sol
//AnalogIn Humidite(PA_0);
//Millieu sec base (air) = 775
//Millieu humide base (verre d'eau) = 375
AnalogIn Humidite(PA_0);
void Humidite_sol(int* mymax, int* mymin, float * Pourcentage) {
int Moisture;
Moisture = Humidite * 1000; //take the value, translate float to int
if (Moisture > *mymax){
*mymax = Moisture; //if a new mymax appear
}
if (Moisture < *mymin){
*mymin = Moisture;//if a new min appear
}
*Pourcentage = 100-(((float)Moisture - (float)*mymin)/((float)*mymax - (float)*mymin))*100; //make a %
printf("Valeur humidite sol: %0.1f%%\r\n", *Pourcentage);
return ;
}


















Comments