Serial communication

From Robo-T
Jump to: navigation, search

Work in progress

Serial communication is the means that devices often use to communicate with each other. It is serial in that the data is sent sequentially, one bit after another. For a good over view you can check out Wikipedia's article on serial communication Serial can be used to communicate between Arduinos, for RC control, for LCD displays, communicating with programs on the computer to mention a few. It should be obvious that it cannot be ignored and must be learned.

Serial protocols

The Arduino UNO supports these serial protocols

  • UART (Universal asynchronous receiver/transmitter) uses pin 0 & 1 TX/RX (Send/Receive)
  • USB (Universal Serial Bus)-This is not native but a USB to TTL is built on the UNO board and is further incorporated into the chip used by the Leonardo which can emulate a USB device like a keyboard or mouse.

The following two are implemented by software through libraries.

  • SPI (Serial peripheral interface) uses pin11(MOSI-Master output,slave input) pin12 (MISO-Master input,slave output)& pin13(SCK-Serial clock) pin10(SS-slave select) (and a(SS) pin for each extra device).
  • I2C (Inter-Integrated Circuit)Is in addressed Serial protocol so can address various devices using two wires. Uses pins A4(SDA)& A5(SCL) Best if you need to address multiple devices.


Note:

  • If a pin is used for serial communication it cannot be used for regular input/output usage.
  • Devices using UART would be cross connected. The TX of one device would connect to the RX of the other device and vice-versa.
  • These are protocols, that means it defines the framework of communication not the actual communication. What you send over these lines will depend on your design. of course certain devices will have this predetermined for you and you will have to find this out.

Resources

  • Choosing a serial protocol [1]
  • I2C Tutorial [2]