SlideShare a Scribd company logo
www.techvilla.org.in
TECHVILLA
www.techvilla.org.in
www.techvilla.org.in
LED interfacing raspberry pi.
 construct a basic electrical circuit and attach it to your RPi GPIO
pins
 write a simple Python program to control the circuit
www.techvilla.org.in
What You Will Need:
 Raspberry Pi configured with the GPIO library
 1 - small led, any color
 1 - 50 ohm resistor
 Some small-gauge solid core wire
 Breadboard and/or alligator clips to hold connections
www.techvilla.org.in
Setting up circuit.
 Before starting, unplug your RPi.
 Using your assortment of materials, create the circuit on either your
breadboard, or using your alligator clips.
 Pin 1 (+3.3 volts) should go to the longer leg of your led. This pin
provides a steady supply of 3.3v. Unlike the GPIO pins on your RPi,
this pin is not programmable, and cannot be controlled by software.
 Attach the shorter leg of the led to the resistor. Finally, attach the
other end of the resistor to Pin 6 (- ground) on your RPi.
 Power on your RPi - the led should immediately turn on.
www.techvilla.org.in
Circuit Diagram
www.techvilla.org.in
Controlling The Led With Python
 move the positive lead from the 'always on' 3.3v pin to one of the programmable
GPIO pins. Here is what our circuit will look like:
www.techvilla.org.in
Writing Code
 Type : sudo nano program_name.py
 Enter following code:
 import RPi.GPIO as GPIO ## Import GPIO library
GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(7, GPIO.OUT) ## Setup GPIO Pin 7 to OUT
GPIO.output(7,True) ## Turn on GPIO pin 7
 Save file.
 Type python program_name.py to run program.

More Related Content

DOCX
Measurements upload
PPTX
#5 logic probe
PPTX
GCC 2-26-16
PPTX
GCC 2-19-16
PPTX
GCC 2-12-16
PPTX
Safe and Easy Tips to Electrical Fault Finding
PPTX
Raspberry pi Part 17
PPT
EEPROM Part-21
Measurements upload
#5 logic probe
GCC 2-26-16
GCC 2-19-16
GCC 2-12-16
Safe and Easy Tips to Electrical Fault Finding
Raspberry pi Part 17
EEPROM Part-21

Viewers also liked (16)

PPTX
Raspberry pi Part 25
PPTX
Raspberry pi Part 23
PPT
Motor Part 12
PPTX
Rasperry pi Part 9
PPTX
Raspberry pi Part 22
PPT
Light & humidity Part 10
PPTX
Raspberry pi Part 5
PPT
Serial Communication Part-16
PPT
Bluetooth Part-17
PPT
I2C And SPI Part-23
PPTX
Raspberry pi Part 26
PPTX
Raspberry pi Part 1
PPT
Robotics part-1
PPT
RF MODULE Part-15
PPTX
Raspberry pi Part 3
PPT
RFID Part-19
Raspberry pi Part 25
Raspberry pi Part 23
Motor Part 12
Rasperry pi Part 9
Raspberry pi Part 22
Light & humidity Part 10
Raspberry pi Part 5
Serial Communication Part-16
Bluetooth Part-17
I2C And SPI Part-23
Raspberry pi Part 26
Raspberry pi Part 1
Robotics part-1
RF MODULE Part-15
Raspberry pi Part 3
RFID Part-19
Ad

Similar to Rasperry pi Part 13 (20)

PDF
manual_2020_Cyber Physical System.pdf
PPTX
LED Blinking Using Raspberry Pi
PPTX
Raspberry Pi Using Python
PDF
Embedded Systems: Lecture 9: The Pi Control ARM
PDF
RaspberryPi_Workshop and Programming with python.
PPTX
Raspberry Pi Introductory Lecture
PPTX
Raspberry pi
PPTX
EV3PimmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmLight.pptx
PDF
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
PDF
Raspberry Pi 4.pdf
PDF
IoT Physical Devices and End Points.pdf
PPTX
Using arduino and raspberry pi for internet of things
PDF
4. GPIO Access
PPTX
Esp8266 Workshop
DOCX
Raspberry pi, Summer $ Short Term Courses in waayoo.com
DOCX
Shine a little LED
DOCX
embedded report
KEY
Arduino JumpStart
PPTX
Raspberry Pi ppt.pptx
PPTX
Raspberry Pi ppt.pptx
manual_2020_Cyber Physical System.pdf
LED Blinking Using Raspberry Pi
Raspberry Pi Using Python
Embedded Systems: Lecture 9: The Pi Control ARM
RaspberryPi_Workshop and Programming with python.
Raspberry Pi Introductory Lecture
Raspberry pi
EV3PimmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmLight.pptx
Raspberry Pi GPIO Tutorial - Make Your Own Game Console
Raspberry Pi 4.pdf
IoT Physical Devices and End Points.pdf
Using arduino and raspberry pi for internet of things
4. GPIO Access
Esp8266 Workshop
Raspberry pi, Summer $ Short Term Courses in waayoo.com
Shine a little LED
embedded report
Arduino JumpStart
Raspberry Pi ppt.pptx
Raspberry Pi ppt.pptx
Ad

