Skip to content

Latest commit

 

History

History
90 lines (71 loc) · 10 KB

README.md

File metadata and controls

90 lines (71 loc) · 10 KB

Maple Syrup Pi Camera

Low power('ish) AIoT smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU

Maple-Syrup-Pi-Camera

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?).

Updates:

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

ATTENTION:

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.

How to build your own

Hardware

Software

The easy way

  • Download the image available here and flash it to your card using the Raspberry Pi Imager.
  • The image available in this repo has lots of interesting stuff pre-installed and its default user is pi and password maplesyrup (yup, I love maplesyrup).
  • Another interesting thing available is the Jupyter Notebook Server. It helps a lot while testing things. You can launch it by running /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 hard way (Why can't you go the easy way?!?! LOL)

  • You will, at least, need to install the libedgetpu and tflite_runtime. Be aware this tflite_runtime version was compiled for Python 3.7.
  • In addition to the software above, you will need to install Picamera, Pillow...

Extra instructions

Usage examples

Speed

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.

Power consumption:

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).

Examples of power consumption:

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.

Acknowledgments:

Disclaimer

Other projects you may like to check:

  • RPI0_GPU_FFT: Experiments using the RPI Zero GPU for FFT/IFFT 1D/2D.
  • colab_utils: Some useful (or not so much) Python stuff for Google Colab notebooks.
  • ExecThatCell: (Re)Execute a Jupyter (colab) notebook cell programmatically by searching for its label.
  • The CogniFly Project: Open-source autonomous flying robots robust to collisions and smart enough to do something interesting!
  • Bee: The Bee simulator is an open source Spiking Neural Network (SNN) simulator, freely available, specialised in Liquid State Machine (LSM) systems with its core functions fully implemented in C.

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 801215 and the University of Edinburgh Data-Driven Innovation programme, part of the Edinburgh and South East Scotland City Region Deal

https://ddi.ac.uk/case-studies/smart-tourism-in-the-age-of-the-general-data-protection-regulation-capturing-rich-visitor-flow-data-without-risking-privacy-invasion/