Introduction: DIY $0 Water Trackpad
This is an entry in the
Epilog Challenge 9
This is a fun Arduino project that everyone must try sometime in their life! Here's why -
- COST = $0 (excluding Arduino Uno)
- BUILD TIME = 5 minutes
- PRECISION = 10 microns (1/100000th of a meter)
- DIFFICULTY = none
A ridiculously low cost sensor to compute the x-coordinate of right index fingertip on a water surface.
The basic idea behind this sensor is the use of a cuboidal water container as a water potentiometer device. It is similar to a 3-pin slide pot used in electronic circuits, with the 2 aluminum electrodes equivalent to the 2 end pins of a slide pot, and the right index fingertip is equivalent to the middle pin (voltage output) of a slide potentiometer. The output voltage is read by Arduino Uno's ADC and the displacement is computed. This data is serially printed by Arduino Uno to my laptop and plotted by the software SerialPortPlotter.exe.
Explanation of Tracking Algorithm
Since water is an electrolyte, its composition, hence, conductivity does not remain uniform on passing current through it. Thus, to retain uniform composition, electrolysis must be minimized. In order to minimize electrolysis, the following adaptations have been made -
- The microcontroller C++ code constantly keeps swapping over the polarity of voltage drop across the water, to cancel out the disturbance in its composition.
- The microcontroller C++ code has been optimized for minimum cycle time period, to maximize the frequency of swapping of the voltage drop polarity.
Owing to the above adaptations, the water always has uniform composition and hence, uniform conductivity at all points inside water. Thus, the voltage drops linearly with respect to the displacement from one electrode. A parallel pair of aluminum sheet electrodes are attached to the water container at two opposite faces. These two apply a voltage drop of 5 volt across the water. A bare copper wire, connected to Arduino Uno's ADC input, is tied to the left wrist. This pin tracks the voltage at the right index fingertip, i.e., output voltage of the water potentiometer, when dipped into the water.
Due to electroplating on the aluminum electrodes, some voltage drop is consumed at the 2 electrodes, so this offset in voltage at the ends of the potentiometer needs to be corrected, or else voltage would not be linear, i.e., directly proportional to the horizontal displacement. Thus, 2 offset pins are attached to the water container and connected to Arduino Uno's ADC input. In other words, the voltage drops linearly between the 2 offset pins (and NOT between the 2 electrodes, due to electroplating on the 2 electrodes).
Step 1: Gather All Components
- Arduino Uno Rev3
- 9V heavy-duty battery
- aluminum foil (kitchen foil)
- 1 bare copper wire
- plastic container (rectangle-base or square-base)
5 wires (2 for electrodes, 2 for offset, 1 for left wrist)
Step 2: Flash Arduino Code to Arduino Uno
Download the Arduino IDE from https://www.arduino.cc/en/Main/Software. Download diy_water_touchpad.ino. Then Verify and Upload the Arduino code to the Arduino Uno's microcontroller.
Step 3: Construct the Sensor
Cut 2 square pieces from the aluminum foil having breadth equal to that of the plastic container and having height a little greater than that of the container. Stick each square lamina on a cardboard base of exactly equal dimensions as the lamina. Fix these 2 electrodes inside the plastic container at an angle of 90 degrees to the horizontal base.
Step 4: Hook Up the Sensor Wires
Connect a wire from from one of those electrode plates to digital pin 2 of the Arduino Uno. Now this electrode plate becomes ELECTRODE_0. Connect another wire from from the other of those electrode plates to digital pin 3 of the Arduino Uno. Now this electrode plate becomes ELECTRODE_1.
Now, fix one wire to the inner side of the plastic cuboidal container box at some distance from ELECTRODE_0. Connect this wire to analog pin A1 of the Arduino Uno. Now, this pin becomes OFFSET_0. Now, fix another wire to the inner side of the plastic cuboidal container box at some distance from ELECTRODE_1. Connect this wire to analog pin A2 of the Arduino Uno. Now, this pin becomes OFFSET_1.
Step 5: Tie Bare Copper Wire
Tie bare (non-insulated) copper wire to your left wrist (or right wrist, if you are left-handed). The bare copper wire must be wrapped VERY tightly multiple times to make good contact with the skin. Connect the other end to analog pin A0 of the Arduino Uno.
Step 6: You're All Set!
Wipe the 2 aluminum electrodes and the interior of the plastic container with a wet cloth, to clean it of dust and impurities. Fill the water container with water from your home water purifier The water must be at room temperature. Salt or any other substances/impurities must NOT be added to it. Disconnect your laptop charger (this sensor won't work with a desktop PC), to eliminate noise due to AC-mains hum. At last, power the Arduino Uno with a 9V heavy-duty battery and connect it to your laptop via a USB cable.
FORMAT of serial output from Arduino Uno -
RANGE of serial output is 0 to 50000. When stylus is outside water, only then serial output is 51000.
BAUDRATE: 2000000 bits per sec
The x-coordinate of the fingertip can be used for any fun application like controlling the laptop screen brightness, controlling the laptop's speaker volume, among others. In the Youtube video, I've used a software called SerialPortPlotter.exe to plot a graph of the fingertip's x-coordinate versus time. You can download SerialPortPlotter.exe from here - https://os.mbed.com/media/uploads/borislav/serialportplotter.zip, or you can visit SerialPortPlotter's main page here - https://os.mbed.com/users/borislav/notebook/serial-port-plotter/
In SerialPortPlotter.exe, make the following modifications -
- BAUD = 2000000 bits per second
- DATA = 8 bits
- PARITY = 0 bits
- STOP = 1 bit
- POINTS = 1000
- Y STEP = 1500
- MIN = 0
- MAX = 51000
We have a be nice policy.
Please be positive and constructive.
You MUST have maximum surface of contact between aluminium foil and water.