Raspberry Pi AI Kit: Human Notification with Computer Vision

Raspberry Pi AI Kit: Human Notification with Computer Vision

In this tutorial, we will create a Human Notification System using the Raspberry Pi AI Kit with the Cytron Maker Pi Pico to indicate the detection of a person based on data received from a server. The Maker Pi Pico features a built-in SD card reader for storing audio, as well as a 3.5mm audio jack that allows users to interface the Raspberry Pi Pico W with external speakers.
 

Additionally, it has a built-in RGB LED on the board to indicate detection. We will utilize the newly launched Raspberry Pi AI Kit to enhance our computer vision capabilities. This kit, featuring the Hailo-8L AI accelerator module, allows for high-performance, low-latency AI inferencing on a Raspberry Pi 5.

 

 


 

 

We will be using three different pieces of code to achieve this:

  1. Client code (CircuitPython) for connecting to a Wi-Fi network, receiving data from a server, and controlling the RGB LED strip.
  2. Server code (Python) for sending data to the client.
  3. Background processing script (Bash) for monitoring object detection results and updating the server with relevant data.

Component List

To set up the notification system described in this tutorial, you will need the following components:

  1. Raspberry Pi 5
    • The main component to run the server code and Raspberry Pi AI Kit.
  2. Raspberry Pi AI Kit
    • Required for running the YOLO object detection model efficiently. This kit features the Hailo-8L AI accelerator module, allowing for high-performance, low-latency AI inferencing on a Raspberry Pi 5.
  3. Raspberry Pi Camera Module 3 with Cable
  4. Maker Pi Pico Base with Raspberry Pi Pico W
    • Microcontroller to run the client code and manage the audio storage, speaker interfacing, and RGB LED. The Cytron Maker Pi Pico simplifies digital making by adding extra features to the Raspberry Pi Pico W, such as a built-in SD card reader, a 3.5mm audio jack for external speaker interfacing, and built-in RGB LEDs.
  5. Speaker with 3.5mm Audio Jack
    • For audio notifications.
  6. SD Card
    • For audio storage.
  7. NVMe SSD
    • Optional for faster boot and operation. Requires an M.2 to USB adapter for USB boot or boot from SD Card.

Additional Tools and Accessories

  • 27-Watt PD Power Supply for Raspberry Pi 5: Ensure it meets the power requirements of the Raspberry Pi 5.
  • Internet Connection: For communication between Raspberry Pi 5 & Pico W via Wi-Fi connection.
  • Heatsinks or Cooling Fan: To keep the Raspberry Pi cool during prolonged operation, especially when using the AI Kit.
  • Case for Raspberry Pi: To protect your Raspberry Pi and components.

Clone Repository

  1. Open the terminal and copy and paste this command:

git clone https://github.com/ZGMFX20AR/raspberry-pi-5-ai-kit.git

Setting Up the Client Side

Note: This section requires the Circuitpython library, which can be downloaded here.

  1. Create an audio file by following this tutorial.
  2. Insert an SD card that contains the audio file to the Maker Pi Pico SD Card Slot.


     
  3. Connect your Raspberry Pi Pico W to your Raspberry Pi 5.

  1. Final hardware assembly.

      
  2. Go to the cloned folder (raspberry-pi-5-ai-kit/PersonDetection/code.py) and copy the code.py into the Raspberry Pi Pico W.
  3. Create an empty folder inside the Raspberry Pi Pico W and name it "sd".
  4. Open the copied code.py using Thonny IDE. Replace the ssid, password, and server_ip, then save.

Setting Up the Server Side

Note: This section requires pre-installed Raspberry Pi AI Kit hardware & software components, which can be found here.

  1. Open the terminal and copy and paste this command to go to the directory:

      cd raspberry-pi-5-ai-kit/PersonDetection

  1. Make the script executable using this command:

      chmod +x camera_monitor.sh

 

  1. Copy and paste this command to run the server.py:

python3 server.py

 

Running All Components

  1. With the server running, open another terminal and run this command. A window with the camera view will appear:

./camera_monitor.sh

Note: If the camera view window does not appear, ensure the directory of the .json file matches your file directory. You may need to edit the camera_monitor.sh script.

  1. Open Thonny with the Raspberry Pi Pico W and run the code.py.


     
  2. The onboard RGB LED will light up green when no person is detected, and will turn red and play an audio notification through the speaker when a person is detected.

 

Conclusion

By following these steps and assembling the specified components, you will not only create an effective Human Notification System using computer vision and AI capabilities but also gain valuable hands-on experience with artificial intelligence. The Raspberry Pi AI Kit and Cytron Maker Pi Pico make this setup an excellent introduction to the world of AI, especially computer vision AI.

 

The Maker Pi Pico simplifies digital making by adding extra features to the Raspberry Pi Pico W, such as a built-in SD card reader, a 3.5mm audio jack for external speaker interfacing, and built-in RGB LEDs. This project will help you understand how to integrate AI for real-time object detection and control physical hardware like the RGB LED strip, providing a solid foundation for exploring more advanced AI applications in the future.

Hardware Components