A SPIKE Prime interface for the Vuforia Edge Server that utilizes a WiFi Dongle and MQTTP, to communicate from the microcontroller to the Server.
The steps outlined here only need to be followed once
Start by downloading and installing the Vuforia Spatial Edge Server from one of the links below. You should end up with a folder on your computer called "vuforia-spatial-edge-server".
Install the basic interfaces addon in the addons folder of your spatial edge server following these instructions.
Install the Robotics Interface addon in the addons folder of your spatial edge server following these instructions
Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. To install it on your local machine follow these instructions.
cd vuforia-spatial-robotic-addon/interfaces
git clone https://github.com/paccionesawyer/SPIKE-Prime-MQTT.git
cd ..
npm install mqtt
cd ../..
npm install
Physical Setup Some soldering must be done to make the ESP8226 board compatible with the SPIKE Prime. Instructions on how to do so can be found here.
Software Setup Download and open the boot.py in this repository, you will need to edit the WIFI_CONFIG and MQTT_CONFIG variables to match your setup. The address of the mosquitto broker is the local IP Address of whatever device you installed it on. How to Find My IP Address
Now, save the files boot.py and main.py in this repository on to the ESP8266. This can be done using ampy following these instructions
Download the Spike Prime App. Open the app, connect your Spike Prime and create a new python (not word block) project. Copy and paste the spikeMain.py. Then navigate to the bottom right hand corner and press the zero next to the stop button, it should now say "Download to Hub". Now press download arrow and the program will be saved to whatever number you selected.
spikeMainDemo.mp4
The installation can take some time, however, it only needs to be done once. Therefore, the setup can be done entirely before hand. A Raspberry Pi image of the working system is saved (Not Included in this repository due to size 32GB). This Raspberry Pi is setup as a hotspot and the MQTT Broker. The ESP can be soldered and files downloaded on it before handed. An SD card with the Raspberry Pi Image, and the pre-soldered ESP8266 board can be shipped anywhere.
Once the setup is done, follow these steps each time you want to connect the SPIKE Prime to the edge server.
Start the mosquitto broker running in the background as a daemon.
pi@raspberry:~ $ mosquitto -d
Start the Edge Server
pi@raspberry:~ $ cd vuforia-spatial-edge-server
pi@raspberry:~ $ node server
Plug the ESP into Port F of the SPIKE Prime, turn on the SPIKE, and run the program number you saved spikeMain.py to.
ARSetup.mp4
The first time you start the edge server you will need to enable the SPIKE-Prime-MQTT Interface by going to the 'Manage Hardware Interface' Tab and selecting on. Then by clicking on the yellow gear, you can set the information of the MQTT Broker.
communication.mp4
Here are some related projects
- Turning Raspberry Pi into a Hotspot - If the Raspberry Pi is setup as a hotspot and has the edge server downloaded on it, then there is no need for an internet connection. The only thing that needs to change is the WIFI_CONFIG and MQTT_CONFIG, on the ESP8266 boot.py. If you turn the Raspberry Pi into a hotspot, it's IP Address and therefore the IP address of the broker will never change (192.168.50.10).