Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Master Guru


Using Raspberry Pi 3B+ with Apache NiFi MiNiFi and Google Coral Accelerator and Pimoroni Inky Phat


First we need to unbox our new goodies. The Inky Phat is an awesome E-Ink display with low power usage that stays displayed after shutdown!


Next I added a new Google Coral Edge TPU ML Accelerator USB Coprocessor to a new Raspberry Pi 3B+. This was so easy to integrate and get up and running.


Let's unbox this beautiful device (but be careful when it runs it can get really hot and there is a warning in the instructions). So I run this on top of an aluminum case and with a big fan on it.


107031-1552165329322.png




Pimoroni Inky Phat


It is pretty easy to set this up and it provides a robust Python library to write to our E-Ink display. You can see an example screen here.


https://github.com/pimoroni/inky

Pimoroni Inky pHAT ePaper eInk Display in Red


Pimoroni Inky Phat (Red)



https://shop.pimoroni.com/products/inky-phat

https://github.com/pimoroni/inky

https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html

https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat



Install Some Python Libraries and Debian Install for Inky PHAT and Coral


pip3 install font_fredoka_one
pip3 install geocoder
pip3 install fswebcam
sudo apt-get install fe
pip3 install psutil
pip3 install font_hanken_grotesk
pip3 install font_intuitive
wget http://storage.googleapis.com/cloud-iot-edge-pretrained-models/edgetpu_api.tar.gz

These libraries are for the Inky, it needs fonts to write. The last TAR is for the Edge device and is a fast install documented well by Google.

Download Apache NiFi - MiNiFi Java Agent


https://nifi.apache.org/minifi/download.html


Next up, the most important piece. You will need to have JDK 8 installed on your device if you are using the Java agent. You can also use the MiniFi C++ Agent but that may require building it for your OS/Platform. That has some interesting Python running abilities.



Google Coral Documentation - Google Edge TPU

  • Google Edge TPU ML accelerator coprocessor
  • USB 3.0 Type-C socket
  • Supports Debian Linux on host CPU
  • ASIC designed by Google that provides high performance ML inferencing for TensorFlow Lite models





Using Pretrained Tensorflow Lite Model:


Inception V4 (ImageNet)

Recognizes 1,000 types of objects

Dataset: ImageNet

Input size: 299x299


Let's run a flow:



Results (Once an hour we update our E-Ink Display with Date, IP, Run Time, Label 1)




Source Code


https://github.com/tspannhw/nifi-minifi-coral


References







2,225 Views
0 Kudos