element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Controlling LEDs for lighting effects and message boards
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: benmatrix
  • Date Created: 25 Oct 2013 3:14 PM Date Created
  • Views 379 views
  • Likes 1 like
  • Comments 1 comment
Related
Recommended

Controlling LEDs for lighting effects and message boards

benmatrix
benmatrix
25 Oct 2013

One of the great features of Flowcode is it allows you to create firmware for microcontrollers without really having to know much about what's going on down at the machine code level.

 

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 RGB leds to create a mood or custom clothing to take down the club. High power LEDs are now be-coming more and more popular in embedded systems with prices falling as a result.

 

So to get started with using these hi 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 Farnell, It is a Red LED capable of generating 21,000mCD with product code 1814437. Looking at the device datasheet we can tell that the absolute maximum values for forward current are 100mA and forward voltage are 2.4V. It is best not to push the LED too far so maybe drop one or both of the values slightly to allow the LED a bit of tolerance. For this particular LED I will drop the forward voltage to 1.9V and current to 40mA to maintain battery life.  We can now use an LED wizard to design our circuit.

 

LED Calculator Wizard

For this test circuit I am going to make a portable LED light. For this I am going to 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 - 1.9

Diode forward current - 40

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.

 

image

 

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 40mA making for a maximum life expectancy getting on for 190 hours (7.5 / 0.04 = 187.5). Not bad for a luminous intensity of approx 84,000mCD. To control the LEDs you can either use an  PWM peripheral built into the microcontroller or for more channels use a timer interrupt software driven PWM method.

 

image

 

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. We are now pulling 160mA 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.  7.5Ah divided by 160mA results in a life expectancy of 46.8 hours, still fairly impressive for a luminous intensity of up to 168,000mCD.

 

image

 

Which would translate into a circuit like this.

 

image

 

As this circuit uses four channels of output the PWM peripheral onboard the chip is not going to be much use. Therefore 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.

 

RGB LEDs can be used in exatcly the same way but here you essentially have 3 LEDs inside each package which each need to be treated with this level of care. The Red, Green and Blue LEDs inside the package will likely each need different voltages and current to allow for comparible intensities on the output.

 

Attached below is an example Flowcode program to control 4 LED output channels using software based PWM signals. This could be scaled up to provide as many outputs as needed as long as there is enough free I/O on the microcontroller device.

Attachments:
Software_PWM.zip
  • Sign in to reply
  • DAB
    DAB over 9 years ago

    I like it.

     

    It looks like the Flowcode could help people exploit the technology without needing to have an engineer on hand to workout the details.

    It sould work well for simple circuits, but I would still have a EE double check a more complex design.

     

    Cool idea though.

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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 © 2023 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