0

Guidance on which microcontroller to use
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Guidance on which microcontroller to use

by kevydee on Tue Oct 09, 2018 9:45 pm

I'm trying to create a pretty simple circuit where I have 4 LED diodes and I want one diode to fade in/out, then the next diode to fade in/out and so forth. Can someone point me to what microcontroller I should get and if there's documentation on how to configure this? I'm thinking it will be easier to have each diode on it's own circuit (with each circuit routed back to the microcontroller), so all the microcontroller will need to do is alternate power to each of the 4 circuits. Thanks!

kevydee
 
Posts: 3
Joined: Tue Oct 09, 2018 9:40 pm

Re: Guidance on which microcontroller to use

by adafruit_support_mike on Wed Oct 10, 2018 12:44 am

You don't need any external circuit.. just a microcontroller.

It's kind of tricky to control the brightness of an LED by controlling the voltage or current through it directly, so we generally use Pulse Width Modulation (PWM) to get better control over them.

PWM is really just a process of turning the LED on and off quickly (around 100Hz), with the brightness being controlled by the ratio of the time it's lit to the time it's not. The human eye can't see things blink that quickly, so to us, an LED that's lit for 1 microsecond per millisecond looks like a constant, dim glow.

Microcontrollers are good at creating on/off pulses of varying widths, so a microcontroller can fade LEDs in and out all on its own. Most microcontrollers have built-in PWM generators, so all you have to do is tell the pin the ratio you want and it will do the rest.

The ATmega family of 8-bit microcontrollers can handle 30mA per GPIO pin, which is enough to light an LED brightly. A board like the Metro Mini or the ItsyBitsy 32u4 would probably work for you:

https://www.adafruit.com/product/2590
https://www.adafruit.com/product/3677

adafruit_support_mike
 
Posts: 54079
Joined: Thu Feb 11, 2010 2:51 pm

Re: Guidance on which microcontroller to use

by kevydee on Wed Oct 10, 2018 8:53 am

Thank you, that's very helpful. For the 2 boards that you recommended, can you confirm that I can have multiple LEDs fading at different times (for a shimmering effect)? I found this online for how to configure the fading function: https://programmingelectronics.com/tuto ... alogwrite/. Are there any resources on Adafruit for how to program such a function or do you think the link above suffices?

kevydee
 
Posts: 3
Joined: Tue Oct 09, 2018 9:40 pm

Re: Guidance on which microcontroller to use

by adafruit_support_bill on Wed Oct 10, 2018 9:53 am

Both of those boards have enough PWM pins to fade 4 LEDs. The fade tutorial you linked would be applicable to both of those processors.

adafruit_support_bill
 
Posts: 70447
Joined: Sat Feb 07, 2009 10:11 am

Re: Guidance on which microcontroller to use

by kevydee on Fri Oct 12, 2018 5:13 pm

Great, thanks again for the guidance!

kevydee
 
Posts: 3
Joined: Tue Oct 09, 2018 9:40 pm

Please be positive and constructive with your questions and comments.