This lab serves to establish communication between a computer and the Artemis through Bluetooth. For the Python portion a Jupyter lab is used, and the Artemis is programmed through the Arduino IDE.
The Artemis communicates with the computer through a Bluetooth protocol. The MAC address corresponding to the Artemis is queried when trying to connect. Universally Unique Identifiers (UUIDs) helps differentiate the type of data to be sent between the Artemis and computer. UUIDs can be generated using python and must match UUIDs specidied in the Arduino files. We were provided with demonstration code to verify connection and performance.
Task 1 requires the computer to send a string to the Artemis and for an augmented message to be returned to the computer. Image 1 below shows the output on the computer, inclusive of the Python code. Image 2 shows the code modified in the Arduino IDE. In order to complete this task, a new command type had to be declared in the Python and Arduino files.
This task requires the time to be retrieved from the Artemis in milliseconds and be returned in a string format. Image 3 below shows the resulting code in the Python code.
Task 3 instructs to set up a notification handler to extract the time from the transmitted float value. Because the time on the Artemis was recorded as a float, I decided to transmit it as such. Image 4 shows the result in Jupyter. There was no need to modify code on the Arduino IDE.
This task requires us to use a notification handler to transmit the temperature of the Arduino in regular 5 second intervals. A challenge that I had with this task was transmitting two different types of data (string & float). Image 5 shows the results from the first challenges I faced, with not all of the data being transmitted. Images 6 and 7 show the Python and Arduino code written, respectively.
This tasks requires us to use a notification handler to transmit 50 temperature readings over 100ms intervals. Images 8 and 9 show the Arduino and Python code written, respectively.
Only around 150 bytes of data can be transmitted from the robot via Bluetooth. Additionally, the Artemis Nano has about 380kB of RAM. This means that a lesser amount can be stored on board, approximately 200kB. The form of “5 seconds of 16-bit values taken at 150Hz” corresponds to an amount of data that exceeds the onboard capabilities. The limitations would result in either non-negligible latency or chunks of data not being transmitted correctly.
Image 10 below shows the plot of bytes vs. amount of time taken to transmit the message. Although there is some variance, the general trend shows that more data takes more time to transmit.
When data is transmitted at a high rate the results show relatively high results. When first transmitting temperatures rapidly, I chose to transmit the data every ~100 millisecoonds and I did notice one missed package.