Replacing potentiometer with up-down buttons on arduino
Sometimes you want an arduino application to be controlled either by a potentiometer (eg. joystick) or by a keypad. Here is a simple resistor circuit that uses two keys and mimicks a potentiometer in three different states – middle position, high position and low position.
You can breadboard the circuit and test it using the arduino inbulit AnalogInOutSerial example or using AnalogRead example.
While potentiometer will give you values from 0-1023, the keypad circuit will give you the following values (or somewhere near that number):
512 for no key pressed,
10 for down key pressed,
1010 for up key pressed
and again around 512 for both keys pressed.
Please note that this circuit can only be used in circuits where analog value from potentiometer is used, but its resistance is not important. This is usually true when one side of potentiometer is tied to +5V (or other supply voltage) and the other side to GND.
Alternative circuit with same function:
And a simple prototype keypad (upper image) and the resistor network with keypad in background (lower image), made to replace an analog joystick (uses a pair of the above circuits):
These are used to control a motor driven camera crane as an alternative to a joystick control. The camera crane with arduino control of the motors allows for precise and smooth movements of the camera with no jitter. The camera crane is being bulit in collaboration with Matjaž from RMA – he did all the mechanics and will also do the final design of enclosures for electronics and controllers. I engineered the electronics and programmed the firmware and control software. I may do a post on the crane itself and the electronics / software that drives it when I find some time. Of course the final assembly of the keypad will look a bit prettier 😉 that’s where design will come in…