RGB circuit help - Page 1
Forum section: electronics / beginners

author: undescriptive
author_rank: Newbie
timestamp: July 16, 2018, 02:25:58 pm
content: Hi everyone!I'm looking to try and create a circuit that will allow me to run an RGB (high power 3x3W or 4x3W - so at least 3A preferably cope with upto 5A) LED.This in it's self is easy enough - I have used a latching switch and dip switches (with relevant resistors) on the +ve side of the LED to be able to change colours.My next complication would be to add some kind of momentary switch to be able to change the colour to a different selectable colour.This should not be additive i.e. LED could be Red+Blue(pink) and then switch to Red+Green(yellow) not to white.I would like this to be made of all discrete components - no microcontrollers!I have a kind of working solution (see attached image), but it's not great, too many diodes! the diodes have been put in place to prevent some weird feedback that I don't understandI have been going round and round in circles trying to work out what I can do to get this to work.This will be running from an 18650 battery - 3.7v 3000mAh power sourceany help would be great!Thanks for reading!

author: Zero999
author_rank: Super Contributor
timestamp: July 16, 2018, 02:53:53 pm
content: Please post a proper electrical schematic, rather than a cartoon. It's not easy to follow because it doesn't provide any information about the switch contacts or the transistors.

author: Nitrousoxide
author_rank: Regular Contributor
timestamp: July 16, 2018, 04:16:38 pm
content: From what I can see from the illegible diagram (please use a proper CAD/CAE program), the circuit will not work.Quote from: undescriptive on July 16, 2018, 02:25:58 pmIf you want to cycle between colours, you will need some form of a state machine. This can be achieved through the use of flip-flops (or binary counters) and discrete logic.For example, you would need 7 states to cover all possible combinations (R, G, B, R+G, R+B, G+B, R+G+B).Do you have any experience in logic design?Clearly, after the logic stage there will be a power stage, this may simply consist of resistors and NPN BJT's.

author: Ian.M
author_rank: Super Contributor
timestamp: July 16, 2018, 04:51:46 pm
content: Three 74HC4067 16:1 analog switches( one each for R,G and B), with as many groups of three presets as you want different colours, rigged as potential dividers, each group feeding R,G and B control voltages to the Yn'th 'way' of the corresponding analog switch, with their Z (common) terminals feeding voltage controlled PWM generators driving low Vgs threshold MOSFETs for R, G and B.If you don't want full coulourspace analog RGB, omit the PWM generators and replace the pots with DIP switches + pullup resistors.In either case, you need logic to select the desired colour by applying a 4 bit binary number to the S3:S0 address pins of the '4067 chips (in parallel). This could be a counter, either clocked by an oscillator if you want it to change automatically, or by a pushbutton. If you want a button that changes to a different set of colours when held, wire it direct to all the S3 pins with a pullup resistor.However it would be a whole lot easier using a 3.3V 8MHz Arduino Pro Mini, with three PWM outputs controlling the MOSFETs, three pots fro R G and B level, and a few buttons to control storing and playing a colour sequence

