element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Controlling High Powered LEDs using Flowcode
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: benmatrix
  • Date Created: 25 Jun 2015 1:49 PM Date Created
  • Views 740 views
  • Likes 2 likes
  • Comments 1 comment
  • brightness
  • efficient
  • control
  • led
  • microcontroller
  • high
Related
Recommended

Controlling High Powered LEDs using Flowcode

benmatrix
benmatrix
25 Jun 2015

LED’s have always been a staple component in programming microcontrollers, they are most commonly used as indicators that elements of a program are functioning correctly. However, more people are realising that high powered LED’s have a multitude of uses beyond the simple applications of their lower powered brethren. In this article we show you how to design your circuit to utilise these functional devices.

 

A very simple way of determining if a microcontroller is behaving correctly is through the use of LEDs. This could take the form of a simple “on light” to let you know there is power going to the device through to displaying binary numbers to indicate traffic on a communications bus. High power LEDs are now becoming more and more popular in embedded systems with prices falling as a result.

 

Here are a number of simple applications that could be created simply by using high power LEDs combined with a bit of ingenuity.

  • Multicolour lamp
  • Hi-power spotlight
  • Portable camping light
  • Propeller clock
  • PC/ Car illuminations
  • Hydroponics grow systems

  

So to get started with using these high-power LEDs you first have to work out exactly what the LEDs need to be able to do.

  1. Do the LEDs need to be a single colour or multicolour?
  2. Do the LEDs all need to be the same brightness or should they be individually controllable?
  3. Do the LEDs need to dim or are they constantly on?
  4. What power source am I going to use to drive the LEDs?

  

Firstly I am going to show you how to design a circuit to allow you to control the LED up to its full potential brightness without risking damage. Consider this device from rapid electronics, It is a Red LED capable of generating 20,000mCD with product code 55-2476. Looking at the device datasheet we can tell that the absolute maximum values for forward current are 50mA and forward voltage are 2.6V. It is best not to push the LED too far so maybe drop one of the values slightly to allow the LED a bit of tolerance. For this particular LED I will drop the forward voltage to 2.5V.

 

We can now use an LED wizard to design our circuit, such as this. For this test circuit I am going to make a portable LED light. For this I would use a 12V lead acid battery to allow me to produce a long lasting bright light. So I put the following details into the calculator.

  • Source voltage – 12
  • Diode Forward Voltage – 2.5
  • Diode forward current (mA) – 50
  • Number of LEDs – 4

 

This generates a basic schematic to allow me to drive the LEDs at full brightness. Note that in this configuration all of the LEDs are tied together so only one control line is required. In other configurations it is best to remember that the resistor will always make your circuit less efficient so the more LEDs you can combine into a single channel the more efficient your circuit will be.

 

image12.png

 

The LED wizard also tells me the current that the circuit is going to draw so I can calculate a rough estimate of how long my battery will last when powering the circuit. My battery is a 7.5Ah battery and my LED circuit consumes 50mA making for a maximum life expectancy getting on for 150 hours (7.5 / 0.05 = 150). Not bad for a luminous intensity of approx 80,000mCD (4 x 20,000mCD).

 

To control the LEDs you can either use an onboard PWM peripheral or for more channels use a timer interrupt software driven PWM method. The image below shows a transistor connected to the microcontroller output, allowing us to switch the LEDs on/ off from our program. Only when we activate the microcontroller output will the transistor switch on, allowing current to flow, and thus switching the LEDs on.

 

image22.png

Here is another example using the same LEDs but in a single configuration. Notice that the supply voltage has been changed to better suit the configuration of the LEDs (6V). We are now pulling 200mA through the circuit due to the increase in the number of resistors, however we also have much more control over the LEDs as we can control each pair of LEDs separately. Our battery has 7.5Ah, therefore when we divide this by 200mA we calculate a life expectancy of 37.5 hours, still fairly impressive for a luminous intensity of up to 160,000mCD.

 

image32.png

The above calculation would translate into a circuit like this, requiring 4 microcontroller outputs, similar to the previous example, but allows us to turn each of the 4 branches individually from 4 microcontroller outputs;

 

image41.png

As this circuit uses four output channels, the PWM peripheral onboard the chip is not going to be much use.

 

Therefore we have created an example demonstrating how to get around this. We need to use the software approach of creating the brightness control signal. To allow the software approach to work at low speeds such as 4MHz without flicker, I have reduced the scale of the PWM from 0-255 to 0-63. This allows for a good flexibility of control at low speed without flicker. At a faster clock speed a larger resolution of control can be achieved without flicker.

 

To calculate the refresh period of the LED you would use the following equation.

 

( ( Clock speed / 4 ) / Timer_Period ) / Resolution = Refresh rate (Hz).

 

Which works out as follows.

 

( ( 4MHz / 4 ) / 256 ) / 64 = 61Hz refresh rate.

 

Have a look through the provided flowchart here, and see if you can understand how we have made a software controlled PWM component.

 

We’ve reached the end of this article. Hopefully you have an insight into how to maximise the LEDs in your circuit. If you have any comments, feel free to comment below.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 10 years ago +1
    Nice post on assessing different types of LED implementations. DAB
Parents
  • DAB
    DAB over 10 years ago

    Nice post on assessing different types of LED implementations.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 10 years ago

    Nice post on assessing different types of LED implementations.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube