-->
Page 1 of 2

ESP8266 I2C Master to Atting85 I2C Slave issue....need help.

PostPosted: Fri Jan 08, 2016 10:29 am
by Greg1978
I am trying to get I2C to work between my ESP12 on a NodeMCU board and a Atting85 slave.

When I run the code I get no response from the Attiny85. It is supposed to send a request to the Attiny85 and then the Attiny85 is supposed to send response. From what I can see I think I have every thing wired up correctly.

Can any one spot any problems in my setup or code?

My setup:

Image



My Code:

I2C Master
Code: Select all//I2C Master for NODE MCU


#include <Wire.h>

#define SLAVE_ADDR 0x50

void setup()
{

  Wire.begin(0,2); //set GPIO0 and GPIO2 pins
  Serial.begin(9600);
  Serial.println("");
   Serial.println("I2C Test");
 
}

void loop()
{
  Wire.requestFrom(SLAVE_ADDR, 1);

 
  if (Wire.available())
  {
    byte byteReceived = Wire.read();
    Serial.println(byteReceived, DEC);
  }

 delay (1000);
}



I2C Slave (Attiny85)

Code: Select all#include "TinyWireS.h"

#define SLAVE_ADDR 0x50

void setup()
{
  TinyWireS.begin(SLAVE_ADDR);
  TinyWireS.onRequest(requestEvent);
}


void loop()
{
}

void requestEvent()
{
  byte byteToSend = 15;
  TinyWireS.send(byteToSend);
}

Re: ESP8266 I2C Master to Atting85 I2C Slave issue....need h

PostPosted: Fri Jan 08, 2016 5:06 pm
by martinayotte
Looking at your wiring, I see that you placed the GND to pin 1 of the ATTiny, but it should be on pin 4.

Re: ESP8266 I2C Master to Atting85 I2C Slave issue....need h

PostPosted: Fri Jan 08, 2016 5:16 pm
by 8n1
The GND Pin of the ATtiny is not connected.
Looks like you are mixing up Reset(Pin1) and Gnd(Pin4).

Re: ESP8266 I2C Master to Atting85 I2C Slave issue....need h

PostPosted: Fri Jan 08, 2016 5:18 pm
by 8n1
Hihi @martinayotte
This is what happens when you leave the the desk for a few minutes and didn't check for new posts. :) - But theres worse. :D