ESP8266 master / Attiny85 Slave i2c problem

Both TX and RX are idle high.
The TX from the ATtiny85 has a strong high output that can push current into the ESP chip. You can avoid that with a protection resistor of 1k or 4k7 or so in the signal path. You can also add a diode and resistor.

An ATtiny85 does not have a crystal, and the internal oscillator might not be accurate enough for a good baudrate. I don't know how to fix that.

The ESP8266 has the SoftwareSerial library which is not so bad.
The ESP32 has a spare Serial2 port.

Meanwhile, I have been thinking how to fix the I2C bus, but I don't know enough of the USI hardware inside the ATtiny85 that controls the I2C bus.

If i was to use pinMode(TXpin, INPUT) on ATTiny after transmission of data to ESP would that drop the current on the TX pin. And then when I use the ATTiny to start up the ESP again I would swap it back to pinMode(TXpin, OUTPUT) when sending data ?

Yes, that is possible if there is a Serial.end() to release those pins. After that, you can make the pins input.
When the ESP has started, you can call Serial.begin() again.

If there is no Serial.end(), then I don't know. I have used ATtiny chips in the past, but I have forgotten most about it.

I have been mucking around with settings and I have now set the ATTiny85 CPU speed to 16MHz, its been running for a day without a problem. I will also try a different model of ESP8266 instead of the D1 mini I am currently using, and also an ATTiny13.

After alot of dicking around I found a solution to the problem of phantom power going from ATTiny to ESP8266 via i2c wires.

I used a 2N7002 N-Channel mosfet on both the SDA and SCL lines.
Its been working for a month or so without issue.

attiny85_i2c

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.