1
\$\begingroup\$

I have to make a traffic light for a school project and I decided to use a PICAXE-20X2 microcontroller which has 8 output pins. I have 10 LEDs for the red, amber & green lights, 10 also for the red and green man, 10 for the walk and the same for the wait sign. I have connected the 10 for each pin in parallel and a maximum of 20 LEDs will be on at a time. I want to know if this will work?

\$\endgroup\$
  • \$\begingroup\$ The maximum current from an output pin is 20 mA, so you probably require transistors between the chip output pins and your groups of LEDs. \$\endgroup\$ – Peter Bennett Dec 23 '15 at 20:31
  • \$\begingroup\$ Thanks! That is a very helpful idea. Could you explain this a bit further? \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 21:07
  • \$\begingroup\$ Is it essentially a relay \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 21:16
  • \$\begingroup\$ Peter's idea would use a transistor as a power switch to connect the LEDs to an appropriately robust power source - this way, you can control almost any arbitrarily large amount of power provided the transistor can withstand the current and is biased properly. To get more immediate feedback, ping users with the "@" symbol - in this case, @PeterBennett alerts his account that you are writing to him directly. \$\endgroup\$ – Sean Boddy Dec 23 '15 at 21:23
  • \$\begingroup\$ @SeanBoddy Would i have to use a darlington pair? \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 21:35
1
\$\begingroup\$

Since the maximum output current for a PICAXE pin is 20 mA, you will need a driver transistor between the PICAXE and each group of 10 LEDs.

Something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

The value of the resistors in series with the LEDs should be selected to produce the desired current in the LEDs (not too close to the Absolute Maximum rating!)

The transistor can be any NPN type that can handle the total current of the 10 LEDs.

If you use a separate power supply for the LEDs, its ground must be connected to the transistor's emitter, and to the PICAXE ground.

\$\endgroup\$
  • \$\begingroup\$ rapidonline.com/pdf/82-0668e.pdf \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 22:44
  • \$\begingroup\$ Would that be a suitable componenet \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 22:44
  • \$\begingroup\$ Also, would it just be a single driver per output pin \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 22:47
  • \$\begingroup\$ The ULN2803A would be a good choice - it can handle 500 mA maximum, per output (but I'd try to keep under ~450 mA). If you need more than 450 mA for a group of LEDs, then you should use two (or more, as needed) channels of the ULN2803A. The ULN2803A includes a base resistor on each input, so R4 in my drawing is not needed. \$\endgroup\$ – Peter Bennett Dec 23 '15 at 22:52
  • \$\begingroup\$ With the ULN2803A would i just connect the picaxe output to a pin on the left hand side and the right hand side to the LEDs \$\endgroup\$ – Hasan Imtiaz Dec 23 '15 at 23:31

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.