Getting Started with Raspberry Pi

Getting Started with Raspberry Pi

Resistors are ubiquitous in electronics and arguably the first “real” electronic component we will be dealing with. They are the little pill-shaped stripe-y things found on most circuit boards. Over the course of this lesson we will learn the concept of resistors, how to make one for your own understanding are and why they are so colorful.

The Raspberry Pi is credit card sized small computer. It has a processor, RAM, USB ports to plug a keyboard and a mouse, HDMI port to plug a TV or monitor, and you can even connect it to the internet.

You can do most things you do with a regular computer like web browsing, document editing, playing games, coding and much more.

A great way to get started with electronics and the Raspberry Pi is hooking up a LED and blinking it using a Python script. This guide will take you through setting up the circuit, connecting it to the Raspberry Pi and how to write the Python script that provides the functionality of blinking.

Things You Need

  • Breadboard for prototyping
  • Light Emitting Diodes (LEDs)
  • Resistor
  • Jumper Wires
  • Raspberry Pi
  • HDMI Cable
  • Mouse
  • Keyboard
  • SD Card (Pre-Installed Raspbian)
  • Laptop/PC

Polarity Of LED

  • Negative Side of LED is flat and is always shorter in length.
  • Positive side of LED is rounded and is always longer in length.


Raspberry Pi Pinout

The image below provides an understanding of the pinout labelling. Raspberry Pi pins are labelled in two ways, i.e. the GPIO pinout labelling and Physical pin labelling. The physical pin labelling is highlighted in different colored circle starting from 1 and ending on 40 in the image below. You can also see the GPIO pinout labelling.


Circuitry of LED blink is pretty simple, you just have to connect the electronic component with raspberry pi properly as shown in the picture.

  • Connect resistor with the cathode of LED as shown in the image.
  • Connect resistor through jumper wire (represented in black color) with PIN 6.
  • Connect positive leg of LED with PIN 12 (GPIO 18). 


Open Python 3 (IDLE). You will find this under the ‘Programming’ label in ‘Menu’. Go to the ‘File’ in IDLE, click ‘New File’, and start writing the code provided below in the new file. Look at the following code:

Here’s an explanation of what is happening in code:


  1. Addressing the pins- You can either use physical pin labelling or the GPIO labelling to address the raspberry pi pins. We are using the method of GPIO labelling. In our code we have used “GPIO.setmode(GPIO.BCM)” command which refers to the GPIO labelling.


  • Initialization the Output Pin- The “GPIO.setup(18,GPIO.OUT)” command on line 5 initializes the output pin for LED blink functionality. We have set the GPIO18 as an output pin. The anode of LED is connected to this pin.


  1. The Infinite Loop- There is a while loop which executes for the infinite time on line 7. In while loop we are instructing the Pi to hold the ‘on’ and ‘off’ state to achieve the blinking of LED. This whole set of instruction will repeat for the infinite time because the condition of while loop is set to ‘True’. In result of this execution we will notice the blinking of LED.


Leave a Reply

Your email address will not be published. Required fields are marked *