DavidMiles1925 / pi_zero_setup

Setting up a Pi Zero the easiest way for me.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of Contents:

Raspberry Pi Zero W (and Zero 2 W):
Materials
Setup Procedure
Other Helpful Proceedures
  Configure a Program to Run on Startup
  Configure a Static IP
Raspberry Pi 4 Model B:
OS Information
System Preferences
  Install Applications
  Set GPU Memory
  Setup Desktop

Setting up Raspberry Pi Zero

Materials

  • Raspberry Pi Zero W or Zero 2 W
  • 20x2 pin header (if header is not included with Pi)
  • MicroSD card - at least 4GB
  • HDMI-to-Mini HDMI Cable or adapter.
  • USB-to-MicroUSB cable or adapter
  • 5V power supply, at least 2.5A
  • Monitor
  • Keyboard

Setup Procedure

  1. Download the Raspberry Pi imager on a separate computer: Pi Imager installation
  1. Follow imager instructions to install Lite OS to flash drive. (32-Bit Laegacy port of Bullseye)
  1. Download ssh file from above (or create a blank file and name it ssh). NOTE: This file has no contents. It's only purpose is to signal to the RPi that SSH should be enabled.
  1. Copy the ssh file to the flash drive.
  1. Remove the flash drive from the computer and place in the Raspberry Pi Zero 2 W.
  1. Connect your peripherals and boot the device.
  1. Once the device boots, follow instructions on screen to set keyboard layout, username, and password.
    NOTE: If there is no video output, but you have a green light, there is likely a problem with the HDMI. See troubleshooting below.
  1. Record username and password somewhere safe.
  1. Configure your Wifi by typing this into the command line:
sudo raspi-config

 Select "System Settings" and then "Wireless LAN"
 The "SSID" refers to the name of your network
 The "psk" is your password.

  1. Set the timezone. From the raspi-config menu, select "4."
  1. Update your device
sudo apt-get update
sudo apt-get upgrade
sudo reboot
  1. Install Git:
sudo apt install git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global credential.helper store
sudo nano ~/.git-credentials
  1. (Optional) Configure Static IP Address >>  This is useful if you want to be able to access your device remotely via SSH.

Other Helpful Procedures

Configure a Program to Run on Startup:

  1. Modify etc/rc.local with admin priviliges:
sudo nano /etc/rc.local
  1. Add this line to /etc/rc.local:
sudo python /home/pi/yourprogram/program.py &
  • Replace pi with your directory

  • Don't forget the & at the end to allow the program to run in the background

  1. Stopping the process:
  • To stop the process, first find the PID number:
ps aux | grep "main.py"
  • Note the number in the second column.

  • Ternimate Process:

sudo kill -TERM ###
  • replace "###" with the number from step 4

Configure Static IP Address:

Link to article on CircuitBasics.com

Summary of Article

  1. Find Gateway info for wlan0:
route -ne

Then find your IP address:

ip addr
  1. Nameserver:
cat /etc/resolv.conf
  1. Take a picture of the screen.

  2. Configure settings:

sudo nano /etc/dhcpcd.conf
  • Add this line to the end of the file:
interface eth0
static ip_address=192.168.1.100
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 2001:558:feed::1 2001:558:feed::2

interface wlan0
static ip_address=192.168.1.101
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 2001:558:feed::1 2001:558:feed::2
  • static ip_address: This is the static IP address you’ll use to SSH or remotely connect to your Pi. Take your default gateway IP (found in the steps above), and change the last number to any other number between 0 and 255.
  • static routers: This is your default gateway IP address.
  • static domain_name_servers: These are the IP’s we found in the resolv.conf file above. Separate each IP with a single space.
  • Set wlan0 differently than etho0

Pi 4 Model B Setup

OS Information

Newest working: Pi OS (Legacy) port of Bullseye 32bit. Use config.txt from the /pi4 directory.

Critical changes to config.txt

Uncomment these lines:

  • hdmi_force_hotplug=1
  • hdmi_group=2
  • hdmi_mode=85 (Able to change to 82 for higher resolution after setup)

Summary:

My Pi 4 was running Buster(*v10*). I had never run Bullseye(*v11*), but Bookworm(*v12*) is now the latest version at the time of writing. I attempted to create a new OS image on a 32GB microSD card (I replicated this process across multiple cards to verify they were not faulty). I tried both Bookworm and Bullseye in both 32 and 64 bit versions. I was repeatedly unable to get video, but was able to verfiy device was booting because green light was active, and my old setup still worked when I put that SD card in the Pi. The config.txt file from Buster did not work with either of the newer versions. I went through many itteratons of trying to get the HDMI working. Ultimately the resolution boiled down to a few of things:

  • The Bookworm system still did not boot with the working config.txt file above. I beleive there is more to this problem than just config.txt.
  • The working config file works with the Bullsye 32-bit setup. The config.txt file located in the /pi4 directry of this repo.
  • The changes listed above seemed to be the fixing changes.

A port to Bookworm has been unsuccessful ths far, unable to get any of my current displays to function with it.

System Preferences

Install Applications

Firefox:

  • Install through OS package installer: Preferences > Add/Remove Software
  • Mozilla Firefox web browser - Extended Support Release (ESR)

Visual Sudio Code:

  • Install through: Preferences > Recommended Software
  • Visual Studio Code
  • After Installing VS Code:
     - Install Python Extension
     - Install Prettier Extension

Set GPU Memory

The default memory (76MB) is fine for most things. Videos will need more at higher resolutions.

  • Preferences > Rasberry Pi Configuration > Performance Tab > GPU Memory
  • Set value to 124. NOTE: Going higher than 128MB can result in failure to boot.

Set up Desktop

Task bar items:

  • Right click on the launch area of the task bar (the icons that are already pinned)
  • Click Application Launch Bar Settings
  • Add Firefox and Visual Studio to the taskbar. Remove Chromium.

Desktop Apearance:

  • Right click on the desktop and click Desktop Appearance.
  • Select background and color scheme. (I like aurora for the background image, and dark green for taskbar.)

About

Setting up a Pi Zero the easiest way for me.