Preparing Raspberry Pi – Part 1 of 3

Raspberry Pi comes in different versions. But all of them after Pi 1 have the same pinout. Raspberry Pi 2,3 can be connected to the internet only using RJ45 cable. RaspberryPi 4 supports both Ethernet and Wifi. Raspberry Pi Zero supports just the WiFi.
This part focuses setting up using Ethernet connection. If you want to install on Raspberry Pi Zero with WiFi, please check here.
Note: The above blog and this has may overlaps about getting data from the sensors.

Let’s start with the installation.
Parts you will need

  1. Raspberry Pi 2/3/4
  2. A USB cable that connects the pi to your PC
  3. An HDMI cable to connects to a monitor. (Pi 4 needs mini-HDMI)
  4. A USB keyboard
  5. A MicroSD card 4GB min
  6. MicroSD card adapter for pc


Install OS

  • The first step is to install OS on the card. Download and run Raspbian Pi Imager for headless install. You will not need the desktop version for this. The setup instructions are for the lite version.
  • In the choose OS
    • Select Raspbian Pi OS (Other)
    • Select Raspberry Pi OS Lite
  • Choose SD Card and click Write.
  • Insert the MicroSD card in the Raspberry Pi
  • Connect the HDMI cable and the keyboard. You can also connect ethernet cable, should you choose.
  • Connect USB cable to your PC or to a power supply.

It will start booting and you will see a screen like this


  • Enter the default user name “pi” and the password “raspberry”

Now you are at the shell prompt.

By default ssh is not enabled. Enable it with the following steps:

  • sudo systemctl enable ssh
  • sudo systemctl start ssh

This should enable ssh. Now you can ssh into it from VS Code itself.

Ensure that Ethernet cable is connected

you may want to make sure that the Raspbian OS is up to date. To get the latest update, run the following command:

  • sudo apt-get update

Install Python3

Raspbian comes with Python 2.7.xx installed (as of this writing). You should uninstall that and install Python 3.
To uninstall Python 2.7.xx, run the following commands:

  • sudo apt-get remove python
  • sudo apt autoremove

Now start installing Python 3 and the packages required for the Device using the following commands:

  • sudo apt-get install python3
  • sudo apt-get install python3-rpi.gpio
  • sudo apt-get install python3-smbus
  • sudo apt-get install -y i2c-tools

Now you are ready to program Raspberry Pi using Python. You can test the installation by creating a .py file using nano editor and trying Hello World.

<Overview                                                 Getting Data from Sensor

Published by: Sameer Khandekar

I am a passionate software engineer who loves to work on Azure microservices, REST API, SDKs, and .NET apps using WPF, Xamarin, and MAUI. The work includes highly scalable geo-distributed services and an authentication library with nearly 500 million downloads. I also had fun integrating with hardware using Bluetooth (BLE). More here:

Categories Azure, AzureIOT, IOT, IOT Hub, Python, Raspberry PiLeave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s