Multicolour LED with PWM

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

 

I am going to be getting some samples of the following  LED.

 

It has RGB and W in one package.

 

My power source will be 12V.

 

Would it be possible to control the power to the LED using PWM, so that we could mix the colour in the RGB spectrum? I will use a MOSFET for the switching.

 

 

 

 

 

 

 

 

Thanks

Regards

DJ

Last Edited: Wed. May 12, 2021 - 04:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your link provides a datasheet - have you looked at it?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, i have read it, but would like to know has anyone worked on such type of application.

 

Based on the datasheet it is possible.

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go on - PWM is the standard way to control LEDs

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

djoshi wrote:
I will use a MOSFET for the switching.

For RGB, three MOSFET'S will be required. No? Also three PWM channels.

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Heisen wrote:
For RGB, three MOSFET'S will be required. No? Also three PWM channels.

Make that four channels if you want to control the white as well as RGB.

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, 4 MOSFETs . To limit max current I will also place a resistor in series with each LED.

Thanks

Regards

DJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or get a proper LED controller chip ...

 

burning power in resistors for high-power LEDs like this is not a great idea ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. May 13, 2021 - 07:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While this was more about testing that I could read an encoder than about the RGB LED it's the simple kind of setup where you can experiment with "color control":

 

https://www.youtube.com/watch?v=...

 

Of course this was a low current LED which is why it can be driven direct from Arduino pins (with limiting resistors!) but I'd suggest mocking up something like this so you can cycle each of R/G/B through various values and see what the combination looks like. One thing that was fairly obvious from this is the non-linearity of the PWM value versus LED brightness so you will probably want some kind of log to linear translation table in there somewhere.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
non-linearity of the PWM value versus LED brightness so you will probably want some kind of log to linear translation table in there somewhere.

Indeed - see: https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
you will probably want some kind of log to linear translation table in there somewhere.

Best site to generate your gamma table. https://victornpb.github.io/gamma-table-generator/

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heisen wrote:
Best site to generate your gamma table. https://victornpb.github.io/gamm...
Nice link - I may have use for that in another life! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Nice part. I would.look for an appropriate driver ic to run it. How many are you going to use? What is the intent of the project? Are you looking to drive multiple leds simultaneously with the same color and intensity, or individual control?

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That looks interesting. Once i get something up and running, i can fine tune it a  look up table.

 

My PCB is going to have SAM device, and i will have some PWM channel that i aim to use.

There will be only 1 per PCB, each LED with its own PWM channe and FET.

Thanks

Regards

DJ