Skip to content

Instantly share code, notes, and snippets.

@wb666greene
Last active December 20, 2019 13:20
Show Gist options
  • Save wb666greene/c2711ad7fe32775ba624bd06497e6724 to your computer and use it in GitHub Desktop.
Save wb666greene/c2711ad7fe32775ba624bd06497e6724 to your computer and use it in GitHub Desktop.
Set up Pi3 for Modivius NCS
// Modvius Neuro Compute Stick setup (from PyImageSearch real-time NCS tutorial)
// On fresh Pi Raspbian Stretch install as root do:
apt-get update || apt-get upgrade
apt-get install libusb-1.0-0-dev libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev git automake byacc lsb-release cmake libgflags-dev libgoogle-glog-dev liblmdb-dev swig3.0 graphviz libxslt-dev libxml2-dev gfortran
// then install python3 stuff:
apt-get install python3-dev python-pip python3-pip python3-setuptools python3-markdown python3-pillow python3-yaml python3-pygraphviz python3-h5py python3-nose python3-lxml python3-matplotlib python3-numpy python3-protobuf python3-dateutil python3-skimage python3-scipy python3-six python3-networkx python-opencv
// then install python modules: (may need to use pip3, these worked and my Pi3B+ defaults to using Python 2.7
pip install imutils
pip install "picamera[array]"
pip install paho-mqtt
// exit root and download and install NCS SDK:
mkdir workspace
cd workspace
git clone https://github.com/movidius/ncsdk
git clone https://github.com/movidius/ncappzoo
cd ~/workspace/ncsdk/api/src
make
sudo make install
// test it:
// make sure the NCS sick is plugged in first!
cd ~/workspace/ncappzoo/apps/hello_ncs_py
make run
// it should return:
Hello NCS! Device opened normally.
Goodbye NCS! Device closed normally.
NCS device working.
// Enable node-red and install some extras
// run node-red once and stop it:
node-red-start
node-red-stop
// then install npm
sudo apt-get install npm
// use npm to install contributed node for ftp server as normal user (pi), needed for AI interface flow
cd ~/.node-red
npm i node-red-contrib-ftp-server
// restart node-red and connect localhost:1880 in a browser there should be a new ftp-server node
// make node-red start automatically on boot
sudo systemctl enable nodered.service
// mosquitto MQTT broker and commandline tools (save typing by installing the -dev of a library
// which also gets the library and saves you needing to add the -dev package later)
// Need to run MQTT broker on AI Host which the installating does by default.
sudo apt-get install mosquitto-dev mosquitto-clients
// test the MQTT installation with these commands:
// start listening:
pi@noirOne:~ $ mosquitto_sub -h localhost -t test &
[1] 1114
// publish a message:
pi@noirOne:~ $ mosquitto_pub -h localhost -t test -m "testing 1 2 3 ..."
// response from backgrounded mosquitto_sub command:
testing 1 2 3 ...
// clean up
pi@noirOne:~ $ fg %1
mosquitto_sub -h localhost -t test
^C
pi@noirOne:~ $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment