LED BLINKING USING RASPBERRYPI
Introduction Raspberry Pi is an ARM architecture processor based board designed for electronic engineers and hobbyists. The PI is one of most trusted project development platforms out there now. With higher processor speed and 1 GB RAM, the PI can be used for many high profile projects like Image processing and Internet of Things.
LED Blinking Using RaspberryPI Blinking is done by connecting an LED to one [Here in our Program PIN 25] of GPIO pins of PI and turning it ON and OFF.
As shown in the Previous figure, there are 40output pins for the PI. But when you look at the second figure, you can see not all 40 pin out can be programmed to our use. These are only 26 GPIO pins which can be programmed. These pins go from GPIO2 to GPIO27. These 26 GPIO pins can be programmed as per need. Some of these pins also perform some special functions, we will discuss about that later.
With special GPIO put aside, we have 17 GPIO remaining (Light green Cirl). • Each of these 17 GPIO pins can deliver a maximum of 15mA current. And the sum of currents from all GPIO cannot exceed 50mA. • So we can draw a maximum of 3mA in average from each of these GPIO pins.
Components Required: • Here we are using Raspberry Pi 3 Model B+ with Raspbian OS. • Connecting pins • 220Ω or 1KΩresistor • LED • Bread Board
Circuit Explanation: As shown in the circuit diagram we are going to connect an LED between PIN40 (GPIO25) and PIN39 (GROUND). As said earlier, we cannot draw more than 15mA from any one of these pins, so to limit the current we are connecting a 220Ω or 1KΩ resistor in series with the LED.
Working Explanation: Since we have everything ready, turn ON your PI and go to the desktop.
1. On the desktop, go the Start Menu and choose for the PYTHON 3, as shown in figure above.
2. After that, PYHON will run and you will see a window as shown in Above figure
3. After that, click on New File in File Menu, You will see a new Window open
4. Save this file as LED.py in /home/pi
After that write the program for LED as given in next Slide and execute the program by clicking on “RUN” on ‘DEBUG’ option. If the program has no errors in it, you will see a “>>>”, which means the program is executed successfully. By this time you should see the LED blinking three times. If there were any errors in the program, the execution tells to correct it. Once the error is corrected execute the program again.
Code:-
CODE.py import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(25, GPIO.OUT) while True: GPIO.output(25, GPIO.HIGH) time.sleep(1) GPIO.output(25, GPIO.LOW) time.sleep(1)

LED Blinking Using Raspberry Pi

  • 1.
  • 2.
    Introduction Raspberry Pi isan ARM architecture processor based board designed for electronic engineers and hobbyists. The PI is one of most trusted project development platforms out there now. With higher processor speed and 1 GB RAM, the PI can be used for many high profile projects like Image processing and Internet of Things.
  • 3.
    LED Blinking UsingRaspberryPI Blinking is done by connecting an LED to one [Here in our Program PIN 25] of GPIO pins of PI and turning it ON and OFF.
  • 4.
    As shown inthe Previous figure, there are 40output pins for the PI. But when you look at the second figure, you can see not all 40 pin out can be programmed to our use. These are only 26 GPIO pins which can be programmed. These pins go from GPIO2 to GPIO27. These 26 GPIO pins can be programmed as per need. Some of these pins also perform some special functions, we will discuss about that later.
  • 5.
    With special GPIO putaside, we have 17 GPIO remaining (Light green Cirl). • Each of these 17 GPIO pins can deliver a maximum of 15mA current. And the sum of currents from all GPIO cannot exceed 50mA. • So we can draw a maximum of 3mA in average from each of these GPIO pins.
  • 6.
    Components Required: • Herewe are using Raspberry Pi 3 Model B+ with Raspbian OS. • Connecting pins • 220Ω or 1KΩresistor • LED • Bread Board
  • 7.
    Circuit Explanation: As shownin the circuit diagram we are going to connect an LED between PIN40 (GPIO25) and PIN39 (GROUND). As said earlier, we cannot draw more than 15mA from any one of these pins, so to limit the current we are connecting a 220Ω or 1KΩ resistor in series with the LED.
  • 8.
    Working Explanation: Since wehave everything ready, turn ON your PI and go to the desktop.
  • 9.
    1. On thedesktop, go the Start Menu and choose for the PYTHON 3, as shown in figure above.
  • 10.
    2. After that,PYHON will run and you will see a window as shown in Above figure
  • 11.
    3. After that,click on New File in File Menu, You will see a new Window open
  • 12.
    4. Save thisfile as LED.py in /home/pi
  • 13.
    After that writethe program for LED as given in next Slide and execute the program by clicking on “RUN” on ‘DEBUG’ option. If the program has no errors in it, you will see a “>>>”, which means the program is executed successfully. By this time you should see the LED blinking three times. If there were any errors in the program, the execution tells to correct it. Once the error is corrected execute the program again.
  • 14.
  • 15.
    CODE.py import RPi.GPIO asGPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(25, GPIO.OUT) while True: GPIO.output(25, GPIO.HIGH) time.sleep(1) GPIO.output(25, GPIO.LOW) time.sleep(1)