Created by
Created June 05, 2012
Last modified July 13, 2012
Tags gpio   led   output   raspberry-pi   rpi  


Circuit showing how to control an LED from a Raspberry Pi GPIO pin configured as an output.


This circuit shows to turn an LED on and off using a GPIO pin configured as an output.

R1 limits current through the LED. If the voltage drop across the LED is 2V then voltage across the resistor is 3V. So current is 3/560 = 5.4mA.

R2 limits current from the GPIO pin. GPIO is either 0v or 3.3V so max current into base of transistor is 3.3/27000 = 120uA.

The transistor could be a BC547, BC548 or equivalent.

I have tested this circuit and it works fine.

Please visit my Raspberry Pi website for further information


Can the raspberry pi not supply 5mA on a GPIO pin?

by addy771
October 28, 2012

The Raspberry Pi can power LEDs directly from the GPIO Pins but this technique is useful as it allows you to power a range of other devices such as buzzers and motors. So this circuit isn't the best method for powering an LED if that is your only objective but it useful for experimenting.

by MattHawkins
October 29, 2012

If you only use a few outputs you can power the LED directly. If you however use 17 GPIO pins as output pins you can only use 3mA per pin since the total current used cannot be over 50mA. Good practice is to not use more than 2mA per pin.

by edp
January 24, 2013

Leave a Comment

Please sign in or create an account to comment.

Revision History

Only the circuit's creator can access stored revision history.