Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Mirko Pavleski
Published © GPL3+

Arduino Liquid Level Meter with simple Homemade Sensor

How to make a sensor yourself, and then with the help of a microcontroller to accurately determine the level of liquid in the container.

BeginnerFull instructions provided14,273
Arduino Liquid Level Meter with simple Homemade Sensor

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Homemade Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Serialcominstruments app

Hand tools and fabrication machines

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

Story

Read more

Schematics

Schematic diagram

Code

Arduino code

Arduino
#include <Capacitor.h>
Capacitor cap1(7,A2);
int kondenzator=0;
int w = 0;
void SendString(byte InstrNo, int MValue) {
  Serial.print('#');
  Serial.print(InstrNo);
  Serial.print('M');
  Serial.print(MValue);
  Serial.print('<');
}

void setup() 
{ 
Serial.begin(9600);
}

void loop() 
{
kondenzator = (cap1.Measure())*100;
 //Serial.print(kondenzator);  // Measure the capacitance (in pF), print to Serial Monitor
  int w = map(kondenzator, 130, 330, 0, 500); 
 // Serial.print(w);
    SendString(1,w);       // Instrument #01
    SendString(2,w);       // Instrument #02
    SendString(3,w);       // Instrument #03
    delay(500);
  } 

Credits

Mirko Pavleski
154 projects • 1304 followers

Comments