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

Steps

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

RaspberryPiBoot

  • 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

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s