Emulation of I2C protocol to understand the bit level working of the protocol

Almost all microcontrollers have I2C and other communication units built into them so we no longer bother about actual bit level working of the protocols. There are lots of articles on the Internet about the working of I2C. How about emulating the I2C protocol using GPIO pins? Doing this gives you an understanding of the I2C communication protocol itself in action.

Nowadays people get introduced to Embedded Systems through Arduino or similar development boards. Using Arduino development boards and IDE is one of the best and the simplest way one could develop their Embedded projects.

Arduino Uno which uses Atmel ATmega 328P has communication protocols like I2C, SPI and UART inbuilt. There are separate units for each protocol mentioned and respective registers mapped to them. According to the datasheet we have to understand how to program the registers to send and receive data.

Earlier days there were 8051 and 8052 microcontrollers. Don’t know if they are still available in the local electronics shops (haven’t been there quite a while). The 8051 only had a UART controller in it and if you had a SPI or I2C peripheral chips such as an ADC, DAC, EEPROM, RTC, etc. we had to emulate the communication protocol using normal GPIO pins. Doing this, you get a good learning experience of how a particular protocol works at the bit level.

Some time back I made a SMS based Home Automation project using 8051 which communicates with the RTC chip using I2C emulation. If somebody wants to understand and experience how I2C protocol works in bit level, they can see this project on Github: https://github.com/glowingthumb/home-automation

The project is primitive but one can get an idea how to communicate with different peripherals such as LCD, GSM Modem like SIM300, RTC, etc. in a much lower level compared to using Arduino and likes of it.

Youtube video:

Leave A Reply

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

Time limit is exhausted. Please reload the CAPTCHA.