DS3231 RTC with esp8266

Posted on
  • Running a nodemcu lolin v3 and trying to communicate with a DS3231 which is on a ZS-042 board.
    Tried using the module for DS3231 but no luck so far..

    My Code:

    I2C1.setup({scl:15,sda:0});
    var rtc = require("DS3231").connect(I2C1, { DST : false });
    setInterval(function() {
      console.log(rtc.readDateTime());
    }, 1000);
    

    Error:

    in function called from system
    Uncaught InternalError: I2CWrite: No ACK 0
     at line 1 col 23
    this.i2c.writeTo(104,0);var a=this.i2c.readFrom(104,7),b=e(a...
                          ^
    in function "readDateTime" called from line 1 col 30
    console.log(rtc.readDateTime());
    

    Any thoughts of what i might be doing wrong ? , maybe the module isn't right for me.

  • Hi, check this link and try this sample.

    If this works for you, please add your test code and some comments - if you like :)

  • Tried your code and resulted in this error:

    Uncaught InternalError: I2CWrite: No ACK 0
     at line 1 col 40
    ...teTo(104,[4,parseInt(a,16)]);this.i2c.writeTo(104,[5,parseIn...
                                  ^
    in function "setDate" called from line 1 col 68
    ...onth(),Date().getFullYear());
                                  ^
    >Uncaught InternalError: I2CWrite: No ACK 0
     at line 1 col 27
    this.i2c.writeTo(104,[0,0]);this.i2c.writeTo(104,[1,parseInt...
                              ^
    in function "setTime" called from line 1 col 71
    ...utes(), Date().getSeconds());
                                  ^
    =undefined
    Uncaught InternalError: I2CWrite: No ACK 0
     at line 1 col 23
    this.i2c.writeTo(104,0);var a=this.i2c.readFrom(104,7),b=e(a...
                          ^
    in function "readDateTime" called from line 1 col 30
    console.log(rtc.readDateTime());
    
  • Uncaught InternalError: I2CWrite: No ACK 0

    Make sure you connected SDA and SCL to the pins you use.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

DS3231 RTC with esp8266

Posted by Avatar for Gustav @Gustav

Actions