We're replacing the entire fingerboard for our MIDI bass, and replacing it with a number of PCB sections. We're basically creating a resistor ladder on the underside of the fingerboard, for each string on the guitar. The idea is that the resistor ladder creates a voltage divider and we take an analogue input from the resistor network into the PIC microcontroller
If all the strings are connected to ground, and all the frets on the fingerboard are connected at different points along the resistor ladder, we should be able to tell which fret the string is being pressed against, and therefore which note to play.
In the example above, if the (grounded) string was held on the second fret, the total resistance between the nut end of the board and the input pin would be quite high - so the voltage divider creates a high voltage on the input pin.
But if the player holds the (grounded) string on, say, the 18th fret, the 5v going through the resistor network goes through fewer resistors between the input pin and ground, causing the voltage on the input pin to drop. With clever use of resistor values, we should be able to create a look-up table in firmware such that we know instantly which string is being held against which fret. No more latency issues trying to sample and decode the frequencies that the strings are vibrating at!
Showing posts with label voltage divider. Show all posts
Showing posts with label voltage divider. Show all posts
Saturday, June 9, 2012
Tuesday, April 26, 2011
How the new shadow harp works

Each of the four analogue inputs as a simple voltage divider.
5V is connected to one side of a light-dependent resistor (LDR), which is wired in series with a resistor to ground. The input signal is taken from between the two resistors.
As the user places their hand over the LDR, the resistance falls, causing the ratio between the two resistors to drop. This variable voltage is fed into an analogue pin, converted to a digital value (0-255) by the microcontroller's ADC hardware and compared to the last value read in.
Even when static, analogue input values tend to "drift" - i.e. float around, +/-1 or +/-2 (so a "constant" value of 128 may actually vary between 126 and 130 over time!)
To overcome this, we take a reading from the analogue pin, compare it to the previous value and if the difference is greater than 2, this represents a genuine change in resistance, which we then process.
In fact, depending on light levels, sometimes it is necessary to adjust this value to 4 or 5, to avoid cross-talk as the user places their hand in a position that influences to LDRs, next to each other. By making this threshold value a variable, we can allow the user to set their own "sensitivity" level for playing the instrument.
In indoor lighting, the LDR inputs typically read around 220.
When you place your hand over an input tube, this value drops to around 205.
Sometimes neighbouring LDR values drop when you place your hand over an input - by setting the sensitivity to 8, in this case, only the sensor with a hand above it actually triggers an input signal.
Triggering inputs is quite simple - if an input value is falling compared to its previous value, this represents the presence of a hand above the input.
When the input value is constant, the hand is still present. When the value is rising, this is the user removing their hand away from the input.
Using Oshonsoft's hidterm DLL and an 8-byte USB buffer, we can send the raw input values AND the trigger values (0 or 1) for four inputs at a time:
Subscribe to:
Posts (Atom)
