Preparing Raspberry Pi SD Cards
Parts
- 1 MicroSD card (min. 64GB, high endurance)
- 1 Raspberry Pi 4B (4GB or 8GB RAM)
- 1 Raspberry Pi Imager software
Tools
This guide provides instructions for preparing Raspberry Pi SD cards for use in the various modules of the autonomous formulation platform. Different modules require different Pi configurations, but the basic flashing process is the same.
Step 1: Materials needed
- Raspberry Pi 4B (4GB or 8GB RAM)
- MicroSD card (min. 64GB, high endurance)
- SD card reader/writer
- Computer with internet connection
- Raspberry Pi Imager software
Step 2: Download and install the Raspberry Pi Imager
- Download the Raspberry Pi Imager from the official Raspberry Pi website.
- Install the software on your computer following the standard installation process for your operating system (Windows, macOS, or Linux).
Step 3: Prepare the SD card
- Insert the MicroSD card into your computer's SD card reader.
- Launch the Raspberry Pi Imager software.
- Click on "CHOOSE OS" and select "Raspberry Pi OS (64-bit)" from the list. This is the standard Raspberry Pi operating system based on Debian.
- Click on "CHOOSE STORAGE" and select your MicroSD card from the list. Make sure you select the correct device to avoid overwriting data on other drives.
Step 4: Configure OS settings before writing
- Before clicking "WRITE", click on the gear icon (⚙️) to access advanced options.
- Configure the following settings:
- Check "Set hostname" and enter the appropriate hostname based on the module:
- For the loader electronics module:
afl-loader - For the UI module:
afl-ui - For the video module:
afl-video
- For the loader electronics module:
- Check "Enable SSH" and select "Use password authentication"
- Check "Set username and password"
- Username:
pi - Password:
[standard password](use your organization's standard password)
- Username:
- Check "Set locale settings"
- Time zone:
[your time zone] - Keyboard layout:
[your keyboard layout]
- Time zone:
- On the second tab, set ssh to "Use password authentication"
- Click "SAVE" to apply these settings.
Step 5: Write the image to the SD card
- Click "WRITE" to begin the process of writing the image to the SD card.
- Confirm the operation when prompted. The software will format the SD card and write the Raspberry Pi OS image to it.
- This process may take several minutes depending on the speed of your SD card and computer.
- Once the writing process is complete, the software will verify the written data to ensure integrity.
Step 6: First boot and configuration
- Remove the SD card from your computer and insert it into the Raspberry Pi.
- We manage the software on each Pi using Ansible. No connection to a monitor or keyboard is required, but you must be on a network with the Pi that supports mDNS so that you can reach the pi using ssh as
pi@[hostname].local. -
If this does not work, you will need to use a tool like
nmapto find the Pi's IP address and manually create a host entry in your/etc/hostsfile. -
Once the Pi has booted, you can connect to it using ssh as
pi@[hostname].localwith the password you set during the configuration process. - You can now use Ansible to manage the software on the Pi. Ansible is a configuration management tool that allows you to manage the software on the Pi from a remote computer, keeping it up to date and centralizing its management. The below instructions are retained for reference but are not strictly needed if Ansible deployment is used.
- To run Ansible commands, you will need to have the
ansiblecommand installed on the computer you are using as the AFL controller. You can install it usingpip3 install ansible. - See full instructions, playbooks, etc. in the
AFL-automationrepo, deploy directory. - To provision a pi, you will need to add it to the
inventoryfile in theAFL-automationrepo, and run thesetup-afl-python-env.yamlplaybook:ansible-playbook -i hosts.ini setup-afl-python-env.yaml
Step 7: Module-specific configurations
For the Loader Electronics Module (piloader)
- Run the loader-specific playbook which will download and install the LabJACK software.
ansible -i hosts.ini install-loader-extras.yaml
For the Video Module (pivideo)
-
Install the Motion software stack for video capture:
bash sudo apt update sudo apt install -y motion -
Set up the Motion configuration to connect to one or more USB cameras and/or RTSP network cameras (we like Amcrest cameras due to their simple UI. Note it is a very bad idea to connect such cheap cameras to the Internet.)
Step 8: Troubleshooting
- If the Raspberry Pi doesn't boot:
- Check that the SD card is properly inserted
- Try re-flashing the SD card
-
Verify that the power supply provides sufficient current (at least 3A for Raspberry Pi 4)
-
If the Raspberry Pi boots but network connectivity fails:
- Check your network settings
- Verify that the Wi-Fi credentials are correct
-
Try connecting via Ethernet cable
-
If the module-specific software doesn't start:
- Check the logs:
sudo journalctl -xe - Verify that all required libraries are installed
- Check file permissions on the startup scripts