http://www.practicalarduino.com/projects/water-tank-depth-sensor
Lista de Materiais:
IDE Arduino 1.0
1x Board Arduino UNO
1x Protoboard 830 furos
1x Cabo USB-A male to USB-B male
1x Conj. de fios jumper p/ protoboard
1x Sensor de pressão MPX5050GP
1x Resistor 470R 1/4w
1x Trimpot 10k
1x Display ITM1602B
1x Mangueira de Silicone (p/ testes)
1x Seringa 5ml (p/ testes)
Montagem:
Firmware:
#include <LiquidCrystal.h>
int sensorPin = A0;
int sensorValue = 0;
float Vout, Value_Kpa, Value_mmHg;
LiquidCrystal lcd(2,3,4,5,6,7);
void setup() {
lcd.begin(16, 2);
lcd.display();
}
void loop() {
sensorValue = analogRead(sensorPin);
Vout = (sensorValue * 0.00459); //0.004594330400782013
Value_Kpa = (Vout - 0.2)/0.09;
Value_mmHg = Value_Kpa * 7.50061; //7.50061561303
if(Value_Kpa < 0) Value_Kpa = 0, Value_mmHg = 0;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Value_Kpa, 0);
lcd.print("Kpa");
lcd.setCursor(11, 0);
lcd.print(Vout);
lcd.print("V");
lcd.setCursor(0, 1);
lcd.print(Value_mmHg, 0);
lcd.print("mmHg");
delay(500);
}
Download: MPX5050GP
Download: ITM1602B
Good Work :)
ResponderExcluir