Posted on

Previous: Lab 1A

Setup and Configurations

I created a Python environment and installed Jupyter Lab along with the other required packages and class codebase. I was able to start the Jupyter server successfully.

Picture of successful Jupyter serve

I uploaded ble_arduino.ino to the Artemis and was able to read its unique MAC address, as well as generate a uuid to update connection.yaml.

ble MAC
UUID

Lab

Task 1

I sent a string value from the computer to the Artemis board using the ECHO command. The computer received and printed an augmented string.



Task 2

I sent three floats to the Artemis board using the SEND_THREE_FLOATS command and extracted the three float values in the Arduino sketch.



Task 3

I added a command GET_TIME_MILLIS which makes the robot reply write a string such as "T:123456" to the string characteristic.



Task 4

I set up a notification handler in Python to receive the string value (BLEStringCharacteristic in Arduino) from the Artemis board. It uses the ble function start_notify() with my notification_handler() to receive updates to BLE GATT characteristics concurrent with other code.



Task 5

I wrote a loop that gets the current time in milliseconds and sends it to my laptop to be received and processed by notification_handler(). After collecting these values, I found that each was transmitted approximately 60 ms after the last. This is around 17 transmissions per second, and with 13 bytes per message (for a char array of length 12), approximately 200 bytes per second.

test RX speed

Task 6

I then defined a global array timeStamps to store time stamps, and added a command SEND_TIME_DATA to place each time stamp into the array rather than writing each one to the string GATT characteristic. Then, I looped over timeStamps and sent each data point as a string to my laptop to be processed.

send time millis
... and after a while ...
send time millis

Task 7

I implemented a similar assignment process for temperature readings from the Artemis using the command SEND_TEMP_DATA. The notification handler is able to parse both time and temprature.

send temp

Task 8

Method 1 records data at a significantly lower rate, but outputs to the computer after every round of collection. This could be useful if real-time decisions must be made based on sensor readings. For an open-loop test, method 2 is much more useful. The data recorded generated has much higher resolution than that of method 1, but there is a delay between the Artemis recording data and the computer receiving it.

It took just over 25 ms for the Artemis to store 100 time and temp readings. With int timestamps and float temperatures, the data recorded at each step is 8 bytes, for a data rate of about 320 bytes per second. Currently defined global variables use about 30kB, so with the 354kB remaining, we can store just over 40,000 temp and timestamp sets.


Collaboration

I worked with Lucca Correia and Trevor Dales extensively, and referenced Daria's site for some notification handler and SEND_TIME_DATA pointers.

Next: Lab 2