Go Down

Topic: Using an LED driver to fire keys on a toy keyboard (Read 4618 times) previous topic - next topic

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) ??) 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

Osgeld

http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

conradin

optoisolators aka Optocoupler would be my solution.
a whole lot of transistors would get messy.
https://www.sparkfun.com/products/784

fungus


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.


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

mixania

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

https://www.sparkfun.com/products/733

prismspecs

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

groundFungus

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. 

prismspecs

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...

fungus


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

prismspecs

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

JimboZA

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


.... and it's out of warranty  8)
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

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?

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

fungus

#12
Mar 21, 2013, 11:37 am Last Edit: Mar 22, 2013, 09:25 am by fungus Reason: 1

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.


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.


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

prismspecs

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

JimboZA


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.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Go Up