Main Content

I2C Master Mode Emulator

This emulator allows communication with I2C devices by sending or receiving data to/from the I2C bus through a PC.

The I2C master mode emulator allows communication with I2C devices by sending or receiving data to/from the I2C bus. To issue the I2C commands, the emulator should connect to a PC over the USB port. After initializing the emulator, the PC and directly control the I2C slave chip/module.

I2C is a popular data bus to communicate with inter-board peripherals. Today I2C based chips and modules are widely available in many categories, including data storage, ADC/DAC, I/O Expanders, sensors, etc.

The I2C master mode emulator allows communication with I2C devices by sending or receiving data to/from the I2C bus. To issue the I2C commands, the emulator should connect to a PC over the USB port. After initializing the emulator, the PC and directly control the I2C slave chip/module.

This emulator is base on ATmega16A MCU. The USB communication channel is develop using the V-USB firmware.

To simplify the assembly, the PCB of this emulator is designed on a single-side board. The dimensions of the PCB are 96.77mm × 110.73mm. All the parts used in this project are through-hole-type, generally available components.

This emulator needs an external power supply, and the recommended supply voltage is between 12V - 15V.

————— more —————
Control software and commands
The control software of the emulator is developed using libusb and tested only with Linux operating systems. The current firmware and control software support I2C emulation on 100kHz, 250kHz, and 400kHz clock rates.

Following commands are available for the I2C test terminal:

init - To initialize the I2C bus with the given clock rate.
start - Issue START condition to the I2C bus.
stop - Issue STOP condition to the I2C bus.
write - Write given byte value to the I2C bus.
write-address - Set slave address with read/write flag.
read - Read data byte received from the slave device.
output-voltage - Command to set the output voltage to 5V or 3.3V.
reset - Reset emulator and I2C bus.
exit - Exit from the terminal application.
help - Display help screen.
All the above commands are explained in the project documentation at the GitHub repository.

I2C test terminal has an auto-complete command prompt. To use this option, press the TAB key twice on the command prompt.

Before launch the terminal control application, the I2C Emulator device must connect to the PC and needs to power up.”

Link to article