1
\$\begingroup\$

I want to replicate lighting a 1:87 scale police car with the aid of an Arduino Pro Micro ATmega32U4 powered by a 90mAh 3.7V LiPo which is connected to a TP4056 5V Lipo battery charger which is connected to the Arduino. [Battery -[connected to]-> charger -[connected to]-> Arduino]

enter image description here

I want to power the following

  • 8 blue 0402 leds (2 leds in parallel/pin - 4 pins) - sirens
  • 4 white 0402 leds (2 leds in parallel/pin - 2 pins) - headlight PWM @ 125
  • 4 red 0402 leds (2 leds in parallel/pin - 2 pins) - rearlights PWM @ 125
  • 4 amber 0402 leds (2 leds in parallel/pin - 2 pins) - sidemarkers PWM @ 125
  • 4 amber 0402 leds (2 leds in parallel/pin - 2 pins) - blinkers (2 leds for left & 2 for right)

But if all of the 24 leds are powered on the amount of current drawn from the micro-controller will be 24*20mA = 480mA. Which will burn up the Arduino in an instant.

Question:

  1. How to set up the circuitry to light up 0402 leds as in the 1:87 car so that the Arduino won't get damaged?

  2. How would they have designed the circuitry for leds on the car like the one in 1:87 car?

\$\endgroup\$
  • 1
    \$\begingroup\$ Can you post your schematic? \$\endgroup\$ – Lior Bilia Feb 14 at 10:47
  • 3
    \$\begingroup\$ Do you even need 20 mA per LED these days? Modern LEDs can still be quite bright even in the single-digit mA. \$\endgroup\$ – Richard the Spacecat Feb 14 at 10:53
  • \$\begingroup\$ @LiorBilia add the circuitry for the arduino/battery/charger the leds \$\endgroup\$ – 3kstc Feb 14 at 11:24
  • \$\begingroup\$ @RichardtheSpacecat how would I control the mA with the arduino? I thought the leds will draw as much mA the want :/ \$\endgroup\$ – 3kstc Feb 14 at 11:26
  • 1
    \$\begingroup\$ @3kstc Use resistors to limit the current. \$\endgroup\$ – Richard the Spacecat Feb 14 at 11:28
0
\$\begingroup\$

Assuming your voltage regulator is generously dimensioned (check what current it can deliver), you drive the LEDs from the internal board supply plane (5V), not from the ports. You can place an octal buffer driver or individual BJT between the MCU and the LEDs. It just needs to be fast enough to handle the PWM frequency, which shouldn't be an issue.

(Other options if low on available pins are shift registers or a LED matrix circuit.)

In addition, individual series resistors from the supply voltage to get the desired current. LEDs are traditionally rated at 20mA but you likely don't need that high current unless they are low quality. Aim for <5mA, depending on LED brightness. It will vary with LED color, as different colors give different forward voltages.

With 24 x 5mA you might very well be within the allowed maximum total current spec of the MCU - check the manual. In which case you could drive the pins from the ports and only need the resistors.

\$\endgroup\$
0
\$\begingroup\$

Max output current is 20mA per pin (you should check this on the data sheet, but I'm fairly sure). Each LED or group of LEDs should be connected to its own output port (I imagine you want the lights to flash in fancy sequences just like a real police car), as long as each port is below 20mA you shouldn't have any issues, so choose a resistor for each to limit the current below 20mA. If you want them all controlled from one port and all come on at the same time use a transistor buffer type configuration and have the LEDs power come direct from the battery rather than through the arduino port.

\$\endgroup\$
  • \$\begingroup\$ Can't I just have them in parallel? For example 6 orange leds at Vf=2.2V, using a current restricting resistor of 1500 ohms >> (5V-2.2V)/1500 = 1.8mA, 1.8mA x 6 leds = 11.2mA. This should be ok right? Since 11.2mA is < 20mA \$\endgroup\$ – 3kstc Feb 15 at 11:47
0
\$\begingroup\$

The chip can support 400mA on its IO in total; be sure to observe the limits of Notes 3 & 4 of Table 29.1 on pages 383-384:

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf

  1. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

    1.)The sum of all IOL, for ports A0-A7, G2, C4-C7 should not exceed 100mA.

    2.)The sum of all IOL, for ports C0-C3, G0-G1, D0-D7 should not exceed 100mA.

    3.)The sum of all IOL, for ports G3-G5, B0-B7, E0-E7 should not exceed 100mA.

    4.)The sum of all IOL, for ports F0-F7 should not exceed 100mA.

If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

  1. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

    1)The sum of all IOH, for ports A0-A7, G2, C4-C7 should not exceed 100mA.

    2)The sum of all IOH, for ports C0-C3, G0-G1, D0-D7 should not exceed 100mA.

    3)The sum of all IOH, for ports G3-G5, B0-B7, E0-E7 should not exceed 100mA.

    4)The sum of all IOH, for ports F0-F7 should not exceed 100mA.

Your total of 120mA across 24 IO pins should not be a problem.

\$\endgroup\$
  • \$\begingroup\$ What ports on the Arduino would these ports equate to (eg A0-A7, G2, C4-C7)? Also I'll be supplying 120mA across 12 pins not "120mA across 24 IO pins ", or possibly now that I have a better understanding, with a current limiter resistor of ~750ohms - i'll supply 5mA to 3 LEDs in parallel per Arduino Pin, totally 15mA still lower .than the max 20mA. 24 LEDs / 3LEDs per pin = 7 pins of the arduino will be used. \$\endgroup\$ – 3kstc Feb 14 at 22:02
  • \$\begingroup\$ Mapping can be found here cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/… \$\endgroup\$ – CrossRoads Feb 14 at 23:34
0
\$\begingroup\$

I would use a smaller more efficient ATtiny PCB.
I would use a 3V boost buck voltage regulator for the supply.
I would use Luxeon C LEDs. (PC amber for the amber)
I would use a TI TLC5940 16 channel LED driver for the blinking and flashing LEDs.
I would use resistors for the steady on LEDs.

Typically 0402 blue and red LEDs are not very bright even at 20 mA. For a battery powered LEDs, efficacy (lm/Watt) is very important. I find high power LEDs to be very bright at 10 mA. Forward voltage will be well below 3V.

Using a 5V supply for 2V and 3V LEDs is very inefficient.

I would consider using 4 red and 4 blue for the light bar. The TLC5940 has 16 outputs.

You will only need one data signal from the ATtiny for the TLC5940.


To compare the Luxeon C to your LEDs:

  • You will likely have to convert the 85° temperature of the Luxeon to 25°

  • You may need to convert Luxeon lumen to mcd. 25 lm = 8,000 mcd @ 120°

    Example: the 35 lm red equals a 1,000 mcd @ 120°

This is 3 high power deep (royal) blue at 10 mA.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.