11 : Networking & Communications<
Hero Shot<
Learning Outcomes<
What did I learn this week ?
- Subject 1 :
- ??
- ??
- Subject 2 :
- ??
- ??
Assignments<
This eleventh week's asignments are :
- Group :
- Send a message between two projects
- Individual :
- Design, build, and connect wired or wireless node(s) with network or bus addresses and local input &/or output device(s)
1. General overview<
It has now been a few weeks that we started doing electronics for the Fab Academy. We learned :
- Week 4 : How to write and send instructions to a microcontroller in order to automate some tasks
- Week 6 : How to design an electronic board to easily connect a microcontroller to devices
- Week 8 : How to build an electronic board we designed
- Week 9 : How to measure something with a device connected to a microcontroller
- Week 10 : How to control a device with a microcontroller
During all these weeks I heard about some weird names such as UART or I²C. I understood these were methods to communicate with the microcontroller and I used them without really understanding how it works. Now is the time ! I will learn the basics of electronics communication and how I managed to talk with my microcontroller for all these weeks.
1.1. Digital signals : Bits<
You maybe heard this a lot, in the digital world, data are sequences 0 and 1. Indeed a computer or a microcontroller simply feels voltage therefore to send it a message one will have to translate it in voltage.
Historically, computers were invented to make computations (yes...) and it's been a reeeeaaaaally long time since humans try to do machines that compute. The idea that an efficient way to automate computations would use a binary digital system appeared few centuries before we discovered electricity (Leibniz according to Wikipedia). Indeed in a binary system, quite complex operations such as multiplications and divisions are simple additions and soustractions.
The first electrical computers were still made trying to use a decimal system (well... anthropocentrism) but it was quite hard and finally people went back to binary system which was way easier to electrically implement since one can associate 0 and 1 to HIGH and LOW voltage levels.
Quite rapidly people tried to use computers to communicate hence a code language to translate letters and words in a binary system was required. Therefore, a bit like Morse, code languages were invented to make each character, number and instructions equivalent to a sequence of HIGH and LOW voltage levels.
1.2. Network topology<
A set of communicating devices is called a network. The structure of the different communication lines between these devices is called the netwotk topology. Network topologies can be classified in two large categories :
-
Diffusion mode (Bus or ring topologies) : Only one large communication line connecting all the devices is used. The message is sent on the whole network and all the devices are able to see the message. An adress system is used for the devices to recognize if the message is meant for them.
-
Point-to-point mode (Star or mesh topologies): Several communication lines are used and each one connect only two devices. There is thus no need for an adress system.
Ring topology<
Devices are connected in a chain and each one of them play a intermediary role. When a message arrive to a device it reads it, interprets it and resends it in necessary. The inconvenient of such a topology is that a failing device or communication line breaks the whole network.
Tree topology<
The tree topology is divided in levels where each device is connected to one parent and several children. The inconvenient of such a topology is that a failing device or communication line blocks all communication to the lower levels.
Bus topology<
Devices are connected all passively connected to a same communication line which means they do not interfere with the communication when they read a message (the signal is "copied towards them"). Therefore a failing device has no impact on the rest of the network. However a failing communication line breaks the whole network.
Star topology<
Devices are all connected to a central device called a hub where all communication go through. The hub is hence a major point of failure but if any other device fails, it will have to impact on the rest of the network.
Mesh topology<
Devices are all connected together by point-to-point communication lines. If any device fails, it has no impact on the rest of the network however it requires a lot of communication lines.
1.3. Serial and Parrallel communication<
In this documentation, I will only learn about serial communication which is the simplest way to imagine communication : bits are sent one after another trhough one communication line from a device to another. The alternative is parallel communication where many bits could be sent at the same time from a device to another using several different communication lines.
1.4. Communication Protocol<
A communication protocol is a set of rules defined to allow communication between two devices. They regroup :
- Software rules - Method used to code :
- Instructions to indicate when the message starts or stops
- The message itself
- The adress of the aimed device if needed
- Hardware rules - Design of the :
- Ports required on the device
- Communication lines between the devices
2. UART<
The UART protocol from "Universal Asynchronous Receiver Transmitter" is a point-to-point communication protocol.
2.1. Hardware<
Its communication line is made of three wires :
- A to B wire
- B to A wire
- Ground wire
UART ports thus require :
- Transmission pin, TX
- Reception pin, RX
- Ground pin
2.2. Software<
Start bit - Message - (Parity) - Stop bit