Low power smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU
People ask me the reason I chose to use the Raspberry Pi Zero for this project considering it's not a powerful single-board computer. I could have tried ready-made smart cameras, but the Raspberry Pi is one of the best selling general purpose computers ever (beating the Commodore 64, numbers from 4 years ago!), therefore it has a huge community. This makes life much easier when you need to find a driver or how to solve a problem. In addition to that, last year I released my work on a flexible, collision resilient, quadcopter that has as its brain... a Raspberry Pi Zero W! So, I'm quite familiar working with the Zero and I hope the Raspberry Pi Foundation will soon come up with an upgrade (maybe adding a RP2040 to the RPI Zero PCB?).
The edgetpu runtime version installed in the RPI image is 13, therefore you need to pass -m 13
to the edgetpu_compiler. The notebooks in this repo are updated, but if you need to compile a different model:
edgetpu_compiler -m 13 -s model.tflite
The models compiled using the example notebooks that use the Model Maker will ONLY work with this script: model_maker_object_detection_from_cam.py
The TL;DR; reason is: the order of the tensors in the output changed, and the pycoral version in the Maple Syrup Pi Camera image has those indices hardcoded.
pi
and password maplesyrup
(yup, I love maplesyrup)./home/pi/launch_jupyter.sh
(it's slow at times, but very much usable) and the password is again maplesyrup
(your browser will complain saying it's not a secure connection because the server is using a self-signed certificate).The RPI Zero W has a USB 2.0 connection with a theoretical 480Mbit/s (50MB/s) speed, but it will never get close to that because the RPI0 has a single core ARMv6 CPU (no free lunch!). Therefore, the Google Coral USB Accelerator is very often limited by the USB bandwidth, or the ability of RPI0 to exchange data with it. This fact plays a role in keeping the average power consumption low, though. Models that need post-processing or use a custom OP (the EdgeTPU compiler runs these ops in the host) will also suffer from the small USB bandwidth and the weak ARMv6 single core.
The RPI Zero W has no protection circuit on its 5V input, therefore it connects the USB power directly to the power supply. That means the Coral USB Accelerator will be directly connected to the power supply allowing it to drain as much current as the power supply and impedance of microUSB + PCB traces allow it. According to the Google Coral USB Accelerator Datasheet, the accelerator alone could draw up to 900mA (peak). The RPI Zero W has a typical power consumption of 150mA. In my experiments, the Maple-Syrup-Pi-Camera consumes around 160mA at 5V when idle (800mW).
Using a hobby-grade USB power meter (and a power bank that states it can deliver up to 2A at 5V):
The power consumption is kept low, compared to other products using the EdgeTPU, mainly because the RPI Zero is very low power and the Coral USB accelerator usually sits idle awaiting for data.