Drawing board with Arduino

I've made my first Arduino shield.

And I tried to use buttons and potentiometers on it with Arduino. This is the schema:

I took AnalogInSerial example, modified it, and then I tried to read Arduino output using Python script called monitor.py.
It was so amazing that I wrote simple drawing board using PyQt called draw.py. It looks like this:

'How to make lines less noisy?' I told myself and tried to add interpolation filter. Modified script is called drawavg.py.
But averaging didn't give me good result so I've used interpolation between old and new values in 4old+1new. Greater proportion gives greater cursor inertion - 10:1 is artistic, 19:1 is already uncontrolable but yet fun.

But to hold the button and rotate the potentiometer is not very useful. Since I've made another modification, and new script called drawctrl.py. Press button to enter draw mode, press and hold other button to change brush type (square or circle), brush size and brush color.
Some screenshot and nice picture:

Schema, sketch and Python code http://sites.google.com/site/vanyambauseslinux/home/fajlovyj-menedzer/arduinodraw.tar.gz

Pretty cool!

Regarding the buttons shorting to ground, a good general principle in situations like that is to put a 1K resistor in series with the button. That'll limit the current that the IO pin needs to source to about 5mA if it's being asserted HIGH when the button is pushed, while still providing a strong enough pull-down to overcome other bias through, say, 10K resistors.

I'm a bit confused about that part of your circuit anyway though. You have pulled those pins HIGH through 10K resistors, and also pulled LOW through 10K resistors and LEDs. That'll leave them biased at just above half the supply voltage, and at 5V you won't get much (if any) illumination of the LED anyway so I don't see what the point of them is. What are you trying to achieve with that part of the circuit? Why not have button inputs and LED outputs on totally different pins?


Freetronics: www.freetronics.com

Hello, Jon!

First I'd want to get several LEDs on the shield, so I looked to Arduino schema and connect LED in series with 510 resistor. But I'd want to get the button on the same pin, so I added 10K pull-up resistor between the pin and +5V, and the button in parallel with LED.

But when I tried to measure voltage on the pin in INPUT mode, I've got about +2V. Only connection at the schema gave +3.6V on the pin in INPUT mode, and 0V when the button is pushed.

At the moment I think to attempt to make 3-resistors voltage divider with levels +5V, HIGH, LOW and GND, and connect the button as switcher between HIGH and LOW.

The reason to connect the LED and the button on the same pin is simple. I need this shield for debug purposes. Less pins for debug, more pins for debugged functions.