EveryCircuit
Contact
Reviews
Home
prayerny
modified 5 years ago

Arduino - How to light an led on a digital pin with the least amount of current.

2
17
200
02:53:33
Power an led from a digital pin using the least amount of milliamps. Credit goes to Robert Kidd for his help on this circuit. Thank you Robert.
published 5 years ago
akashspawar
5 years ago
tried using a current limiting resistor?
wyoelk
5 years ago
Leds in this app are configured at 2v and 20 ma....so 12v-2v=10v....10v÷20ma=500 ohms. Hope that helps
prayerny
5 years ago
Thank you
prayerny
5 years ago
How many milliamps are being drawn at the base of the transistor?
Robert_Kidd
5 years ago
Change led current limiting resistor to 470 Ohm for reason stated above. However, if you construct this circuit, LED’s these days are very bright you could easily get away with 10mA. As you obviously realise the real issue is the current taken from the 5V digital side and you can reduce this considerably. The transistor gain default on EC is 100 but in real life you are more likely to have a gain of, say, 300. Now, for a collector current of 20mA (for your led) you need a base current of 20mA/300. The base resistor will have a volt drop of 5-0.7=4.3V. Therefore base resistor =(4.3x300)/.02=64.5 kOhms, so use nearest preferred value of 62 kOhms.
Robert_Kidd
5 years ago
Don’t forget to increase the transistor gain to 300. This reduces the 5V current from >4mA down to <100uA.
Robert_Kidd
5 years ago
Finally, I would add a 1 MOhm resistor from transistor base to ground. This is to stop the transistor base ‘floating’ when the switch is in the open position.
Robert_Kidd
5 years ago
Obviously you can recalculate the base resistor value according to the gain of the transistor you choose to use in a real life circuit.
Robert_Kidd
5 years ago
I hope this helps.
prayerny
5 years ago
Wow thank you Robert, quick question how do increase the transistor gain to 300? I am new at electronics.
prayerny
5 years ago
Robert Kidd assisted with the circuit modification, problem solved.
Robert_Kidd
5 years ago
I see you sorted it but you need to make the base resistor 62000 Ohm, you have 62 Ohm.
Robert_Kidd
5 years ago
You’re very welcome. Pleased to have helped.
Robert_Kidd
5 years ago
Oh, just noticed, the 1MOhm resistor should go directly to the transistor base.
prayerny
5 years ago
What transistor would you recommend in real life situation Robert?
Robert_Kidd
5 years ago
Any general purpose / switching transistor would do. 2N3904, ZTX108, BC547 are a few examples but almost any npn transistor will do for the quite low currents and voltages you are dealing with. Incidentally, you will see that transistors can have quite a wide range of gain, say 100-500, so for your purposes just assume you’re getting the lowest and use a base resistor value of, say, 10kOhm. This will still only draw less than 0.5mA from your 5V supply.
prayerny
5 years ago
Thank you again

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2026 by MuseMaze, Inc.     Terms of use     Privacy policy