Help with a simple RGB LED project

Hi everyone!

I am building a toy piano for my daughter's 3rd birthday and would like to include button-triggered RGB LEDs to light up when the keys are pressed; 12 different colors, one for every note. The construction is a cinch for me. It's the Arduino/wiring bit that I'm coming here for.

I need help with the schematic/wiring. I have no experience with Arduinos, very little coding (in C#) experience. This seems like a very simple project, but with the limited time I have I've come here to see if anyone would be interested in writing the code for me and guiding me through the schematic (paid, of course).

If anyone is interested, please reach out! Thank you!

OK here's a stab at it, but keep in mind I'm a noob here too, so bear with me. Maybe you could put in a bunch of switchs, one for each key. Then in the arduino loop() function you can check the state of the switch and see which ones are "on". The LEDs can be controlled with 2 HC595 shift registers (each one can handle 8 outputs to turn on or off the LEDs, you said you have 12, so you'll need 2 shift register ICs). Once you've determined which LEDs are "on" then just write that out to the shift registers. There's a bunch of tutorials on youube and here about how to use the 595s, and you'll basically have 2 8 bit binary numbers that you need to create based on what switchs are turned on. So bit 1 is LED 1, bit 2 is LED 2, etc. You'll end up with a number like b00001001, so that would indicate that LED 1 and LED 4 are turned on.
Hope this helps

Ah, thanks for this tip! I think the shift registers are the way to go, and your approach to programming it is clever.

PM sent

There is another possibility. Assuming the LED is common cathode. Each of the R, G, B connections goes through a resistor to the positive supply. The cathode goes to the switch and to an Arduino input. The three resistors are selected according to the color for the key.

If the LED is common anode, the switch is between the anode and positive supply, resistors to ground.

You can use potentiometers instead resistors if you want to tune the colors by hand. This would allow you to construct the LED and switch assembly identically for each key.

Do you have the sound part already under control? Playing multiple tones at the same time?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.