Select Page
Tech Log #015: Array of Device objects updating in map

Tech Log #015: Array of Device objects updating in map

The array of Device objects is being updated with the data from MQTT. Presently, all devices (the 51 logs) are being stored as a test. This will then be used to display dots on the map. The console shows 50 Devices added to the array, not 51, however forever list verifies that 51 devices of loglooper are running. There’s an off-by-one error somewhere, and that has to be debugged. Currently the latitude and longitude are being sent in separate messages. They will need to be combined into one message, to make search faster for seeing if that coordinate is displayed on-screen or not. That will let us keep in memory only what is needed to be there! Next step is debugging, display of all the dots on the map, then refactoring the lat & lon messages.

Tech Log #014: 51 logs simultaneously

Tech Log #014: 51 logs simultaneously

A total of 51 logs are sending data simultaneously at 1 second intervals to our MQTT server on AWS. For each log, there are currently 3 data points being sent at the same time. loglooper was updated to receive file, device id, and date through command line arguments, since there’s 51 logs from 2018’s field tests to go through. Created a new python script to go through the directory of the data files, then generate a bash script that will launch forever to start or stop the scripts. Some experimentation was done on timing between calls to forever. On the computer, it works fine with 0.5 second delay between calls. However, on the server, sometimes the EC2 instance becomes stuck. When that happens, no messages are being sent or received on MQTT. A solution to this would be to batch the script in logs of 10 or so. Anyway, all 51 are running now on my computer sending the data to the MQTT server. It’s going to be real interesting to see if it will crash. Yesterday was mainly searching for the log files, and wasn’t enough of an update to post yesterday. The next steps are to display the dots — all 51 — on the map.
Check out this video snippet to see the activity:
Here’s a glimpse at the EC2 instance during testing, let’s see how it responds after some time
Tech Log #013: Map with device class

Tech Log #013: Map with device class

The task of the day was to change the current way of device data to be object oriented in Javascript. Learned about an old way to make Javascript objects (ES5), then learned about the new way to do so with classes (ES6). Created a device class in a separate device javascript file. Transferred the variables, changed the calls to the variables in the main sketch, and same with the functions. Everything is working! As well, changed all the var (function scope) variables to let (block scope). Pretty simple. This Device class will evolve over time. The next step is to process additional data logs from Bowie, and have them displayed on the map as instances of the object.

Tech Log #012: Map displaying point from MQTT

Tech Log #012: Map displaying point from MQTT

There’s now a dot being displayed on the map corresponding to the data received through MQTT on the AWS server. The loglooper of Bowie’s data, which sends the MQTT messages, is running continuously on the AWS server too. There was a minor change in the topic structure. Now the sensor value falls under air, water, or soil. The number of data points in each of those topics will be added to a counter which will eventually be displayed along the bottom of the page. The next step is to find a better data structure for multiple devices. The data structure should be chosen with the future possibility of dynamically loading / unloading based on the map position. After this, will be prototyping and testing sending data from an IoT device *live* in the field.

Tech Log #011: Loglooper to MQTT broker

Tech Log #011: Loglooper to MQTT broker

Derived a python program from convert_data.py to loop through an already processed Bowie log file, called loglooper. When it processes a line, it also sends the data to the MQTT broker. There’s a 1 second delay per line. The server was able to receive the data perfectly. The next step was to try to get this program to run continuously using nodejs forever. Originally encountered some difficulties related to the spinSleepTime and minUptime, which were changed from 1000 ms to 5000 ms. It’s now working continuously with forever. The next step will be to receive the data on the map and draw a dot. As well as transferring the python loglooper to the server to run on AWS.