LED Interfacing With RPi - 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

INTERFACING WITH RASPBERRY

PI
LED
RASPBERRY PI GPIO
 Raspberry Pi B+, 2, Zero or 3

have 40 pins in total

 Raspberry Pi B have just 26 pins

GPIO is your standard pins that can be used to turn


devices on and off. For example, a LED.
 I2C (Inter-Integrated Circuit) pins allow you to connect and talk to hardware

modules that support this protocol (I2C Protocol). This protocol will typically

take up two pins.

 SPI (Serial Peripheral Interface Bus) pins can be used to connect and talk to

SPI devices. Pretty much the same as I2C but makes use of a different protocol.

 UART (Universal asynchronous receiver/transmitter) is the serial pins used to

communicate with other devices.

 DNC stands for do not connect, this is pretty self-explanatory. The power

pins pull power directly from the Raspberry Pi.

 GND are the pins you use to ground your devices. It doesn’t matter which pin

you use as they are all connected to the same line.


GPIO BOARD VS GPIO BCM

GPIO board (GPIO.Board) references the physical


numbering of the pins
For example, the top left pin is 1, and the top right pin 2. It
continues to count upwards as you go from top to bottom until
you run out of pins.
GPIOBCM (GPIO.BCM) is the Broadcom Soc Channel
numbering
For example on the Raspberry Pi 3, the pin below 3v3 is
GPIO2, so the number for this pin is 2 in BCM mode.
LED INTERFACING WITH RASPBERRY PI

Aim: Programming of Raspberry Pi to control LEDs


attached to the GPIO pins

Requirements:
Raspberry Pi Module with monitor
and keyboard-mouse,
Serial to HDMI cable,
Male-to-Female jumper wires,
Breadboard,
LED light,
Resistors (between 300 and 1K Ohm)
CIRCUIT DIAGRAM
 The anode of the LED is connected to the 3.3V supply pin of the
Raspberry Pi through the 1KΩ resistor.
 The cathode of the LED is connected to GPIO25 (Physical Pin 22).
CIRCUIT PRINCIPLE

 The principle of operation is very simple.


 The GPIO pin (GPIO25) is made HIGH
for a second and is made LOW for the next
second.
 This process is kept on loop so that we get
effect of Blinking LED.
PROCEDURE
 Turn off your Raspberry Pi
 Connect the circuit as shown in circuit diagram

 Turn on Raspberry Pi

 Write a Python Program in Python IDE platform


and save it
 Debug the program

 If no error occurs then Run the Program and see


the LED.
 Change Blinking time of LED and again run the
program.
CODE

You might also like