element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
  • Settings
Community Hub
Community Hub
Member's Forum As a designer, how do you make choices?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Community Hub to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 23 replies
  • Subscribers 533 subscribers
  • Views 1860 views
  • Users 0 members are here
  • LED driver
  • designer choices
Related

As a designer, how do you make choices?

dougw
dougw 1 month ago

A very common practice when designing with MCUs is to dedicate at least one MCU pin to drive a diagnostic or indicator LED.

There are several simple circuits that can accomplish this function. I am curious to know if  most designers use the same circuit, and if not, why not? 

Edit by cstanton : I liked this post so much I decided to elevate it to Question of the Month for August (Close enough for UK time zone anyway!)


Leave a comment that explains how it came about that you use a particular circuit.

  • Sign in to reply
  • Cancel

Top Replies

  • rsc
    rsc 1 month ago +4
    I usually have a 2-pin header(s) somewhere for power supply(s) voltage(s) that I can put a LED jumper with a resistor on it. That way I don't have to have a LED on all the time, just for diagnostics.
  • scottiebabe
    scottiebabe 1 month ago +2
    modern leds are blindingly bright with just a few mA.
  • genebren
    genebren 1 month ago +1
    I have been using NeoPixel Mini 3535 RGB LEDs as my go to indicator on my boards. At < $0.20 in quantity of 100, it is cheap enough, and the RGB capability gives me a bit more flexibility.
Parents
  • genebren
    genebren 1 month ago

    I have been using  NeoPixel Mini 3535 RGB LEDs as my go to indicator on my boards.  At < $0.20 in quantity of 100, it is cheap enough, and the RGB capability gives me a bit more flexibility. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw 1 month ago in reply to genebren

    Cool method. How many lines of code does it take to make it indicate something?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • genebren
    genebren 1 month ago in reply to dougw

    Coding in 'C' it takes about 18 lines of code to send the serial string to the NeoPixel, which I do with a bit-banged IO port (pin).  There is an additional overhead to build the string, which is 3 lines of code for each color intensity change.  The programming string is 24 bits, for the 3 LED intensities, GRB ordering, 8 bits each. The timing is pretty critical, so the code must run with interrupts off (or at least make sure that the code can run without being interrupted).  A 'zero' is .2 to .4 us high time, while a 'one' is .58 to 1.0 us.

    Doing this with bit-banged IO, there are some changes to the code that need to be made to account for the microprocessor clock speed.  As the clock speed increases, you need to add additional 'NOP' commands to keep the clocking rates correct.

    Sure, it is easier to just toggle a pin, but using smaller microprocessors, pin are at a premium.  Being able to 'blink' in different colors is a nice added feature.  Also, the NeoPixels are daisy chainable, so multiple LEDs can be driven off the same pin.

    I have a client that wanted 256 level programmable RGB LEDs for his project and theses are cheaper that other approaches.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • genebren
    genebren 1 month ago in reply to dougw

    Coding in 'C' it takes about 18 lines of code to send the serial string to the NeoPixel, which I do with a bit-banged IO port (pin).  There is an additional overhead to build the string, which is 3 lines of code for each color intensity change.  The programming string is 24 bits, for the 3 LED intensities, GRB ordering, 8 bits each. The timing is pretty critical, so the code must run with interrupts off (or at least make sure that the code can run without being interrupted).  A 'zero' is .2 to .4 us high time, while a 'one' is .58 to 1.0 us.

    Doing this with bit-banged IO, there are some changes to the code that need to be made to account for the microprocessor clock speed.  As the clock speed increases, you need to add additional 'NOP' commands to keep the clocking rates correct.

    Sure, it is easier to just toggle a pin, but using smaller microprocessors, pin are at a premium.  Being able to 'blink' in different colors is a nice added feature.  Also, the NeoPixels are daisy chainable, so multiple LEDs can be driven off the same pin.

    I have a client that wanted 256 level programmable RGB LEDs for his project and theses are cheaper that other approaches.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • dougw
    dougw 1 month ago in reply to genebren

    And of course after you have done the code once, you can reuse it on any project without re-inventing it ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • genebren
    genebren 1 month ago in reply to dougw

    That is so true.  I have used this same code (with timing modification) is several products/projects.  I really try to re-use code wherever possible.

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