Using an LED driver to fire keys on a toy keyboard

Hey all,

So I have this awesome toy keyboard I found and I opened it up to find a fairly straight forward situation. All the keys find their way into the circuit board in an orderly fashion and I found that you simply need to supply a positive voltage of 3.3v to the key connections to make a note play. Obviously I'm thinking of making Arduino play the keyboard, which seems simple enough (analogWrite(pin, 168) ??) but since there are 24 keys I'd like to have a driver do the work seeing as how I have so many lying around. It's my understanding though that the driver ( TLC5940 ) brings each output pin to ground, rather than spitting out voltage like an Arduino pin. How might I go about making this work?

Best,
G

transistors

optoisolators aka Optocoupler would be my solution.
a whole lot of transistors would get messy.

prismspecs:
Hey all,

So I have this awesome toy keyboard I found and I opened it up to find a fairly straight forward situation. All the keys find their way into the circuit board in an orderly fashion and I found that you simply need to supply a positive voltage of 3.3v to the key connections to make a note play. Obviously I'm thinking of making Arduino play the keyboard, which seems simple enough (analogWrite(pin, 168) ??)

analogWrite() doen't produce analog voltages, it outputs 5V PWM signals.

prismspecs:
but since there are 24 keys I'd like to have a driver do the work seeing as how I have so many lying around. It's my understanding though that the driver ( TLC5940 ) brings each output pin to ground, rather than spitting out voltage like an Arduino pin. How might I go about making this work?

You need something like a 74HC595 with voltage dividers to produce 3.3V from each pin.

An 8-Bit Shift Register 74HC595 might solve the problem.

Sounds like a shift register is the way to go, no?

Shift register is a great way to expand outputs. A cmos (like 4094) part will run on and output 3.3 volts so you don't need level translation on the outputs. You may need a voltage divider on the serial input to the shift register to drop the arduino 5 volt output. And it will only cost 2 or 3 pins to get your 24 outputs.

Thanks for the help. One more thing… when I drive the key with a tap of the 3.3v output pin on the Arduino it plays the key normally, but when I write a digitalOut HIGH to the key it sort of ramps up and then plays this weird metronome sound… is that just because I’m sending too much voltage from the pin? I’ll make a divider next time ;p…

prismspecs:
is that just because I'm sending too much voltage from the pin? I'll make a divider next time ;p...

Probably.

Be careful, you might kill it.

Thanks :open_mouth: I always kill these things........

I always kill these things........

.... and it's out of warranty 8)

As for the voltage divider between the Arduino and the shift register, are you saying that I should use the normal resistor method or use a regulator?

If I use resistors (did this maybe once about a year ago) the equation is Vout = (Z2 / Z1 + Z2) * Vin which leads me to believe that I could use a 500ohm for Z1 and a 1000ohm for Z2, how does that sound? With voltage dividers, does it matter what values you choose in the sense that, as for the equation, I could use a 2ohm for Z2 and a 1 ohm for Z1? Is it better to use higher values?

Thanks

prismspecs:
As for the voltage divider between the Arduino and the shift register, are you saying that I should use the normal resistor method or use a regulator?

Resistors should work, and they're cheap.

prismspecs:
If I use resistors (did this maybe once about a year ago) the equation is Vout = (Z2 / Z1 + Z2) * Vin which leads me to believe that I could use a 500ohm for Z1 and a 1000ohm for Z2, how does that sound?

3.33V is two thirds of 5V.

1000 Ohms is two thirds of 1500 Ohms, that fits.

prismspecs:
With voltage dividers, does it matter what values you choose in the sense that, as for the equation, I could use a 2ohm for Z2 and a 1 ohm for Z1? Is it better to use higher values?

If you only put 3 ohms on an Arduino output more than 40 mA can pass through it. Bad for the Arduino pin.

You need at least 150 Ohms for an Arduino output pin to keep the amps under 40 mA.

Man I need to learn about amps. They elude me.
Thanks!

prismspecs:
Man I need to learn about amps. They elude me.
Thanks!

This is a very useful site... in particular, you may find this to be a good page to start from.

Worked like a charm in a test. Now I have another question that I might end up answering myself but just in case...
Can I just use 3.3v for each of the three v+ pins on the shift register? I'm lookin at this:

Which boils down to... what happens when my data line is 5v and my Vcc is 3.3v?

According to the data sheet for 74HC595 Vcc can be as low as 2Vdc so should work fine at 3.3Vdc.
Make sure it is HC part not HCT cause HTC is 5V. You need to put the voltage divider on the data (serial in) line to get it near 3.3V on a high (like the suggested 1k-1.5k divider).

It turns out just making the rail 3.3v works (for now at least) and my multimeter reads 3.6v~ so shouldn't blow it... right? :slight_smile: Maybe I'll lower it a bit.
Anyway, I succeeded in creating the most annoying thing in the world. I'll refine it ;p Lovin the Arduino and these forums, though. Shift Register FTW, BTW.