More from Techvilla (15)

PPTX
Raspberry pi Part 24
PPTX
Raspberry pi Part 21
PPTX
Raspberry pi Part 20
PPTX
Raspberry pi Part 19
PPTX
Raspberry pi Part 18
PPTX
Raspberry pi Part 16
PPTX
Rasperry pi Part 15
PPTX
Rasperry pi Part 12
PPTX
Rasperry pi Part 10
PPTX
Rasperry pi Part 8
PPTX
Rasperry pi Part 7
PPTX
Raspberry pi Part 6
PPTX
Raspberry pi Part 4
PPT
WIFI MODEM Part-22
PPT
GSM Part-20
Raspberry pi Part 24
Raspberry pi Part 21
Raspberry pi Part 20
Raspberry pi Part 19
Raspberry pi Part 18
Raspberry pi Part 16
Rasperry pi Part 15
Rasperry pi Part 12
Rasperry pi Part 10
Rasperry pi Part 8
Rasperry pi Part 7
Raspberry pi Part 6
Raspberry pi Part 4
WIFI MODEM Part-22
GSM Part-20

Recently uploaded (20)

PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPT
introduction to datamining and warehousing
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Sustainable Sites - Green Building Construction
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
web development for engineering and engineering
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Lecture Notes Electrical Wiring System Components
PPT
Project quality management in manufacturing
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
R24 SURVEYING LAB MANUAL for civil enggi
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
additive manufacturing of ss316l using mig welding
Current and future trends in Computer Vision.pptx
Foundation to blockchain - A guide to Blockchain Tech
introduction to datamining and warehousing
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Sustainable Sites - Green Building Construction
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Safety Seminar civil to be ensured for safe working.
OOP with Java - Java Introduction (Basics)
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
web development for engineering and engineering
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Lecture Notes Electrical Wiring System Components
Project quality management in manufacturing
Internet of Things (IOT) - A guide to understanding
R24 SURVEYING LAB MANUAL for civil enggi

Rasperry pi Part 13

  • 2. www.techvilla.org.in LED interfacing raspberry pi.  construct a basic electrical circuit and attach it to your RPi GPIO pins  write a simple Python program to control the circuit
  • 3. www.techvilla.org.in What You Will Need:  Raspberry Pi configured with the GPIO library  1 - small led, any color  1 - 50 ohm resistor  Some small-gauge solid core wire  Breadboard and/or alligator clips to hold connections
  • 4. www.techvilla.org.in Setting up circuit.  Before starting, unplug your RPi.  Using your assortment of materials, create the circuit on either your breadboard, or using your alligator clips.  Pin 1 (+3.3 volts) should go to the longer leg of your led. This pin provides a steady supply of 3.3v. Unlike the GPIO pins on your RPi, this pin is not programmable, and cannot be controlled by software.  Attach the shorter leg of the led to the resistor. Finally, attach the other end of the resistor to Pin 6 (- ground) on your RPi.  Power on your RPi - the led should immediately turn on.
  • 6. www.techvilla.org.in Controlling The Led With Python  move the positive lead from the 'always on' 3.3v pin to one of the programmable GPIO pins. Here is what our circuit will look like:
  • 7. www.techvilla.org.in Writing Code  Type : sudo nano program_name.py  Enter following code:  import RPi.GPIO as GPIO ## Import GPIO library GPIO.setmode(GPIO.BOARD) ## Use board pin numbering GPIO.setup(7, GPIO.OUT) ## Setup GPIO Pin 7 to OUT GPIO.output(7,True) ## Turn on GPIO pin 7  Save file.  Type python program_name.py to run program.