Installing the AutoTester Software

This leads you through the steps to install the AutoTester software on a Raspberry Pi. The installation steps assume a headless install (meaning you don’t need to connect the Raspberry Pi to a monitor).

If you want to upgrade from a previous version of the software, follow the instructions here.

Step 1. Download a fresh image of Raspian Stretch Lite from here:

Step 2. Install it onto a microSD card (Even the Stretch lite version has software bloat so you probably need 16GB) according to the instructions here:

Step 3. Once the Raspian image has been written onto the SD card, you need to set it up so it can be accessed externally. For this you need to do two things: enable SSH so you can control it remotely, and enable WiFi (unless you prefer ethernet)

  1. To enable ssh, create an empty file named “ssh” (no extension) on the boot directory. The boot directory is the one that Windows sees.
  2. Enable wifi according to the instructions here.  Make sure to change the text to your network credentials

Step 4. Insert the microSD card into the Raspberry Pi and power it up. Since it will allocate its IP address using DHCP, you may have to search to find the new device. Once you have identified it, you can SSH to it and start the configuration process. There are various SSH programs available. For Windows the most common program is PuTTY.  Using the Raspberry Pi’s IP address, connect to the Raspberry Pi.  The default username is “pi” and the password is “raspberry”.

Step 5. You may want to set a static IP address for the Wireless Connection. To do so, edit /etc/dhcpcd.conf (sudo nano /etc/dhcpcd.conf). Add the following lines to the bottom of the file and save it (change YOUR_IP_ADDR to your value):

interface wlan0
static ip_address=192.168.1.YOUR_IP_ADDR/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

You can reboot and connect to the static IP address:

Step 6. Use the raspi-config program to set up options (sudo raspi-config). These include:
– Changing the User Password (Menu item 1)
– Changing the Hostname to something descriptive (Menu item 2)
– Changing the Timezone to the correct one (Menu item 4)
– Enabling the Pi Camera (Menu item 5)
– Expanding the File System (Menu item 7)
Reboot afterwards

Step 7. We need to increase the swap size to install the following packages which seem to require lots of memory.  In the file /etc/dphys-swapfile
change to CONF_SWAPSIZE=2048 and then reboot.

Step 8. One of the biggest dependencies we have is the computer vision library OpenCV. Unfortunately,  appropriate versions of the libraries are not available, so we need to compile it. The steps to do this are here.
Start with step #2 of the guide and setup the virtual environment using Python3. Name the virtual environment “cv” as in the guide.
This is the longest step of the install process. A couple of notes to help the process along. Since, you increased the swap size in step 7,
you can perform the make using 4 cores (make -j4 instead of just make). This speeds up the proces. Also, in setting up the virtual environment
where you append the virtualenv path to the ~/.profile file, Add the line: “export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3” before
“source /usr/local/bin/virtualenvwrapper.sh”.

Step 9. We need to install more computer vision, machine learning, and miscellaneous libraries. These are simpler to install, but also take a long time to install.
Make sure you are within the cv virtual environment created above.

sudo apt-get install libboost-all-dev -y
pip install dlib
pip install scipy -v
pip install scikit-learn -v
pip install scikit-image -v
sudo apt-get install screen -y
sudo apt-get install git -y
pip install django
pip install rpyc
pip install schedule
pip install joblib
pip install rpi.gpio
pip install requests
pip install picamera
pip install tzlocal

Step 10. We need to copy in the autotester software. This should be done within the virtual environment (cv)

cd ~
git clone https://github.com/percy9427/AutoTester.git

To launch the program enter:

cd AutoTester/AutoTester
python AutoTester.py

or if you want the AutoTester to continue running even after you log off (such as to run scheduled jobs) enter:

cd AutoTester/AutoTester
screen python AutoTester.py

Previous – Electronics

Next – Operation