Resistor Ladder Mode of Operation (Project 07 Keyboard Instrument)

Hi everyone,

I just finished Project 07 Keyboard Instrument and it is a quite fun instrument :smiley:
However, I have some clarification questions on the functionality of the resistor ladder and the analog read function and I hope, you can help me.

As far as I understand the circuit (I attached the circuit as image), all the resistors and switches are connected in parallel.
Hence, my understanding is, that the voltage applied to each switch is equal.
When pressing one button, the voltage source and the resistor are in series to the analog read input connection which, for me, would mean, that there are always 5 V reaching the analog read connection as soon as you press a button. But the current changes according to the resistance.
In the starter kit book, Ohm's Law is described with a 220 Ohm resistor connected in series to an LED, where the resistor is necessary to reduce the current reaching the LED and avoid any damage.
This is why my confusion arises with he resistor ladder of this project: the resistors and the anaolg read connection are connected in the same way as the resistor and the LED.
So how does the analog in produce the different frequencies as function of the different input signals.
I thought it only works with voltage inputs.

I know this is a basic question, but I still don't get the mode of operation of this project and I am looking forward to any hint you can provide.

Thanks a lot

Project 07 Keyboard Instrume

Project 07 Keyboard Instrument Resistor Ladder.jpg

Project 07 Keyboard Instrument Resistor Ladder.jpg

You are forgetting the 10k resistor between A0 and Ground. This is creating a voltage divider, as point 2 on page 81. If you haven't already got one then get yourself an inexpensive multimeter then you can check the input voltage at pin A0.

Hi dannable,

thanks a lot.
I obviously forgot about the connection between A0 and Ground!
it makes more sense now.

Is the connection analogue to the wiring diagram I attached?
Thats at least what I get now.

And which voltage does A0 measure? The Voltage over the varying resistance or the voltage over the 10k resistor i.e. the voltage between ground and the A0 line (not between 5V and the A0 line)?

Thanks again

Voltage Divider.jpg

Voltage Divider.jpg

Other people can explain far better than I can, so try: Voltage Dividers - SparkFun Learn

Thanks a lot