0
\$\begingroup\$

First time poster here. I have an Arduino Uno project that will require 8 RGB LEDs to be controlled. They will be turned on and off with pushbuttons, cycling through red, then green, then blue, then turn off. Multiple LEDs will have to stay on together at times, too. It's going to be part of an electronic lock, so basically a keypad that, instead of having keys, has coloured LEDs as a password input. However I am not using a physical Arduino, I'm doing it in the 123D Circuits environment (made by AutoDesk), so I'm limited as to what parts I can use.

I ran across Charlieplexing and Multiplexing, as well as using transistors and shift registers, as possibilities. The problem is that I haven't had any electronics classes yet, so I have no idea which is better/more suitable/even possible, specially regarding wiring the parts together, and how they communicate with my project, so that's what is making it difficult for me to understand, or even begin to code.

I followed this guide to try wiring 4 RGB LEDs. However they're common anode LEDs, and mine are common cathode, and as I've said, I have no idea how to figure the electronics (I can't even read schematics without getting lost at what am I supposed to be reading there).

Here's how I tried wiring it: http://postimg.org/image/gu4cwdv0n/full/ following the guide's instructions. (it may be absurdly difficult to see what is happening due to the awful graphic interface for wire jumpers in the platform there)

It didn't work with the code provided, so I assumed it's my wiring that is the problem.

EDIT -- I have 8 pins that can be used to those LEDs. Also, if there is no alternative to Charlieplexing, could someone explain or compare how it is different in RGB LEDs to normal LEDs? I believe I could understand it better that way, since I think this is what is troubling me: the common cathode, as opposed to 3 cathodes in 3 multi-coloured LEDs.

Thanks in advance.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Seems to me like you're running head-over-heels into a project that is a bit too complex for your current abilities. Why don't you start with 1 RGB LED and control that. Learn to read a schematics but start with the very simple ones. You can try whateverplexing but if you don't understand how it works, you're not going to make it work by yourself. So start with something more simple and learn from that. When you understand the basics, solving what you want now will be so much easier. \$\endgroup\$ Jul 5, 2015 at 20:22
  • \$\begingroup\$ I know that very well, haha. If only my teacher thought so as well. It's my first informatics class in University, but he decided to start working with Arduino. I can already control one RGB LED. I can control as many RGB LEDs as I have pins. What I don't understand are exactly the whateverplexings. \$\endgroup\$
    – JayMWS
    Jul 5, 2015 at 20:37
  • \$\begingroup\$ A couple of comments on your Fritzing drawing: The cathodes of the common cathode LEDs should go directly to the Arduino ground, without a resistor. You have red wires connected to the Arduino 5V and GND. Traditionally, we use black for ground, and red for a positive power supply - you will avoid confusing yourself and others if you stick with this tradition. \$\endgroup\$ Jul 5, 2015 at 20:38
  • \$\begingroup\$ @PeterBennett Well I just did it the way the person who wrote the Instructable I linked said to do. I believe that it has something to do with Charlieplexing, and how it works with the tri-state logic. That's why I didn't use the usual color coding. I think I should add something to my post, as well... \$\endgroup\$
    – JayMWS
    Jul 5, 2015 at 20:44
  • \$\begingroup\$ Charlieplexing LEDs with common pins is much more difficult than with separate anodes and cathodes. You may want to use a shift register or I/O expander instead. \$\endgroup\$ Jul 5, 2015 at 20:58

2 Answers 2

1
\$\begingroup\$

The easiest way to control that many RGB LEDs is to use a strip of LEDs that already include their own controller, such as the WS2812B. In addition, there are libraries for many of the models of "addressable" LEDs already available. From there it's simply a matter of instantiating an object for the correct number of LEDs, setting them to the desired colors, and then invoking the correct method to configure them all at once.

NeoPixel Stick

light_ws2812

\$\endgroup\$
2
  • \$\begingroup\$ Unfortunately none of those are available at 123D Circuits, and, as I said, I must work in the virtual environment (my University does not have enough Arduino kits for all classes and my teacher jumped ahead to try and teach us "basics") \$\endgroup\$
    – JayMWS
    Jul 5, 2015 at 20:40
  • \$\begingroup\$ Ah, so you're not actually building it, you're just simulating it. \$\endgroup\$ Jul 5, 2015 at 20:56
0
\$\begingroup\$

You are connecting all LED's to one Pin of the Arduino? That can go very wrong, as the Arduino max. current is 40mAh per Pin. You should rather use a transistor, which works like a digital switch. When the base get a signal, it switches. If you want to adress every LED individually you may use a LED with integrated controller, like the WS2812 or use a shift register (like the 74hc595) Link. The site also contains a circuit diagram on how to wire the shift register and leds. personally, i dont see any reason to multiplex the leds when you use 8 or less.

common cathode or anode are just for simplicity. when you would use normal led's you have 6 pins (3 times anode and 3 times cathode). But you would just control one pin (either cathode or anode) it wouldnt be necessary to have rgb leds with 6 pins. So the manufacturer either connects all cathodes or anodes together, which gives them their naming: common cathode or anode. with a common anode, you would connect the common pin (often the longest pin) with a series resistor to a voltage source and the other pins to ground to light them up. which means when you use digitalWrite(PIN, LOW) it lights up. With a common Cathode LED you connect the long pin (cathode) to ground and every anode (the other pins) get a series resistor and you need to pull them high to light them up ( connect them to a votlage source). so with digitalWrite(PIN, HIGH) they light up.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.