Introduction: Liquid Level Capacitive Sensor

Developed @FABLAB VERITAS fablab.veritas.cr

In this tutorial you will learn how to make a capacitive sensor to measure liquid levels. You will need the following:

  1. Arduino UNO
  2. 1M Resistor
  3. Prototyping cables
  4. SVGs of the tubes
  5. 3D Printer
  6. Aluminum foil

Step 1: Waterproof Concentric Tubes

The sensor works with two pieces of aluminum inside of two waterproof concentric tubes.

You can download the parts and their 3d models to print them here:

Step 2: Cover the Tubes With Aluminum Foil

Step 3: Assemble the Tubes and Their Covers

  1. Introduce the inner tube covered in aluminum foil in the inner tube cover.
  2. Introduce the external tube covered in aluminum foil in the external cover.
  3. Introduce the inner tube in the outer tube and glue them together with hot glue.
  4. Make sure that when the tubes under a liquid the liquid does not touch the foil.
  5. Solder a cable to each piece of aluminum foil.

Step 4: Connect to the Arduino

Follow the diagrams above to connect the Arduino and then use the Capacitive Sensor Library example.

/* * CapitiveSense Library Demo Sketch * Paul Badger 2008 * Uses a high value resistor e.g. 10M between send pin and receive pin * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values. * Receive pin is the sensor pin - try different amounts of foil/metal on this pin */ CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired void setup() { cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example Serial.begin(9600); } void loop() { long start = millis(); long total1 = cs_4_2.capacitiveSensor(30); Serial.print(millis() - start); // check on performance in milliseconds Serial.print("\t"); // tab character for debug windown spacing Serial.print(total1); // print sensor output 1 Serial.print("\t"); delay(10); // arbitrary delay to limit data to serial port }