Author Topic: RGB circuit help  (Read 2111 times)

0 Members and 2 Guests are viewing this topic.

Offline undescriptiveTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
RGB circuit help
« on: July 16, 2018, 02:25:58 pm »
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 understand

I 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 source

any help would be great!
Thanks for reading!
« Last Edit: July 16, 2018, 02:28:49 pm by undescriptive »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20003
  • Country: gb
  • 0999
Re: RGB circuit help
« Reply #1 on: July 16, 2018, 02:53:53 pm »
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.
 

Offline Nitrousoxide

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: RGB circuit help
« Reply #2 on: July 16, 2018, 04:16:38 pm »
From what I can see from the illegible diagram (please use a proper CAD/CAE program), the circuit will not work.

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!

If 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.
« Last Edit: July 16, 2018, 04:19:31 pm by Nitrousoxide »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: RGB circuit help
« Reply #3 on: July 16, 2018, 04:51:46 pm »
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
 

Offline undescriptiveTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
Re: RGB circuit help
« Reply #4 on: July 16, 2018, 04:56:38 pm »
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 path

Does 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 package

If 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!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: RGB circuit help
« Reply #5 on: July 16, 2018, 05:39:26 pm »
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
« Last Edit: July 17, 2018, 10:23:39 am by Ian.M »
 

Offline undescriptiveTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
Re: RGB circuit help
« Reply #6 on: July 17, 2018, 09:20:09 am »
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!
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: RGB circuit help
« Reply #7 on: July 17, 2018, 09:39:06 am »
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.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline CJay

  • Super Contributor
  • ***
  • Posts: 4136
  • Country: gb
Re: RGB circuit help
« Reply #8 on: July 17, 2018, 10:04:30 am »
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.
 
The following users thanked this post: tooki

Offline undescriptiveTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
Re: RGB circuit help
« Reply #9 on: July 17, 2018, 10:29:12 am »
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/mosfet

Thanks again!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: RGB circuit help
« Reply #10 on: July 17, 2018, 10:35:57 am »
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.

74LS 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).
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: RGB circuit help
« Reply #11 on: July 17, 2018, 10:51:08 am »
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.
The dip switches certainly wont be specified for 1A so will fail.  They may even melt after you've operated them a few times.
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/mosfet

Thanks again!
Its 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.
« Last Edit: July 17, 2018, 01:45:36 pm by Ian.M »
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: RGB circuit help
« Reply #12 on: July 17, 2018, 11:09:46 am »
Its 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 do 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 woul be a whole lot messier with a far higher component count.

Oh, 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 hand :D

Either 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.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: RGB circuit help
« Reply #13 on: July 17, 2018, 12:48:04 pm »
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. >:D
« Last Edit: July 17, 2018, 12:49:40 pm by StillTrying »
.  That took much longer than I thought it would.
 

Offline undescriptiveTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
Re: RGB circuit help
« Reply #14 on: July 20, 2018, 10:12:13 am »
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 it

The 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!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: RGB circuit help
« Reply #15 on: July 20, 2018, 10:38:48 am »
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.
« Last Edit: July 20, 2018, 10:43:21 am by Ian.M »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf