zezarandrade
Published © GPL3+

Arduino Tank Monitor

This project consists of monitoring the level of water in two tanks.

IntermediateFull instructions provided7,828
Arduino Tank Monitor

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
Potentiometer, 10K
×2

Story

Read more

Schematics

Circuit Diagram:

Wiring:

Code

Tank_Monitor

Arduino
// This routine let you to monitor level in two tanks:
// Standard protocol to select instruments:
 void SendString(byte InstrNr, int MW) { 
Serial.print('#');
Serial.print(InstrNr);
Serial.print('M'); 
Serial.print(MW); Serial.print('<'); }
void setup() {
  // initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue0 = analogRead(A0);
   // read the input on analog pin 1:
  int sensorValue1 = analogRead(A1);
  // Convert the analog readings (which goes from 0 - 1023) to a level value(0 - 100%):
  float voltage0 = sensorValue0 * (100.0 / 1023.0);
  float voltage1 = sensorValue1 * (100.0 / 1023.0);
    // print out the value you read:
SendString(2,voltage0); // Instrument #02 - Vert Meter
SendString(3,voltage1); // Instrument #03 - Vert Meter
SendString(41,voltage0); // Instrument #41 - Num Display
SendString(42,voltage1); // Instrument #42 - Num Display
SendString(90,voltage0); // Instrument #90 - Min Trend
SendString(91,voltage1); // Instrument #91 - Min Trend
delay(100); 
}

Credits

zezarandrade

zezarandrade

2 projects • 18 followers

Comments