This week in P Comp, we are learning about serial communication. Serial communication is a way to allow computers to talk to each other. This is very exciting because we can now start to create projects where physical interfaces interact with interfaces on the screen and we can start to think about how a network of connected physical objects can be controlled through one computer. At the same time there are a lot of materials covered this week and after going over the videos and labs I’m filled with questions.
What I’ve learned so far:
Serial communication works by sending a series of digital pulses back and forth between devices. In order for these two devices to communicate they need to agree on three things: the rate at which data is sent and read, the voltage levels that would represent 1 and 0 bits, and the meaning of the voltage levels (does 1 mean high and 0 mean low or reversed). Serial communication protocol defines the structure of communication. It’s kind of similar to facilitating a conversation between two people.
The Arduino uses a USB-to-serial converter so that the USB connection would show up as serial port on the computer. The serial port can only be controlled by one program at a time. So if I have the serial monitor open in the Arduino IDE, I need to close it to run my Processing sketch that also use the serial port. Aside from Processing, any other environment (?) that can access the serial port can also be used to communicate with the Arduino. The physical connection happens through three lines: the transmit (Tx) to receive (Rx) line, the Rx to Tx line, and the ground line.
There is an area in the processor’s memory where incoming data from the serial port is stored. This is the serial buffer. I used this in the lab to smooth out signals from Arduino IDE (?) by storing data in to strings and sending them only after the end of a line.
- The graph from the Serial to Processing lab looked quite different for mine. I’m not sure whether it’s because I used a different sensor. The graph had started looking smoother (with each line touching) but after I changed something in the code a gap showed up between each line.
- Other devices connecting with the Arduino vs. connecting directly with a computer. What are some examples of application for both methods?
- Explain more about serial buffer.
- Why can only send 1 byte with Serial.write() but Serial.println() can send more than 1 byte?
- Explain more about the difference between RS-232 and USB.