Networking and Communications
Stuff is slowly opening up again in Holland. Still number of corona infections remains high.
Three modes of communication
There are different baud rates, depending on your needs you can choose different speeds. Slower is more accurate. Our FTDI's can do 3mil bits per second.
When sending asynchronous it sends a - start bit - LSB (Least significant bit) - 5 to 9 bits for data - MSB (Most siginificant bit) - end bit
There is also a parity bit. This bit helps to communicate if all bits are transferred.
UART Now I final understand what the UART does: translating parallel to serial.
Pretending to be a protocol by simulating the protocol in software. So sending out bits at a certain frequency that corresponds to the correct sequence and output.
SPI SPI is still used a lot, but I2C is getting used more and more.
SPI has a benefit over serial that it also has clock-data. So it is synchronous. This clock makes ure that the dataflow stays in sync.
Most what we discuss and read about sounds like it is good to have a latent knowledge about SPI. But that any active learning can better be director to mastering I2C
I2C All this information is in the slides.
Stuff to remember is that - I2C can do synchronous communication over 2 wires. - This is great and all we need.
For programming there is a host of libraries avaiable:
Assignment this week
we need to make a network: that means we need to make more then two boards. A network is always more then two devices.
When you use serial, all nodes see the same information. So if there is an action required from the node, it has to be programmed on the node what is has to do.
Group assignment we all sit in a circle around the table and try to make a network together. This is going to be mighty interesting.
We are first checking the colours and aligning that all colours match over the network as to what pins they are connected.
- GRound -> Green
- VCC -> RED
- SCL -> Orange
- SDA -> Yellow
We are connecting an arduinos to three displays. There is a breadboard in the middle that is functioning as the physical bus.
The breadboard also distributes power from the Arduino to all displays.
erwin uses this code to scan the network:
The scan finds two devices. If we disconnect one, and scan again, we know which one is which.
This creates some issues. We are sometimes finding the right one, sometimes we don't.
Sometimes it finds four devices, when there are only two connected. This is because Erwin thought there were 256 device names available. But there are 'only' 128 devices in the network. When we have corrected that issue we can proceed.
We spend some time on discussing what the message is that we want to send and we debate the different version of Arduino.
We use two libraries
What we do is send bytes to the display over I2C and on the display the local MCU translates this to bytes that are translated to pixels.
After some magic on Erwin screen the dislay says Hello World.
You can specify in the code which address it has to be send to. If you leave this empty it will be send to all displays.
The adafruit display is now also on. This one needs to have the Arduino connected. The other display can be disconnected and reconnected.
Neil explains the serial bus. For up to ten nodes this is great. So for my end-project...
Check: RS-232, RS-422, RS-485
SPI: uses CIPO/COPI (master/secondary, manager/staff, controller/peripheral, student/teacher)
- you can use it to add RAM to your controller.
- it can help connecting to an SD card
- so you can extent the memory of storage of your project.
I2C - has a pull up resistor - is synchronous -
The whole wireless part at the end is interesting. Should watch back...