You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在Raspberry Pi Zero W上连接两个Google AIY Vision Bonnet?

Can I connect two Google AIY Vision Bonnets to a Raspberry Pi Zero W?

Great question! The short answer is yes, it's technically possible, but there are several hardware and software considerations you'll need to work through to get it running reliably. Let's break this down step by step:

Key Background: SPI on the Pi Zero W

The Raspberry Pi Zero W has two SPI controllers available:

  • SPI0: Enabled by default, uses GPIO pins 8 (CE0), 7 (CE1), 10 (MOSI), 9 (MISO), 11 (SCLK)
  • SPI1: Disabled out of the box, uses GPIO pins 18 (CE0), 17 (CE1), 16 (CE2), 20 (MOSI), 19 (MISO), 21 (SCLK)

SPI is a bus-based protocol, so multiple devices can share the same SCLK/MOSI/MISO lines—you just need a unique Chip Select (CS) pin for each device. This gives you two clear options for connecting your two Vision Bonnets:

  1. Hang both on the same SPI bus (e.g., SPI0) using different CS pins (CE0 and CE1)
  2. Use separate SPI buses (SPI0 for one bonnet, SPI1 for the other)

Step 1: Enable Required SPI Interfaces

First, you need to activate both SPI controllers:

  1. Open the Raspberry Pi configuration tool via terminal: sudo raspi-config
  2. Navigate to Interface Options > SPI and enable it (this turns on SPI0)
  3. To enable SPI1, edit your /boot/config.txt file:
    sudo nano /boot/config.txt
    
    Add these lines (to enable SPI1 with 3 CS pins and avoid conflicts with default audio):
    dtparam=spi=on
    dtoverlay=spi1-3cs
    dtparam=audio=off  # GPIO18 (SPI1 CE0) is used for PWM audio by default—disable this
    
  4. Reboot your Pi to apply changes: sudo reboot

Step 2: Hardware Connections

Option A: Same SPI Bus (SPI0)

  • Connect both Bonnets' SCLK to GPIO11, MOSI to GPIO10, MISO to GPIO9
  • Wire the first Bonnet's CS to GPIO8 (CE0, the default pin for AIY Vision Bonnets)
  • Wire the second Bonnet's CS to GPIO7 (CE1)
  • Critical note: The Pi Zero W's USB port has limited power output. Use a 2.5A+ USB power supply, or consider adding external 5V power for the Bonnets if you see crashes or unstable behavior.

Option B: Separate SPI Buses

  • First Bonnet (SPI0): Connect SCLK→GPIO11, MOSI→GPIO10, MISO→GPIO9, CS→GPIO8
  • Second Bonnet (SPI1): Connect SCLK→GPIO21, MOSI→GPIO20, MISO→GPIO19, CS→GPIO18 (or 17/16)
  • Same power warning applies here—don't skimp on power delivery.

Step 3: Software Modifications

The official Google AIY Vision Kit libraries are built for single-device setups, so you'll need to tweak code to initialize two separate devices:

  1. When creating CameraInference objects in your Python code, specify the SPI bus and CS pin for each bonnet. For example:

    from aiy.vision.inference import CameraInference
    from aiy.vision.models import face_detection
    
    # First bonnet (SPI0, CE0)
    inference1 = CameraInference(face_detection.model(), spi_bus=0, spi_cs=0)
    # Second bonnet (SPI0, CE1)
    inference2 = CameraInference(face_detection.model(), spi_bus=0, spi_cs=1)
    

    Note: If the AIY library doesn't natively support spi_bus/spi_cs parameters, you'll need to modify the underlying library code to pass these values to the SPI driver.

  2. Be mindful of resource constraints: Running two inference pipelines at once will tax the Pi Zero W's CPU and memory. Consider staggering inference jobs or using lighter-weight models to reduce load.

Potential Pitfalls to Watch For

  • Power Instability: Crashes, freezes, or distorted camera feeds are almost always a power issue. Upgrade your power supply or add external power for the Bonnets if needed.
  • Pin Conflicts: Use the pinout command in the terminal to verify none of your chosen SPI/CS pins are assigned to other functions (like Bluetooth or GPIO inputs).
  • Library Limitations: The official AIY libraries may not support multiple devices out of the box. You might need to fork the library and adjust the SPI initialization logic to accept custom bus/CS settings.

内容的提问来源于stack exchange,提问作者Venkatesh Kodukula

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:18:43