One of the  classic electronic analogy to "Hello World"  is to make an LED blink. Raspberry Pi has 8 General Purpose Input/Output  pins( 4,17,18,21,22,23,24,25)  which can be configured as input/output and turned on/off via software.In this Instructable I will be using python to control the LED, as coding in python is very simple yet it's very powerful. RPi.GPIO Python library is used to control the LED from Raspberry Pi.
Remove these adsRemove these ads by Signing Up

Step 1: Hardware setup

Picture of Hardware setup
Place the LED with a 270 ohm resistor in series with the GND and GPIO pin of Raspberry Pi (use a breadboard for hassle free connection). Always use a resistor with LEDs to limit the current, else you might end up with a burnt LED ;)

For complete details & schematics, please visit my blog :-

Step 2: Code

Picture of Code
Python is used to control the GPIO's in Raspberry Pi.

For complete details & code, please visit my blog :-
neontime14 days ago

The forward voltage of a red LED will be around 1.5V minimum, other colours will be higher. So its 3.3 - 1.5 across 270 ohms. The current will be 6mA or less depending on the LED so it's quite safe.

ed.cole.9803 months ago

Do the math please. 3.3V less 0.6 over the LED thru 270ohm is 10mA, which is twice what the GPIO pin can source or sink. Yeah, it will blink for a while, but stress it with this current and it will fry the pin if not the chip. There can be nothing more disappointing than being encouraged to fry your board by someone with such a poor understanding of electronics.

Do your research first.
"an individual GPIO pin can only safely draw 16mA"

ruhliar2 months ago

I made it, thank you.