Hi guys.
I was recently working on my Linux machine and it started going slow. First thing that came to my mind was “looks like we are running out of RAM”. I opened up the CPU and RAM monitor to confirm my hypothesis. That’s when the thought of making a vitals monitor for a headless Raspberry Pi first hit me and an idea was born.
Let’s get started.
Step 2: Required Items
The following is a list of required items:
- Raspberry Pi + WiFi dongle or Raspberry Pi 3
- Raspberry Pi power supply
- 16 GB microSD card
- microSD card reader
- 126×64 SPI OLED display
- Female to female jumper wires
You will also need a laptop or a PC to setup and access the Raspberry Pi.
Step 3: Flash Raspbian to Your MicroSD Card
Description: First thing we need to do is flash Raspbian on a microSD card. So head to www.raspberrypi.org and download latest version of Raspbian and extract it from the zip file. Now insert an empty microSD card in the microSD card reader. Connect the microSD card reader to your laptop or PC. Bring up the etcher application and burn the extracted Raspbian image on your microSD card.
Step 4: Configure Raspbian for WiFi and SSH
Description: To configure WiFi, open up a terminal on a Linux machine and become root user, cd into Raspbian’s root directory. If you are on a Windows machine, open up Raspbian’s root directory as administrator. Modify file /etc/network/interfaces as shown in the first image, i.e. change lines for wlan0 to:
auto wlan0
iface wlan0 inet dhcp
This will allow your router to assign a random IP address to your Raspberry Pi, but we haven’t specified SSID and password for your router, right. The /etc/wpa_supplicant/wpa_supplicant.conf file lets us do exactly that. Look at the second image.
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid='-----'
psk="--------"
key_mgmt=WPA-PSK
}
To enable SSH which we will use to securely access headless Raspberry Pi. Create an empty file called ‘ssh’ in boot directory of Raspbian.
Finally, unmount microSD card from your machine and take it out from the card reader to put it in Raspberry Pi.
Step 5: Connect OLED to Raspberry Pi
Description: Connect SPI OLED display to your Raspberry Pi according to attached image.
Step 6: Finding IP Address of Raspberry Pi
Description: Once OLED is connected to the Raspberry Pi, power on the Raspberry Pi. As we have enabled DHCP, the router will assign a random IP address depending on availability to Raspberry Pi. To securely access a headless Raspberry Pi, we will use SSH for which we will need IP address of Raspberry Pi. To find the IP address of the Raspberry Pi, use applications like angry IP scanner which scans your network for active devices. The attached image shows angry IP scanner showing the IP address of a Raspberry Pi.
For more detail: Raspberry Pi Vital Monitor via OLED