Getting Started with the Raspberry Pi 3B+ and 4

The Raspberry Pi 3B+ and the Raspberry Pi 4 are ubiquitous among the hobbyist community of developers. They are reliable, easy to use single-board computers (SBCs) that are very affordable, making it easy to get your edge computer vision project up and running!

Things You’ll Need

  • Your development computer (Linux, Mac, or Windows)
  • An alwaysAI account
  • alwaysAI CLI installed on either your development computer or Raspberry Pi
  • Raspberry Pi 3 B+ or 4
  • Power supply
    • Pi 3 B+: 5 volt 2.5 amp micro-USB power supply
    • Pi 4: 5 volt 3 amp USB-C power supply
  • 16 GB or larger micro-SD card
  • Micro-SD card adapter for your development computer
  • A WiFi network or ethernet connection for your Pi
  • A CSI ribbon camera or USB webcam for capturing real-time video
Raspberry Pi

 

Raspberry Pi Setup

Flash the SD card

Download the latest alwaysAI version of the Raspbian OS from our website. Next, use a tool like balena Etcher to flash the OS onto your SD card:

bal

Once the flash completes, insert the SD card into your Raspberry Pi.

*note - If you’re using Linux or Mac, you can modify the hostname before starting your Pi by changing alwaysai to the hostname of your choice in both the /etc/hostname and /etc/hosts files.

Power Up the Pi

To power up your Raspberry Pi, simply plug the power supply into the device. You should see the red power LED light up, and the green activity LED start blinking.

Connect the Pi to a Network

Our Raspbian OS comes with balena WiFi Connect, making it easy to connect the Raspberry Pi to your WiFi network. Once the Pi powers up, check your development machine or phone for the “alwaysAI Connect - <device hostname>” in the list of available WiFi networks.

note

The default hostname is “alwaysai”, so if you didn’t set your own device hostname the network will be named “alwaysAI Connect - alwaysai”

connect

 

Select the network you’d like to connect to from the drop-down list and enter the password. After giving the Pi some time to connect to the network, check if you can see the Pi on the network. You can use the hostname or IP address to connect to the Pi. If you’re using Mac or Linux, mDNS is a simple way to connect to the Pi.

*note - Mac has mDNS set up by default. On Linux, install mDNS with the following command: sudo apt-get install avahi-daemon

$ ping alwaysai.local

On Windows, the hostname may work:

$ ping alwaysai

If not, you’ll have to find the IP address by scanning the network or connecting a monitor, keyboard, and mouse to the Pi and looking up the IP address.

Run an alwaysAI App on Your Pi

To run an alwaysAI app on your Pi, open a terminal in the application directory and run the app configure command.

$ aai app configure
✔ Found alwaysai.app.json
? What is the destination? › - Use arrow-keys. Return to submit.
Your local computer
❯ Remote device
✔ Please enter the hostname (with optional user name) to connect to your device via ssh (e.g. "pi@1.2.3.4"): … pi@alwaysai.local
✔ Connect by SSH
✔ Check docker executable
✔ Check docker permissions
✔ Where do you want to run the app? Enter a filesystem path: … alwaysai/realtime_object_detector
✔ Create target directory
✔ Write alwaysai.target.json

Now your app points to the Raspberry Pi. Run the app deploy command to deploy your app onto the Pi (note that pulling the Docker image over WiFi can take some time on the Raspberry Pi).

$ aai app deploy
✔ Connect by SSH
✔ Create target directory
✔ Copy application to target
✔ Build docker image (this may take several minutes)
✔ Install model alwaysai/mobilenet_ssd
✔ Install python virtual environment

Now when you start your app, it will run on the Pi. If you’re using the alwaysAI Streamer, it will provide a link:

$ aai app start
...
[INFO] Streamer started at http://localhost:5000

Click the link (or copy and paste it into your browser) from your terminal to open up the alwaysAI Streamer and view your program's output.

The alwaysAI platform makes it easy to build, test, and deploy computer vision applications on edge devices such as the Raspberry Pi 3B+ and the Raspberry Pi 4. We can’t wait to see what you build with alwaysAI!

 

Get started now

We are providing professional developers with a simple and easy-to-use platform to build and deploy computer vision applications on edge devices. 

Get started