Archives

ESP8266 NodeMCU Module – I2C

Pr-Request to Lean

 

ESP8266 I2C Core

ESP8266 hardware supports only one i2c. But in  bit-banking(Bar Metal code) method you can use all your gpio pin as i2c pins. ESP8266 NodeMCU firmware platform supports only standard speed mode (Sm) 100khz . That means ESP8266 NodeMCU firmware supports 100Kbps for data transfer.

 


ESP8266 I2C Scanner

  • Required NodeMCU Modules (Firmware) : GPIO Module, I2C Module
  • Required hardware : ESP8266 with Programmer (or)  NodeMCU Dev Kit
  • Required software tools : ESPlorer IDE Tool

Code

 


ESP8266 I2C Example

 

Code

 

 

 



See Also

 

 

ESP32 NodeMCU Module – I2C

Pr-Request to Lean

 


ESP32 NodeMCU Module I2C Functions

  • i2c.address()  – Send (SW) or queue (HWx) I²C address and read/write mode for the next transfer.
  • i2c.read()  – Read (SW) or queue (HWx) data for variable number of bytes
  • i2c.setup()  – Initialize the I²C interface for master mode.
  • i2c.start()  – Send (SW) or queue (HWx) an I²C start condition.
  • i2c.stop()  – Send (SW) or queue (HWx) an I²C stop condition.
  • i2c.transfer()  – Starts a transfer for the specified hardware module.
  • i2c.write()  – Write (SW) or queue (HWx) data to I²C bus.
  • i2c.slave.on()  – Registers or unregisters an event callback handler.
  • i2c.slave.setup()  – Initialize the I²C interface for slave mode.
  • i2c.slave.send()  – Writes send data for the master into the transmit buffer.

 


ESP32 I2C Scanner Code

  • In this code used to can the i2c Devices
  • Used Software i2c and GPIO-23 as SDA and GPIO-22 as SCL of I2C Device
  • Connected DS3231 Device and check i2c address of DS3231

Code

Results

 


See Also

 


Next :

Previous :


 

Embedded Protocol – I2C

 I²C (Inter Integrated Circuit) is a bi-directional two wires and serial  data transmission communication protocol developed by  Philips (Now NXP Semiconductor) at 1982. I2C is a Half-duplex communication protocol  – (I2c can’t send and receive  same time in bus-Data line). Multi master can communicate with multi salve. (Note : Can’t Communicate one master to another master, One master can communicate with single slave or multi slave). I2C is a Level Triggering. A device that sends data onto the bus is defined as transmitter, and a device receiving data is defined as receiver. The bus has to be controlled by a master device which generates the Start and Stop conditions, while the Some devices like LCD, EEPROM, RTC are works as slave. Both master and slave can operate as transmitter or receiver, but the master device determines which mode is activated.

Read more… →

if you have any queries call us +918300026060 or WhatsApp Dismiss

0

Your Cart

%d bloggers like this: