Hello.
First off, I'd like to say that I am completely new to the whole Arduino / Physical Computing scene and I wanted this to be my first project.
I recently discovered a video, in which a graphite pencil was used as an input for an Arduino.
Apparently the pencil acts like a kind of switch which completes the circuit, where the graphite on the paper acts as a resistor. It seems the modulating voltages / currents are then used to produce sounds via a piezo-speaker.
This is as far as I get without help.
I guess what I need to know now is where to put "stuff".
Where would I plug in the pencil?
What voltage would I connect to it?
What kind of resistors do I need? (this seems to depend on the resistance of the pencil)
Same questions apply to the piezo-speaker, I guess.
I'm trying to realize this on an Arduino UNO.
Any pointers are appreciated, thanks
You need to connect two wires to the arduino one to the ground and the other to the analogue input A0. Then put crock clips to the other end of the wires and attach them to a piece of paper. Scribble a line between them making sure the clips are under the pencil line.
Enable the pull up resistor on the analogue input by doing a digitalWrite(14,HIGH) ; in the setup.
Then as you scribble more lines connecting the two clips the reading you get from the analogRead(0) ; will get smaller. Print this out on the serial consol first and then use it to generate a tone using the tome function.
Have fun.
Great, thanks for the detailed answer
Now I still have some questions though:
Why is it digitalWrite(14, HIGH), but analogRead(0)? Are pin 14 and 0 interchangeable?
What is the resistance of the pull up resistor?
How would I connect the speaker?
Where would the current come from?
Thanks!
Because digital pin 14 is the same as analogue pin 0
the pull up resistor is inside the arduino you just have to enable it.
the current comes from the arduino.
Ad to the speaker see the instructions about the tone function but basically to the pin you output the tone on plus a seriese resistor of 100R.
Thank you very much, your help is greatly appreciated.
I will report back with my results!