Surveillance Niveau Cuve DIY – Arduino Nano, Capteur Pression MPXV5010DP et Écran OLED
Composants et Fournitures
| Arduino Nano R3 | × | 1 |
| Capteur Pression Différentielle Freescale MPXV5010DP | × | 1 |
| Écran OLED 0,96" | × | 1 |
| Convertisseur N/A MCP4725 (DAC) | × | 1 |
| Relais (contact sec) | × | 1 |
| Condensateurs CMS 1µF, 0,01µF, 470pF | × | 1 |
| Boîtier plastique transparent 110×85mm | × | 1 |
| Tuyau Tygon 3/32" | × | 1 |
À Propos du Projet
Moniteur de niveau pour cuve de relevage, compatible avec carte d'entrée Ecobee RSM-01 ou fonctionnant en autonome grâce au relais. Choix du capteur de pression MPXV5010DP (sortie 0-5V pour 0-10 kPa ≈ 1020 mm de colonne d'eau) pour fiabilité et facilité d'installation vs capteur ultrasons.
Architecture
- Affichage local : Écran OLED bicolore 128×64
- Interface : Relais pour contact sec + DAC MCP4725 pour sortie 0-5V amplifiée (protège le capteur)
- Communication I2C : Facilite l'extension vers un autre Arduino
- PCB personnalisé : Conçu pour faciliter les connexions et configurations multiples
Installation Capteur
Le MPXV5010DP est relié par tuyau Tygon à un tube cuivre descendu dans la cuve. Le boîtier reste hors d'eau, installation discrète.
Code Arduino
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#include <Adafruit_MCP4725.h>
#include <math.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 64)
#error("Hauteur incorrecte, corrigez Adafruit_SSD1306.h!");
#endif
Adafruit_MCP4725 dac;
int relayPin = 5; // Relais alarme
int analogPin = 0; // Lecture tension DAC
int v1 = 0; // ADC capteur MPXV5010
int v2 = 0; // Échelle pour DAC
int v3 = 0; // Conversion mm
int v4 = 0; // Pourcentage remplissage
int v5 = 0; // Lecture DAC
int v6 = 0; // Conversion mV
float v7 = 0; // Conversion pouces
int v8 = 0; // Entier pouces affichage
int offSet = 40; // Sortie 0 kPa mesurée par Arduino
int maxSet = 1015; // Sortie 10 kPa mesurée par Arduino
int maxHeight = 1020; // Profondeur cuve (mm) niveau normal → couvercle
int ranging = (maxHeight * 0.8) + offSet;
int alarmHeight = 12; // Hauteur alarme (pouces)
int analogPin2 = 1;
float divisor = 25.4; // mm → pouces
void setup() {
Serial.begin(9600);
Serial.println("DAC test with DP sensor");
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
dac.begin(0x60); // Adresse MCP4725A0
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Relais repos = HIGH
}
void loop() {
v1 = analogRead(analogPin2);
delay(1000);
if (v1 < offSet) v1 = offSet;
// Conversion pour DAC (0-4095)
v2 = map(v1, offSet, maxSet, 0, 4095);
dac.setVoltage(v2, false);
// Conversion mm
v3 = (v1 - offSet) / 0.8;
v7 = v3 / divisor; // mm → pouces
v8 = round(v7); // Entier pour affichage
// Pourcentage remplissage
v4 = map(v1, offSet, ranging, 0, 100);
// Lecture retour DAC
v5 = analogRead(analogPin);
v6 = map(v5, 0, 1023, 0, 5000); // mV
printoled();
serial();
}
void printoled() {
display.clearDisplay();
// Inversion affichage + activation relais (LOW = actif) si alarme
if (v8 > alarmHeight) {
display.invertDisplay(true);
digitalWrite(relayPin, LOW);
} else {
display.invertDisplay(false);
digitalWrite(relayPin, HIGH);
}
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("SUMP LEVEL");
display.setTextSize(4);
display.setTextColor(WHITE);
display.print(v8);
display.setTextSize(2);
display.println(" inches");
display.display();
delay(500);
}
void serial() {
Serial.print(" PS analog input: "); Serial.print(v1);
Serial.print(" Height: "); Serial.print(v3); Serial.print(" mm ");
Serial.print(v4); Serial.print(" %");
Serial.print(" Converted voltage: "); Serial.print(v6); Serial.println(" mV");
}
Schéma (Eagle 6.5.0)
sump%20level.sch
Processus de fabrication
- Comprendre la portée des variables en C# : Niveaux classe, méthode et bloc
- Construire une station météo et qualité de l'air Raspberry Pi avec InfluxDB et Grafana
- Installer Google Assistant sur un MATRIX Voice Raspberry Pi – Guide étape par étape
- Moniteur météo – Station météo DIY Raspberry Pi avec upload Dropbox
- Système de surveillance cardiaque à distance avec alertes AWS IoT
- Construire un Rover Windows IoT Core avec Raspberry Pi 2 – Guide débutant à avancé
- Étendre GoPiGo v2 sur Windows 10 IoT Core pour Raspberry Pi 3
- Modélisation au Niveau des Portes : Relier Schémas Matériels au Code Verilog
- JW Machine : Services de fabrication sous contrat CNC de précision