Sunday 27 September 2020

Simple LED blinking circuit using Raspberry Pi and Python


Raspberry Pi is one of the powerful device invented in this era. During my school days and college days, all the automation circuits and hobby circuits were developed  either directly by soldering components in the generic circuit board or by using a micro controllers like Arduino. The set up and debug effort was more and the programming was limited to Arduino processing language.

With the invention of Raspberry Pi, the possibilities are endless. It is a mini computer with all the facilities of a desktop PC. Users can develop and run any programs as they wish. The device also comes with options to connect to several peripherals and extension circuit boards.

Here I will be explaining a very simple program, like the baby step towards the world of automation using Raspberry Pi. We will use Raspberry Pi to control an LED (Turn OFF and ON).


  •  Raspberry Pi
  • SD Card with Raspbian OS
  • Bread Board
  • Jumper wires
  • LED (2 nos)

GPIO Pins in Raspberry Pi 

A powerful feature of the Raspberry Pi is the row of GPIO (general-purpose input/output) pins along the top edge of the board. Any of the GPIO pins can be designated (in software) as an input or output pin and used for a wide range of purposes. In this example, we are using a python program to control the GPIO pins and turn ON/OFF LED.


Connect negative leg of both LED to PIN 6(Ground), one positive leg to PIN 8 and another positive LEG to PIN 10


Raspbian OS will be having Thonny Python IDE by default, so it’s easy to write and execute python codes in Raspberry Pi 
Install the RPi.GPIO package in the Raspberry Pi. 
       pip install RPi.GPIO

Copy paste the below program in the IDE. Make the connections between LED and GPIO pins as explained in the previous step.

Execute the program. You will see the lights blinking.


No comments:

Post a Comment

How to check the memory utilization of cluster nodes in a Kubernetes Cluster ?

 The memory and CPU utilization of a Kubernetes cluster can be checked by using the following command. kubectl top nodes The above command...