Hello all,
In one of my projects, I want to make a tilt switch like this one
http://www2.warwick.ac.uk/fac/sci/wmg/about/outreach/resources/making_a_tilt_sensor.pdf
I want to know what will be the output voltage if we apply 3v dc to this switch's input
a) It's going to depend on your water.
b) You don't apply a voltage directly, what changes when you tilt the bottle is the resistance between the two pins.
You should connect one pin to 5V through a resistor and the other to GND. Measure the voltage where the resistor is joined to the pin.
What value resistor? Use a multimeter to measure the resistance between the pins when the bottle is tilted, multiply by 10.
Thanks for your response but I can not understand the method by which you calculate the value of resistor required.Can you please elaborate a bit.
a) Use a multimeter to measure the resistance between the pins when the bottle is tilted
b) Multiply by 10
Perhaps a worked example will help?
-
Tilt your sensor so water is in contact with both connections.
-
Measure the resistance between the two connections. (For example, you measure 930 ohms.)
-
Multiply by 10. (930 x 10 = 9,300).
-
Select the nearest standard value to your answer (9,300 ~= 10,000 = 10k)
So in this case, use a 10k (also known as 10 kilohm, or 10,000 ohm) resistor.
Thanks for the reply but why we are multiplying the calculated value by 10
And notice, that as soon as you use iron needles in sodium chloride solution, and add a bit of electricity.... your positive needle is going to dissolve surprisingly fast.
You can make the problem smaller by supplying the electricity from an output pin, and only write it HIGH when you want to perform the reading of your tilt sensor.
What do you want to use it for?
we are multiplying the calculated value by 10
Because for the sensor to be most useful, we would like as large a signal change as possible when the sensor detects a tilt, and a resistor 10x your sensor resistance will give a 91% voltage swing (from a 12V supply, the output would change by 11V). If you chose to use the same value, without multiplying by 10, you'd just get 50% voltage swing (from a 12V supply, the output would change by 6V).
You can choose other values of course, but fungus's suggestion of 10x is a good start to see the sensor working.
Peter_I:
And notice, that as soon as you use iron needles in sodium chloride solution, and add a bit of electricity.... your positive needle is going to dissolve surprisingly fast.You can make the problem smaller by supplying the electricity from an output pin, and only write it HIGH when you want to perform the reading of your tilt sensor.
Actually, it is even easier than that. You enable the internal pullup (by writing HIGH to the same pin whilst it is defined as an input) just long enough (should be immediate, but give it a few microseconds) to make the measurement and then disable it by writing LOW to the pin.
The internal pullup is estimated as about 10k, and the resistance in salted water should easily be less than 1k. The reason for the much larger pullup is to ensure that the resistance of the water pulls the input voltage well below the high/ low threshold for sensing.
The above methods will slow the electrolytic errosion of the electrodes, but will not prevent it. To prevent it completely, without plating with expensive metals lilke gold, use a biphasic measurement as follows:
Connect the sensor between two port pins and have a pull-up resistor to Vcc from each. Then perform two port measurements: first by setting pin A as output and drive it low, use _delay_us() to define a measurement delay, read pin B then restore it as input. Next, set pin B as output and drive it low, delay for exactly the same time, read pin A then restore it as input. Use one pin reading to read the sensor (ignore the other).
If both pin measurements are equal, then there is no net charge transfer between the electrodes, and no net electrolytic erosion.
Platinum would be good.
michinyon:
Platinum would be good.
Platinum is fantastic!
(for anything but your bank account)
I guess the purpose of this is "build your own".
Commercial "ball in a metal tube" tilt switches cost very little.
Billysugger:
The above methods will slow the electrolytic errosion of the electrodes, but will not prevent it. To prevent it completely, without plating with expensive metals lilke gold, use a biphasic measurement as follows
Easier: Put a polystyrene capacitor - a fraction of a microfarad - in series with the sensor wire (using the internal pullup I cited earlier). While the pin is set LOW between measurements, switch it to an output, and back to an input before enabling the internal pullup for the next measurement.
Peter_I:
I guess the purpose of this is "build your own".
Commercial "ball in a metal tube" tilt switches cost very little.
I do not think any of use ever doubted that this thing was purely as an amusing exercise, with no "real world" application whatsoever. Clearly proper tilt switches are dirt cheap, even triple axis accelerometers.
Billysugger:
If both pin measurements are equal, then there is no net charge transfer between the electrodes, and no net electrolytic erosion.
I had guessed that with a "normal" measurement one of the two electrodes erodes,
but by alternating you achieve that both electrodes erode by the same amount ( and thus it's harder to see the effect )
![]()
Usually, you can provide a "sacrificial anode" to protect the other.