How to establish UART communication between ATmega8 and Arduino Uno?

Here we are going to establish a communication between an ATmega8 microcontroller and Arduino Uno. The communication established here is UART (Universal Asynchronous Receiver Transmitter) type. It’s serial communication. By this serial communication data can be shared between two controllers, which is a required in various embedded system applications.

ATmega8-and-Arduino-UART

In embedded systems we must have basic knowledge about system communications, so for this we are doing this project. In this project we will discuss basic communication system and we will send some data from transmitter to receiver in serial. 

In this project ATMEGA8 acts as a TRANSMITTER and ARDUINO UNO acts as a RECECIVER. In serial communication we will send data BIT BY BIT, until a BYTE of data is transferred completely. The data can be of 10bit size but we will keep to 8BITS for now.

Components Required

Hardware: ATMEGA8, ARDUINO UNO, power supply (5v), AVR-ISP PROGRAMMER, 100uF capacitor (connected across power supply), 1KΩ resistor (two pieces), LED , Button.

Software: Atmel studio 6.1, progisp or flash magic, ARDUINO NIGHTLY.

Circuit Diagram and Explanation

Before we discuss the circuit diagram and programming for transmitter and receiver, we need to understand about the serial communication. The ATMEGA here sends data to the UNO in serial as discussed earlier.

Arduino ATmega-UART-Circuit 0

It has other modes of communication like MASTER SLAVE communication, JTAG communication but for easy communication we are choosing RS232. Here we will connect the TXD (Transmitter) PIN of ATMEGA8 to RXD (Receiver) PIN of ARDUINO UNO

The data communication established is programmed to have:

  1. Eight data bits
  2. Two stop bits
  3. No parity check bit
  4. Baud rate of 9600 BPS(Bits Per Second)
  5. Asynchronous communication(No clock share between  ATMEGA8 and UNO (both have different clock units))
  6. For establishing UART between Arduino Uno and ATMEGA8 we need to program the setting accurately. For this we need to keep the above mentioned parameters same at both ends. In this one acts as TRANSMITTER and other acts as RECEIVER. We will discuss each side settings below. Now for the RS232 interface, the following features must be satisfied for the TRANSMITTER side (ATMEGA8): 1. The TXD pin (data receiving feature) of first controller must be enabled for TRANSMITTER. 2. Since the communication is serial we need to know whenever the data bye is received, so that we can stop the program until complete byte is received. This is done by enabling a data receive complete interrupt. 3. DATA is transmitted and received to controller in 8bit mode. So two characters will be sent to the controller at a time. 4. There are no parity bits, one stop bit in the data sent by the module.
serial communication atmega

DARK GREY (UDRE): This bit not set during startup but it is used during working to check whether transmitter is ready to transmit or not. See the program on TRASMITTER SIDE for more details.

VOILET (TXEN): This bit is set for enabling transmitter pin on TRASMITTER SIDE.

YELLOW (UCSZ0, UCSZ1, and UCSZ2): These three bits are used for selecting the number of data bits we are receiving or sending in a single go.

Read More:   How to establish UART communication between ATmega8 and Arduino Uno?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top