Work                  Events                 About

RIVEN RATANAVANH

Week 6: Asynchronous Serial Communication
October 19, 2021

I had already taken a brief look at these labs in order to set up Experiment One, but when I did that last week, I didn’t read and watch all the videos -- only took what I needed to get the barebones for my test working.

It was good to spend time going through the labs step by step to solidify my understanding, and I hope that this will alleviate some of the frustration I felt last week.




Synchronous vs Asynchronous Serial Communication

In asynchronous serial communication, both devices have their own clocks, wheras in synchronous serial communication, only one device has a clock, and it is sharing that with the other.


Asynchronous Serial Communication Basics:



Some agreements that are important to know about Asynchronous serial communication at the moment:
- At minimum, 3 wires are needed to connect both devices.
- The size of the infomation packet is a byte (8 bits).

Notes to self:
- “Serial.write()” writes binary numbers to serial port (this can only send values between 0-255 because that is the limit of a byte, so you’ve gotta map what the sensor is reading before writing).
- Sending a byte from a sensor that reads 0-1023 by mapping to 0-255 in Arduino will lose resolution.
- Remember “Serial.println()” is ASCII (any numbers larger than 255 must be sent as an ASCII)


*

Lab 1: Intro to Asynchronous Serial Communication


Write a program that reads from two potentiometers and the Nano’s built-in accelerometer and prints them out in this format:
potentiometer1, potentiometer2, x value of accelerometer

This is the code I wrote using the arduino’s accelerometer example for guidance.


I initially tried writing the code without the if loop in setup(), but I received nothing in the serial monitor. I knew from my previous code in an earlier part of the lab that serial was coming in from my two potentiometers just fine, so it must have been the accelerometer causing the issue. The accelerometer sample code was also successfully passing data to serial.

I looked up the function readAccelerometer() to see what was up, and though the reference doesn’t mention anything about having to put anything in setup, I guessed that was potentially the issue and added the if (!IMU.begin()) loop there. I still don’t understand why this was necessary. 




But it worked:



Lab 2: Serial Input to p5.js

Noting for future projects:




Points to note & remember:



p5 Serial Control only seems to work with the p5 Editor running on Chrome, not Safari.


I also had a hard time understanding this concept, even though I did use Console.log() in my serialEvent() function to see what was printed out with both a delay() in the Arduino, and without. My main problem was that the value of the potentiometer was flitting back and forth, even when I wasn’t turning the dial.





I couldn’t do this: 


Kept getting this error:





Also want to understand smoothing and easing - do in Arduino or p5?






Lab 3: Serial Output from p5.js


***

Somehow it helps me to code better with fewer errors if I give typing the same kind of attention that I give my fingers when moving material through a bandsaw. If I treat it with similar stakes...

when I am tired, I know it is time to stop.


*

And other thoughts on Experiment 1...

Does drawing belong in this project? Am I interested in movement, or mark making? If I am interested in the relationship between movement and mark making, what is the purpose of technology in this project? Am I interested in it as an enhancer, augmentor, or impediment? So far it has been an impediment -- that, I’ve realized I’m not interested in. I am interested in using it down the line to interface with other information or the audience/viewer. But I don’t have those skills yet.

But I’m questioning what the place of drawing is here, because perhaps there is more richness in simplicity, and the body itself speaks enough. If I take away drawing, what do I have?

And again, if the body itself speaks volumes, why technology?
Why am I always thinking about EMG sensors? Or if not EMG sensors, what?