ANI717 / headless_raspberrypi_setup

Headless Raspberry Pi Setup with Jupyter Lab in Private Network Without Monitor. ROS Melodic, Deep Learning Modules and AWS Greengrass Setup Included. (Animesh Bala, Dr. Li Bai)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Headless Raspberry Pi 4 Setup Without Monitor

Headless Raspberry Pi Setup with Jupyter Lab in Private Network Without Monitor. ROS Melodic, Deep Learning Modules (PyTorch, Torchvision, Pandas, Matplotlib and OpenCV) and AWS Greengrass Setup Included.

Colaborators

Computer Fusion Laboratory (CFL) - Temple University College of Engineering

Table of Contents

Install Raspberry Pi OS on microSD card

Download the latest version of Raspberry Pi Imager from here and install it.
Download Raspberry Pi OS Image 64 bit Raspbian Buster from here.
Install 64 bit Raspbian Buster with Raspberry Pi Imager on a microSD card.

Enable wifi and ssh

Create a file named wpa_supplicant.conf in the boot directory of microSD card.
Open it with a text editor and write the followings. Make sure to replace the wifi name and password of your network.

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1


network={
        ssid="wifi_name"
        psk="wifi_password"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
        id_str="phone"
        priority=9
}

Create a file named ssh in the same boot directory and keep it blank.

Boot Raspberry Pi

Insert the microSD card to Raspberry Pi.
Download PuTTY from here
Open Putty with host name raspberrypi
Login as pi
Password raspberry

Enable ARM I2C Interface

Run following command in PuTTY.

sudo raspi-config

Select Interfacing Options, select I2C and set Yes
Press Tab and select Finish

Setup Jupyter Lab

Run following commands in PuTTY.

sudo apt install git -y
cd ~ && git clone https://github.com/ANI717/headless_raspberrypi_setup
cd ~/headless_raspberrypi_setup/jupyter_setup
chmod +x jupyter.sh && ./jupyter.sh [password]

The IP address (looks like xxx.xx.xx.xxx) can be found from 1st element with following command.

hostname -I

Open Jupytar Lab in a browser from http://xxx.xx.xx.xxx:8888/ (make sure to provide the proper IP address).
Log in with [password], default is raspberry

Add Extra 4GB Swap Memory

Run following commands to add extra 4GB swap memory.

sudo dd if=/dev/zero of=/swap1 bs=1M count=4096
sudo mkswap /swap1
sudo swapon /swap1
sudo bash -c "echo '/swap1 swap swap' >> /etc/fstab"

Reboot with following command.

sudo reboot

Run following command to see total allocated memory.

free th

Install Deep Learning Packages

Run following commands to install PyTorch, Torchvision, Pandas, Matplotlib and OpenCV.

cd ~/headless_raspberrypi_setup
chmod +x deeplearning.sh && ./deeplearning.sh

Or run following commands to install manually.

sudo apt update
sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-yaml libatlas-base-dev -y
export ONNX_ML=1
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
sudo -E python3 setup.py install
python3 -m pip install --upgrade pip
python3 -m pip install torchvision
python3 -m pip install pandas
python3 -m pip install --upgrade Pillow
python3 -m pip install matplotlib
python3 -m pip install opencv-contrib-python

Takes aploximately 8 hours to complete installation.

Install ROS Melodic

Make sure that 4GB swap memory is allocated.
Install ROS Melodic with following commands.

cd ~/headless_raspberrypi_setup
chmod +x installros.sh && ./installros.sh

Takes aploximately 45 minutes to complete installation.

Install ROS 2 Dashing

Follow instructions from https://github.com/ANI717/ros2_raspberrypi64
Takes aploximately 2 hours to complete installation.

Install AWS Greengrass

Install AWS Greengrass with following commands.

cd ~/headless_raspberrypi_setup
chmod +x greengrass.sh && ./greengrass.sh

Reboot with following command.

sudo reboot

About

Headless Raspberry Pi Setup with Jupyter Lab in Private Network Without Monitor. ROS Melodic, Deep Learning Modules and AWS Greengrass Setup Included. (Animesh Bala, Dr. Li Bai)

License:MIT License


Languages

Language:Shell 78.1%Language:Python 21.9%