-->
Page 1 of 1

How do u make an I2C with ESP12e and Arduino pro Mini 3.3V?

PostPosted: Wed Mar 29, 2017 11:31 am
by mojESP8266
Hi,

i would like to connect both devices through I2C.

Both are 3.3V.

My Serial Monitor on Arduino Pro Mini is blank. I see only initial welcome text but i dont receive anything from ESP.

What am i missing here?

ESP-12e as Master
Code: Select all#include <Wire.h>
#include <ESP8266WiFi.h>

int x = 0;
   
void setup() {   
  Wire.begin(2,14);

  Serial.begin(115200);
  Serial.println("*** MASTER - START ***");
}

void loop() {

  Wire.beginTransmission(9); // transmit to device #9
  Wire.write("x is ");       // sends five bytes
  Wire.write(x);             // sends one byte
  Wire.endTransmission();    // stop transmitting

  Serial.println(x);
 
  x++;
  delay(500);
}


Arduino Pro Mini 3.3V
Code: Select all#include <Wire.h>

void setup()
{
  Wire.begin(9);                // join i2c bus with address #9
  Wire.onReceive(receiveEvent); // register event
 
  Serial.begin(9600);           // start serial for output
  Serial.println("/// Slave - Start ///");
}

void loop()
{
  delay(100);
}

void receiveEvent(int howMany)
{
  while (1 < Wire.available()) // loop through all but the last
  {
    char c = Wire.read();      // receive byte as a character
    Serial.print(c);           // print the character
  }
  int x = Wire.read();         // receive byte as an integer
  Serial.println(x);           // print the integer
}


Wiring:
http://imgur.com/a/GQtfo
Image

Re: How do u make an I2C with ESP12e and Arduino pro Mini 3.

PostPosted: Mon Apr 03, 2017 12:46 am
by jsaily
Pull-up resistors (like 5k or 10k) to +3.3V in both I2C lines seem to be missing from your wiring schematic!

Re: How do u make an I2C with ESP12e and Arduino pro Mini 3.

PostPosted: Fri Apr 21, 2017 10:16 am
by JimDrew
Yes, 2.2K pull-up resistors on the SDA and SCL lines are the recommended setup.