ESP8266 Gateway and I2C RTC



  • Hi all,

    First time post. Have been slowly learning the basics of this wonderful library.

    I have an ESP8266 NodeMCU as my gateway. It has a nRF24.. radio for communication to the nodes. I've also placed a SD card module on the gateway which appears to be working. This setup appears to be communicating fine with my first node. The SD card module is there for logging as I would like a record of all the goings on in my planned array of nodes.

    Just to try my luck I also want to place a RTC module on the gateway mostly so I could also log the date and time an event occurred. I have a DS3231 module that works on my test Nano. So I've tried it on the ESP8266 with no problems using the same test code as the Nano which is the DS3132 sketch from the RTClib written by Adafruit. But when I incorporate this code into the Gateway code the clock no longer functions giving me an incorrect date and time.

    I've just rechecked and it appears the RTC code doesn't work on the ESP8266 in either situation. So I suppose my question now changes to - Does I2C work on the ESP8266 ? I am using D1 for SCL and D2 for SDA as I read.

    Any leads would be greatly appreciated.

    Steve


  • Mod

    @amongstmyselves Welcome to the forum!
    I2c should just work fine on esp8266.
    I don't have access to the esp pin layout atm, so I cannot check your pin mapping, but I wondered if you have the required pull-up resistors on the i2c scl and sda lines?



  • @Yveaux Thanks for the quick reply.

    Ah yes I did forget the pull ups. Not use to using them. Anyhow, it made the stand alone RTCLib example work mostly which was just a simple clock program but the Gateway still not working. Not getting the correct date and time from the RTC. I say mostly because the code doesn't seem to report the module not connected from the function rtc.begin() ?

    Steve


Log in to reply
 

395
Online

6.7k
Users

7.6k
Topics

80.3k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.