Pulsating LEDs with Nano

Hello,

first: I am a total beginner so please excuse my ignorance of the electrical stuff.

For a project i want to have 2 segments of pulsating LED's.

Because of the size i thought of using a "Nano" type of microcontroller with 6 PWM-ports. It would be powered by a 9V battery.

One segment would be 3 to 5 white LEDs pulsating all the same (so maybe on one port).

The other segment would be 4 pairs of 2 white LEDs which should be controlled seperately (so maybe 4 different ports).

My Questions are:

  1. Can this be achieved with an Aptotec Nano V3.0 Pro (Org.ATmega328P/ FT232RL, compatible with Arduino) powered by a 9V battery?

  2. What kind of LEDs, resistances and other elements would i need?

  3. What would the wiring look like?

I know a little bit about programming, so writing a simple code for controlling the pulsating via PWM should be no problem.
Answers and explanations would be greatly appreciated, thank you in advance! If for an answer more information is needed, let me know. Sorry for the bad english.

  1. yes
  2. transistor with 270 ohm resistor between Arduino PWM pin and transistor base to sink current thru the various LED. Resistor per LED, value determined by brightness, power source, transistor, and forward voltage of the LED.
    Assuming 9V, Vf of LED of 3.5V, Vce of NPN transistor of 0.7V, and 20mA of current (really bright at full PWM):
    (Vs - Vf - Vce)/current = resistor value needed
    (9V - 3.5V - 0.7V)/.02A = 240 ohm
  3. Multiple LEDs can be arranged in strings also.
    (9V - (2 x 3.5V) - 0.7V)/.02 = 96 ohm, use 100 ohm

9v battery will work, but if you're using those rectangular ones like are used for smoke detectors, the battery life won't be all that great (depends a lot on the duty cycle of the LEDs). They're not suitable at all for many projects (anything with a motor, or more than a few LEDs is too much for them), but they should work for this one. A pack of 6 AA batteries will get much, much longer battery life.