We ran a very successful Liota and Wavefront lab at VMworld US hooking up LIOTA IOT framework to Wavefront at the {Code} labs. This allowed you to build an IOT device and stream data to a cloud-based metrics and analytics system, Wavefront.
Below are the instructions for the lab.
Connect to Raspberry PI
Connect using putty (ssh port 22)
Find IP address on the label next to your PI
User ID: pi, Password: vmware123
Uninstall Pulse Agent and Liota if it exists
This step copies the necessary files and starts installation process.
Type:sudo su – root
to give root privileges on the Raspberry Pi
type: ls /opt/ice-client
If the directory exists do the following:
type: cd /opt/ice-client
type: ./agent unenroll
type: ./agent uninstall
Install Pulse Agent and Liota
This step copies the necessary files and starts installation process.
Type: cd /home/pi/makerspace
Type: ./install.sh
When prompted for “Enter your Edge System Name Without Spaces”, type your name and hit enter, so your edge system can be uniquely identified
When Prompted for Passphrase, type: makerspace
and hit enter
You will see the following message, indicating successful installation
Fri Aug 17 08:48:11 PDT 2018 : Installation successful
Fri Aug 17 08:48:11 PDT 2018 : Run /opt/ice-client/iotcc to register the Edge System
Start Pulse Agent, Liota and Onboard Gateway to Pulse
This step completes the installation and starts Pulse agent, Liota and onboards the gateway with Pulse.
Type: cd /opt/ice-client
and press enter.
Type: ./iotcc --start-liota-as-root
and press enter
When prompted for userID: type iottech
and press enter.
When prompted for password, type Password1!
and press enter.
Note P is upper case. At this point, you will see a message indicating that Pulse and Liota have started The Raspberry PI is now onboarded to Pulse.
Write Liota Code to Collect Metrics
Pick a Sensor you want to work with. Sample code and circuits are provided for two sensors here:
BMP 280 Circuit and Liota Code:
|
VCC: PIN 4 (5V)
GND: PIN 6
SCK: PIN5 (SCL1)
SDI: PIN 3(SDA1)
Load and Run Liota Script to Collect Metrics
This step copies the Liota User Package to the Liota Folder, registers the Package with Liota daemon to gather the metrics. bmp280aws.py is the liota package. This package will contain a user defined method (UDM) which will pull collect the metrics. The package also spawns a thread (which calls the fetch_temperature method) to collect the metrics and write to a file. The file will be read in the UDM (device_metric method) and the package will send the metrics to wavefront using the Wavefront DCC over MQTT (DCC Communication protocol).
1 2 3 4 5 6 7 8 9 10 11 |
cd /home/pi/makerspace/AWS cp bmp280aws.py /usr/lib/liota/packages cp bmp280.sh /usr/lib/liota/packages/ cd /usr/lib/liota/packages chmod +x bmp280.sh ./bmp280.sh |
Now you have copied the metrics collector package to the liota folder and loaded it into liota using the bmp280.sh script
1 2 3 |
cd /var/log/liota tail –f liota.log to see if the metrics from BMP280 are being collected |
The Metrics are now sent to Wavefront
MotionSensor Circuit and Liota Code:
VCC: PIN 4 (5V)
GND: PIN 6
Data: PIN7 (GPIO 4)
Load and Run Liota Script to Collect Metrics
This step copies the Liota User Package to the Liota Folder, registers the Package with Liota daemon to gather the metrics. motionsensor.py is the liota package. This package will contain a user defined method (UDM) which will pull collect the metrics. The package also spawns a thread (which calls the fetch_motion method) to collect the metrics and write to a file. The file will be read in the UDM (device_metric method) and the package will send the metrics to wavefront using the Wavefront DCC over MQTT (DCC Communication protocol).
1 2 3 4 5 6 7 8 9 10 |
cd /home/pi/makerspace/AWS cp motionsensor.py /usr/lib/liota/packages cp motion.sh /usr/lib/liota/packages/ cd /usr/lib/liota/packages chmod +x motion.sh ./motion.sh |
Now you have copied the metrics collector package to the liota folder and loaded it into liota using the bmp280.sh script
1 2 3 |
cd /var/log/liota tail –f liota.log to see if the metrics from MotionSensor are being collected |
The Metrics are now sent to Wavefront
Liota and Wavefront: Getting Wavefront Running
To get the full experience for the Liota and Wavefront, you first need to get an account on the lab instance. See the VMware {Code} staff at the show, and they can help, or sign up here: http://wavefront.com/lab/ If you are reading this after the show or you get a 404, sign up at: http://wavefront.com/sign-up/.
ext, you will receive an email inviting you to login and set your password.
Then you can login, and look around. I recommend you star by making a chart. To do this:
- Go to Dashboards->Create Chart when you login.
- You will see a field with a lightning bolt and a gear. Put in the name of your metric.
- It will be something like makerspace.liota.<iottech>.BMP280.Temperature if you are using the BMP280 mentioned above.
- If you click on the gear icon, it will show you what the query looks like in our powerful query language.
- Try selecting a section of the graph to see how you can zoom in. Click “Reset” to pop out.
- Click on “Live Data” in the upper left to watch data change as it comes in from Liota.
You can also read more about how this lab uses Wavefront here
Raspberry Pi 3 B+:
- https://www.amazon.com/ELEMENT-Element14-Raspberry-Pi-Motherboard/dp/B07BDR5PDW/ref=sr_1_3?s=electronics&ie=UTF8&qid=1535390523&sr=1-3&keywords=raspberry+pi+b%2B
BMP280 Sensor:
- https://www.amazon.com/Barometric-Pressure-Sensor-BMP280-temperature/dp/B01NAK6BL2/ref=asc_df_B01NAK6BL2/?tag=hyprod-20&linkCode=df0&hvadid=198075247191&hvpos=1o1&hvnetw=g&hvrand=7493594651512419688&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9031971&hvtargid=pla-320025494081&psc=1
Jumper Wires
- https://www.amazon.com/SUNKEE-100pcs-female-jumper-Dupont/dp/B00AYCON8Y/ref=sr_1_2?s=hi&ie=UTF8&qid=1535390818&sr=8-2&keywords=sunkee+jumper+wires
NOOBS SD Card
- https://www.amazon.com/Raspberry-8GB-Preloaded-NOOBS-Card/dp/B00GFA48N4
Liota References:
https://github.com/vmware/liota/wiki/Liota-Developer-Guide
https://github.com/vmware/liota/tree/master/packages/user_packages