So I am attempting to make a resistor ladder type thing to be the input for a keyboard instrument, but here is my problem: I want to be able to make multiple tones through one input. I know I could do this with muliplexing, but I thought I'd ask here first. Is there some sort of electrical component (or combination thereof) that I can use that basically says "If the current going through me is below x amount, allow y amount. If it's above this, output no current" Because I'd like to have photoresistors chained together and then through 1, 2, 4, 8, 16, 32, 64, 128 ohm resistors, and be able to round or something similar in code and have it return to me a reliably accurate binary reading of which photoresistors are having light shined on them. Then I could just convert the number to binary and use a bitmask to determine which are tripped from the decimal value that it returns (if you don't know code for whatever reason, just ignore that last part.)
I just think that this method might be less messy than messing with all kinds of multiplexing. If not, tell me and I'll figure out the multiplexing and do it that way!
Thanks,
James D.
Something like this? (just an example, you may mess with the resistor's values, maybe to use a current source instead of the R7):
I am doing some thing similar. I use diodes that are connected to several voltage references. If the voltage from an op amp goes above the reference voltage, the diode lets current flow through a resistor. If the input voltage is less than the reference voltage no current flows. A ladder of various resistor values are turned on or off when voltage changes.
why exactly do you want such an elaborate input ? what are you trying to work around ?
pito: more like attached diagram, but instead of pushbuttons, photoresistors acting similarly in an on/off way. (unrelated, what did you use to make that diagram?)
AmiLobe: Yes, I think that is what I am going for. I'm not really understanding how you are doing this though (I'm new to electronics) , could you possibly make a circuit diagram? Also, is there a way to take the output of that circuit into a clear binary number you could use to determine which photoresistors are below a certain resistance?
sparkylabs: I'm just trying to avoid multiplexing, seeing if I can do it like this.
And I might be trying to go about this all wrong. Should I just use multiplexing? Is there an easier way you can think of?
Thanks,
James D.
"If the current going through me is below x amount, allow y amount
Well not current but look at a voltage comparator, that has a threshold voltage you set and the output is in one state if the input is above the threshold and the other state if below it. Look at the LM339.
Pito you are at it again. Photo transistors are not just on or off so there is no way to distinguish the output between the left hand being partially on and the right hand being fully on.
why not use a load of high precision resistors in series and then use a switch for each to connect to an analogue input. Then you need to effectively write a multiples window comparator program (your expected voltage +/- something to account for tolerance and temp drift).
I used the principle to make an electronics key but i used two window comparators
Digital pins have threshold voltages they must pass to change from LOW to HIGH and HIGH to LOW. One caveat being that the LOW to HIGH threshold is higher than the HIGH to LOW threshold but that can be designed around.
So always measuring LOW to HIGH with different resistors attached to each pin in a Port, it would be be possible to "flash read" as many bits as you can read at once. Not that each pin resistor would have to be selected carefully as resistors have tolerance and you can bet that not every digital pin trips at exactly the same voltage.
The smarter move, as sparylabs describes, is setting different value resistors on your keys and reading what comes through using analog read. You can check each one and use those values in your sketch to decide which key is pressed. Be sure to have a range of values for each key, not just the one value your check got as returns will vary, which you can also test for. You can save time on such a setup by buying an R2R ladder and using that.
And each one has a resistor which from left to right is 2x the last. Each one will output a different voltage when IR light is on it because of the different resistor, if the IR light is the same strength for all.
I don't quite understand where light comes into this.
qazxvy:
So I am attempting to make a resistor ladder type thing to be the input for a keyboard instrument
Why? We're in the digital age. An input shift register makes much more sense.
how does a shift register help ? analogue input is one way of making one of many selections, providing you don't need more than one at once its a good way of saving input pins. I've often wondered why we don't use memory block capable of storing 4-8 voltages but i guess it's cheaper to make one bit 2 level cells than multilevel cells that require more complictated circuitry.
sparkylabs:
how does a shift register help ?
If it's an input shift register like the 74HC165 then it helps a lot.
http://www.arduino.cc/en/Tutorial/ShiftIn
sparkylabs:
analogue input is one way of making one of many selections, providing you don't need more than one at once its a good way of saving input pins.
Shift registers can be cascaded - you can read as many input switches as you want with just three Arduino pins.
so you add another IC that needs as many inputs as you needed if you did it "neat" with the arduino
sparkylabs:
so you add another IC that needs as many inputs as you needed if you did it "neat" with the arduino
Probably more than 1 for a musical keyboard, but:
a) It works! (Did we get the resistors and variablre voltage working yet?)
b) It will probably take take less space than all the resistors and components needed to get it working "neat".
See how hard it will be to make a single pin analog solution recognize multiple inputs at once.
yes there will come a point where a dedicated chip will be needed if it is many keys, like i said we have limited information, if it is something like 8 keys the a resistor ladder can be ealiy used, hec you have 6 inputs and can scale it up but there probably will be a point where a dedicated chip will work better as at that point you will also be using a grid input that needs less IC inputs
GoForSmoke:
See how hard it will be to make a single pin analog solution recognize multiple inputs at once.
yes it would come with the condition that only one key at a time can be used, but the equivalent solution on dedicated IC's will have a similar problem