Robot Tutorials

23,664

Circuit Image

The UART, or Universal Asynchronous Receiver/Transmitter, is a feature of microcontrollers that facilitates serial data communication (text, numbers, etc.) with a PC. This device converts incoming parallel data (within the microcontroller/PC) to serial data that can be transmitted over a communication line. Incorporating UART functionality is particularly beneficial for robotics applications. With UART, it is possible to integrate an LCD, implement bootloading, establish Bluetooth wireless communication, create a data logger, debug code, test sensors, and more. Understanding UART can be complex, so essential information has been distilled into a more accessible format. The first part of this tutorial will cover the fundamentals of UART, while the latter part will provide instructions on how to integrate UART functionality into a $50 robot. Various standards and protocols are used for data transmission, which are not compatible with each other; however, understanding each one allows for easier conversion to suit specific robotic needs. RS232 is an older standard that is becoming less common, as few laptops still have RS232 (serial) ports today, with USB emerging as the new universal standard for hardware connections. Nevertheless, knowledge of this standard remains useful since it has not yet been completely phased out. Historically, circuits were prone to noise, lacked filtering, and were not robust. Poor wiring contributed to signal degradation over longer distances (due to wire resistance). To mitigate signal loss, high voltages were employed. RS232 was standardized at +/-12V, necessitating the use of the MAX232 IC (or its equivalents like ICL232 or ST232), along with a few capacitors and a DB9 connector. However, wiring these components can be cumbersome. A schematic is available for those who prefer a DIY approach. Modern signal transmission systems are more robust, eliminating the need for a +/-12V signal. The EIA232F standard (introduced in 1997) is similar to RS232 but accommodates a more manageable 0V to 5V signal. Most computers manufactured after 2002 utilize a serial port based on this EIA-232 standard, which simplifies the design by removing the need for the MAX232 circuit. Instead, an RS232 shifter can be used—a circuit that converts TTL signals from the computer/microcontroller to the EIA232F standard. The most affordable RS232 shifter available is the $7 RS232 Shifter Board Kit from SparkFun, which also provides schematics for DIY assembly. The assembled board features additional wire connectors for easy connection to microcontroller headers, with two wires designated for power/ground and the other two for Tx and Rx (transmit and receive). The UART processes bytes of data by transmitting individual bits sequentially. At the receiving end, a second UART reassembles the bits into complete bytes. It is not necessary to delve deeply into TTL, other than recognizing it as the signal used by the microcontroller UART. This TTL signal differs from what a PC's serial/USB port can interpret, necessitating conversion. Understanding USB is also not critical, except that it is becoming the predominant method for external hardware communication with PCs. To utilize USB with the robot, an adapter for conversion to USB is required. Converters are readily available for under $20, or one can create a custom solution using components such as the FT232RL.

The UART (Universal Asynchronous Receiver/Transmitter) is a crucial component in microcontroller systems that enables serial communication. It operates by converting parallel data from the microcontroller into a serial format suitable for transmission over communication lines. This function is particularly valuable in robotics, where it allows for the integration of various peripherals, including displays, wireless communication modules, and sensors.

The UART operates asynchronously, meaning that it does not require a clock signal for synchronization. Instead, it relies on start and stop bits to delineate the beginning and end of data packets. The standard baud rates (the speed of data transmission) can vary, but common values include 9600, 115200, and others, which can be configured based on the application requirements.

When implementing UART communication, it is essential to consider the voltage levels involved. The transition from RS232 to EIA232F has made UART communication more accessible, as the latter standard allows for lower voltage levels (0V to 5V) that are compatible with modern microcontrollers. The use of an RS232 shifter simplifies the interface between TTL signals from the microcontroller and the EIA232F standard, ensuring reliable communication without the complications of older voltage standards.

In practical applications, the UART interface typically consists of at least two lines: the transmit (Tx) line and the receive (Rx) line. These lines are responsible for sending and receiving data, respectively. Additional control lines, such as RTS (Request to Send) and CTS (Clear to Send), can be included for flow control, enhancing the robustness of the communication link.

The integration of UART in a robotic system not only facilitates communication with a PC for programming and debugging but also allows for real-time data exchange between components. This capability is essential for applications such as sensor data logging, remote control, and telemetry, where timely and accurate data transmission is critical.

In summary, the UART is a versatile and essential component in microcontroller-based systems, providing a straightforward method for serial communication. Understanding its operation, voltage requirements, and integration with modern standards is vital for developing effective robotic applications.The UART, or Universal Asynchronous Receiver / Transmitter, is a feature of your microcontroller useful for communicating serial data (text, numbers, etc. ) to your PC. The device changes incoming parallel information (within the microcontroller/PC) to serial data which can be sent on a communication line.

Adding UART functionality is extremely use ful for robotics. With the UART, you can add an LCD, bootloading, bluetooth wireless, make a datalogger, debug code, test sensors, and much more! Understanding the UART could be complicated, so I filtered out the useless information and present to you only the useful need-to-know details in an easy to understand way.

. . The first half of this tutorial will explain what the UART is, while the second half will give you instructions on how to add UART functionality to your $50 robot. These are the different standards/protocols used from transmitting data. They are incompatible with each other, but if you understand what each is, then you can easily convert them to what you need for your robot.

RS232 is the old standard and is starting to become obsolete. Few if any laptops even have RS232 ports (serial ports) today, with USB becoming the new universal standard for attaching hardware. But since the world has not yet fully swapped over, you may encounter a need to understand this standard.

Back in the day circuits were noisy, lacking filters and robust algorithms, etc. Wiring was also poor, meaning signals became weaker as wiring became longer (relates to resistance of the wire). So to compensate for the signal loss, they used very high voltages. Since a serial signal is basically a square wave, where the wavelengths relate to the bit data transmitted, RS232 was standardized as +/-12V.

To get both +12V and -12V, the most common method is to use the MAX232 IC (or ICL232 or ST232 - different IC`s that all do the same thing), accompanied with a few capacitors and a DB9 connector. But personally, I feel wiring these up is just a pain. . . here is a schematic if you want to do it yourself (instead of a kit): Today signal transmission systems are much more robust, meaning a +/-12V signal is unnecessary.

The EIA232F standard (introduced in 1997) is basically the same as the RS232 standard, but now it can accept a much more reasonable 0V to 5V signal. Almost all current computers (after 2002) utilize a serial port based on this EIA-232 standard. This is great, because now you no longer need the annoying MAX232 circuit! Instead what you can use is something called the RS232 shifter - a circuit that takes signals from the computer/microcontroller (TTL) and correctly inverts and amplifies the serial signals to the EIA232F standard.

The cheapest RS232 shifter I`ve found is the $7 RS232 Shifter Board Kit from SparkFun. They have schematics of their board posted if you`d rather make your own. And this is the assembled image. Notice that I added some useful wire connectors that did not come with the kit so that I may easily connect it to the headers on my microcontroller board. Also notice how two wires are connected to power/ground, and the other two are for Tx and Rx (I`ll explain this later in the tutorial).

The UART takes bytes of data and transmits the individual bits in a sequential fashion. At the destination, a second UART re-assembles the bits into complete bytes. You really do not need to understand what TTL is, other than that TLL is the signal transmitted and received by your microcontroller UART. This TTL signal is different from what your PC serial/USB port understands, so you would need to convert the signal.

You also do not really need to understand USB, other than that its fast becoming the only method to communicate with your PC using external hardware. To use USB with your robot, you will need an adaptor that converts to USB. You can easily find converters under $20, or you can make your own by using either the FT232RL o 🔗 External reference