/ctech2-demo

Demo materials for C-Tech^2 summer camp.

Primary LanguagePython

ctech2-demo

Demo materials for C-Tech^2 summer camp.

Blynk.io Setup

  1. First create an account with Blynk.io.
  2. Create templates and devices for the water temperature sensor, and the power strip.
  3. Copy/paste the configuration code for each device into a YAML file with the same name as the Python file you are trying to run. For example, for the power strip you will create a file power_strip.yml that looks sort of like this:
    BLYNK_TEMPLATE_ID: "<some id>"
    BLYNK_DEVICE_NAME: "<some name>"
    BLYNK_AUTH_TOKEN: "<some auth token"
  4. Modify the Blynk virtual pin and physical GPIO pin assignments to match those of your Raspberry Pi and Blynk device online.

Quickstart Guide

Pi Camera Demo

$ python3 picam_demo.py

Object Detection Demo

# Run object detection script using 180-degree camera rotation.
$ python3 object_detection.py -m ssd_mobilenet_v1_1_metadata_1.tflite -l labelmap.txt -r 180

Raspberry Pi Installation Guide

  1. Run sudo raspi-config and enable the following (requires reboot):
    • Remote GPIO
    • 1-Wire
  2. If running on macOS ensure that you have XQuartz installed.
  3. On RPi run the installer script:
    $ sudo install_rpi.sh
  4. Enable X forwarding in /etc/ssh/sshd_config via setting:
    X11Forwarding yes
  5. Must set DISPLAY env variable on RPi. Add the following to ~/.bashrc or ~/.zshrc:
    # For X11 forwarding
    export DISPLAY=localhost:10.0
  6. Download the example TensorFlow Lite model which has been pre-trained on the COCO dataset:
    $ curl -L https://tfhub.dev/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/1?lite-format=tflite --output ssd_mobilenet_v1_1_metadata_1.tflite
  7. Unzip the model file to reveal a new labels file called labelmap.txt:
    # Will unpack a new file called `labelmap.txt`
    $ unzip ssd_mobilenet_v1_1_metadata_1.tflite