author: undescriptive
author_rank: Newbie
timestamp: July 16, 2018, 04:56:38 pm
content: Hi everyone,Hopefully this should clear things up a little (see attached pic)unfortunately, I can't install any cad software on this machine.I'm not trying to hold logic states - just jump between 2 different "paths" - the dip switches will control the colour of each pathDoes that make any more sense?I have seen many circuits for changing between 2 different LEDs, but they don't cover what to do if it's the same LED packageIf there is anything else I can clarify, please let me know!This circuit does work, however, I'm sure there is a much better way of doing this that I'm just not seeing!I have limited experience in designing circuits (I'm much better at code) so if someone was to totally rebuild this from scratch, I wouldn't be opposed. I'm willing to learn where I'm going wrong!Thanks again!

author: Ian.M
author_rank: Super Contributor
timestamp: July 16, 2018, 05:39:26 pm
content: If you are serious about making this work properly, your circuit has too much voltage drop in the diodes and transistors so you'll have major problems driving the blue LED which has the highest Vf unless the battery is fully charged.Time for a total rethink, based on three MOSFETs to control the LEDs and possibly also with OPAMPs + sense resistors to regulate the current through them to maintain constant brightness when on with minimal voltage drop. Then your circuit only has to generate a pattern of gate control voltages to select the colours to display. A 74HC4053 triple SPDT analog switch would be your friend for that, wired as a three pole two way switch, controlled by the button and selecting between two groups of DIP switches.Edit: corrected part number

author: undescriptive
author_rank: Newbie
timestamp: July 17, 2018, 09:20:09 am
content: Hi everyone,Thanks for the suggestions so far, but the suggestions so far are overkill!the LED will only have 2 manually set states (hence the dip switches) and the momentary switch should "flash" the other state, then return to the "default" state.Nothing needs to be stored, the second state just needs to be momentarily triggered.My main issue is that I need to use the same LED (common cathode) for both states.Does that help clarify it any better?Would a monostable multivibrator do what I'm after here?Thanks!

author: hamster_nz
author_rank: Super Contributor
timestamp: July 17, 2018, 09:39:06 am
content: The problem would be easy to solve if you had a 74LS157 IC available to you.It is a quad 2:1 multiplexer, allowing it to switch the 4-bit output between two 4-bit inputs.However you would still need 7 resistors, to act as either pull-down or pullup resistors, so component count would be much the same.

author: CJay
author_rank: Super Contributor
timestamp: July 17, 2018, 10:04:30 am
content: The DIP switches won't handle 3 amps for long before they start to smolder.Seriously, program a small microcontroller if you're a software guy and have it control a MOSFET constant current sink.

author: undescriptive
author_rank: Newbie
timestamp: July 17, 2018, 10:29:12 am
content: Hi,If the LEDs would sink all of that current, would the dip switches still have issues?especially if the dip switches are on the positive side of the LED?Each LED will sink 1A (on a single die) and are heatsinked.Ignoring the high power for now, and assuming that there is just a standard common cathode RGB LED, how would you switch between 2 different colours momentarily when a button is pressed?Preferably using only discrete components and nothing more "clever" than a transistor/mosfetThanks again!

author: Ian.M
author_rank: Super Contributor
timestamp: July 17, 2018, 10:35:57 am
content: Quote from: hamster_nz on July 17, 2018, 09:39:06 am74LS logic wont work reliably if powered direct from a single cell LiPO as its minimum specified Vcc is well above the 3.0V to 4.1V range (mostly below 3.7V) the cell will provide.74HC logic is specified to operate correctly with Vcc between 2.0V and 6.0V so is well suited to running direct from a single cell LiPO.However with a 74HC157, you'd still need the seven pullup resistors. The 74HC4053 triple SPDT analog switch I suggested earlier could do the same job with only four pullup resistors, one on the control pins (connected together) and the others on each switch common pin. However it does have the disadvantage of a fairly high On resistance when operating at 3.0V, so the pullups would need to be at least 10K and the control transistors for the LEDs would need to be low Vgs threshold P-MOSFETs (for a common cathode RGB LED).

author: Ian.M
author_rank: Super Contributor
timestamp: July 17, 2018, 10:51:08 am
content: Quote from: undescriptive on July 17, 2018, 10:29:12 amThe dip switches certainly wont be specified for 1A so will fail. They may even melt after you've operated them a few times.Quote from: undescriptive on July 17, 2018, 10:29:12 amIts already been described to you several times - use a low Vgs thrshold P-MOSFET to feed each individual LED in the RGB LED, with all their source pins connected to +batt. You'll still need some sort of current limiting so you don't blow up the LED or MOSFETs. Cheap and nasty would be a series resistor between each MOSFET drain and its LED anode.Then you just have to switch the MOSFET gate voltages, which can be very low current. Put a 10K pullup (to +batt) on each MOSFET gate and they will default to off. Pull one down to ground and its LED will turn on.Its *MUCH* easier to use a MCU or logic chip, but if you insist on fully discrete, it can be done. Connect the gates to two banks of dip switches via Schottky diodes, and use a SPDT push button to ground the common of one bank, but swap to grounding the common of the other bank when pressed. Without a SPDT pushbutton its a bit harder - the button can ground one bank direct, but the other must be driven by a N-MOSFET, acting as an inverter with a 10K pullup on its gate and the button between gate and ground.Don't even think about trying to do it with BJTs - it would be a whole lot messier with a far higher component count.

author: hamster_nz
author_rank: Super Contributor
timestamp: July 17, 2018, 11:09:46 am
content: Quote from: Ian.M on July 17, 2018, 10:51:08 amOh, just saw they are wanting to switch high power LEDs, not a 3mm or 5mm RGB LED like in your graphic - missed that on the first read. Switching that sort of load actually requires a real design and careful engineering, not just playing with the bits you might have to handEither that or just buy a compatible LED controller that allows switching between preset colours, It will cost you far less in money, time and effort.

author: StillTrying
author_rank: Super Contributor
timestamp: July 17, 2018, 12:48:04 pm
content: You could simplify it quite a bit by limiting the choice to just 3 colours each, when viewed by themselves there's often not a lot of difference between green/yellow or blue/cyan anyway.

author: undescriptive
author_rank: Newbie
timestamp: July 20, 2018, 10:12:13 am
content: So, I did a bit more playing and I'm pretty sure this will work - forgive the bad eagle cad layout, I'm just learning itThe transistor types are wrong as I couldn't find the ones I'm going to use in EagleCad.NPN should be: SS8050DBU -https://uk.rs-online.com/web/p/products/7390307P/PNP should be: SS8050DBU -https://uk.rs-online.com/web/p/products/7390325/the colours for the LED are selected by the dip switches and they trigger a further NPN to turn on the high power LED (there is a deliberate spare channel)This tests fine, does anyone see anything glaringly obvious that would cause issues?Thanks!

author: Ian.M
author_rank: Super Contributor
timestamp: July 20, 2018, 10:38:48 am
content: Problems from left to right:S1 connects to wrong end of R1 so it shorts the battery!.The combination of T1's Vbe drop and the Vbe drops of T2-T4, means the maximum voltage to the LEDs with S1 open will be Vbatt-2*Vbe. 2*Vbe will be about 1.4V, so even with a fully charged LiPO, there will only be 2.7V at the LEDs. With the battery discharged to 3.0V there will only be 1.6V at the LEDs. As the typical Vf of a blue LED is around 3V, it will barely illuminate with a fresh battery..With S1 closed, the drop is Q7's Vce, + the Vbe drops of T2-T4. At best that will be somewhere around 1V. At worst, as the 10K resistor starves Q7 for base current, it may not be in saturation, so the drop may be worse than the S1 open case..There are no current limiting resistors for the LEDs. If the R and G LEDs Vf is less than 2.7V they will probably blow at switch-on with a freshly charged battery.The *ONLY* way you can make this circuit work prperly is if you use a boost converter to get a higher regulated supply in place of the battery. Don't forget to add the current limiting resistors. If you are happy to settle for a total current well under 500mA, probably the easiest option would be to hack a dollar store USB powerbank - that gets you a battery holder for your 18650 cell, a charge controller for it, over-discharge protection and it boosts to 5V for you. It should be possible to run the LEDs at up to 150mA each, depending on how much the 5V output droops with a 450mA load.