Skip to main content

Installing An OS!

Step 1: Prerequisite Software Installation

  • Raspberry Pi Imager - You'll use this to install the OS on the PiCar, and change some settings to get it connecting.
    1. Install this for the operating system you're using (Probably Windows).
    2. Once installed, you'll be met with this. Close out for now.image.png
    3. The OS Installation will be completed later, so hold off on configuration for now.
  • Putty - This is used as a remote terminal for the Pi. Because the PiCar will be roaming without a display, this allows easier access and copy/paste. 
    1. Installation should be pretty simple. Just click through the prompts, and use the default settings.
    2. After it gets installed, you can close out of the notepad opened.

Step 2: Let's Get Started! - Install the OS

Are you ready? Let's put some of those prereqs to work!

  1. Open Raspberry Pi Imager
  2. Insert a Micro SD Card to put in the Raspberry Pi for the OS.
  3. The Raspberry Pi Device is "Raspberry Pi 3
  4. The Operating System is "Raspberry Pi OS (Legacy 64-bit) Lite)"
  5. Make sure the storage device is the SD card for the PiCar.
  6. Press "Next", and then Select "Edit Settings"

Copy these settings exactly:

Wifi Passwords In the future, to make these roam long range, the STEM "Travel Router" will be setup.

Replace the hostname "PiCarNum" with PiCar followed by the ID (1,2,3, or 4) Ex: "PiCar2"

For the account password, use STEMROOM6041, This password can only be used when connected to the secure STEM network, so it will not be a problem with security.

image.pngimage.png

You can leave the options tab default.

Step 3: Revving Up The Pi!

  1. You can now remove the SD Card from the computer, and insert it to the Pi.
  2. Insert Batteries, connect Pi Power, and wait for it to start up. Wait 5 Minutes until the next step.
  3. No... I mean it. Set a 5 minute timer, and wait. This is a first startup for the Pi, and you'll have to give it some time to setup the filesystem, and connect to the network.
  4. Make sure the computer you're using is connect to the "StemRoom" network, or all the following steps will not work.
  5. Open Putty
    1. Under "Host Name (or IP address)" Enter the hostname you set before. Ex: PiCar2
    2. Select Open, and wait for it to connect
      1. On the off chance it does not connect, you can try setting the IP address of the car using an app like Fing to scan for the device.
  6. You should now see a screen like this:image.png
  7. Update the Pi - To update the pi, there are two separate, but similar commands you will need to enter. Remember to only type one in at a time, and let it run.
sudo apt update -y
sudo apt upgrade -y

You may be asked for a password during this step. It won't show on the screen, but the input is still there. Type in "STEMROOM6041" and press enter

Now, just reboot the Pi, and the OS will be installed.

sudo reboot now

Step 4: The Nitty Gritty

Now, we'll setup some custom settings and software to get everything running smoothly.

Wi-Fi disaster recovery script.
  1. Open your home directory
    cd ~
  2. Make the script using nano
    nano wifirecover.sh
  3. Paste in the following code by copying the text in the computer, and right clicking on anywhere in the putty window.
    ping -c4 google.com > /dev/null
    
    if [ $? != 0 ]
    then
      echo "No network connection, restarting wlan0"
      /usr/sbin/ifconfig wlan0 down
      sleep 5
      /usr/sbin/ifconfig wlan0 up
    fi
    
    1. Use the keyboard combination Ctrl+X, Then press Y, Then press Enter, to exit
  4. Now, we'll install cron. This lets you schedule tasks for certian times. In this case, it will check for internet connection intermittently.
    sudo apt install cron
  5. Crontab uses a text file for configuration, so we'll open it now.
    sudo crontab -e
  6. Select Nano as the text editor
  7. Add this exact line to the end of the text file by copying in the computer, and right clicking on anywhere in the putty window.
    1 * * * * /bin/sh /home/pi/checkfistats.wifirecover.sh >/dev/null 2>&1
  8. Use the keyboard combination Ctrl+X, Then press Y, Then press Enter, to exit

YIPPPEEEE!!!! Your Operating system is now installed, and ready to install the PiCar Code!!!