Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on ESP32 Lolion32 #1

Open
MerlinTheProgramist opened this issue May 2, 2021 · 5 comments
Open

Not working on ESP32 Lolion32 #1

MerlinTheProgramist opened this issue May 2, 2021 · 5 comments

Comments

@MerlinTheProgramist
Copy link

MerlinTheProgramist commented May 2, 2021

It is not working on esp32 on ports that you mention in the table, maybe there is a slip-up with it. I tested it on Arduino Uno and it works great with the same RTC. With the Example that U posted I get a debug "RTC not found". I'm also not connected to the SQW pin on the RTC, but I think it is not required to just get/set time. It could be my fault but IDK.

@Erriez
Copy link
Owner

Erriez commented May 2, 2021

@MerlinTheProgramist Then the example prints "RTC not found, it is recommended to start with running an I2C test program to check the presence of the DS1307 I2C address to double check the wiring.

@MerlinTheProgramist
Copy link
Author

MerlinTheProgramist commented May 2, 2021

@Erriez
I get this
image
sometimes it founds I2C device and sometimes no and the address is always different. Is This pointing at my wiring?

@Erriez
Copy link
Owner

Erriez commented May 10, 2021

Please find some hints below to double check:

What happens when reducing the I2C clock speed to 100kHz, or even lower to 10kHz?

// Set I2C clock to 100 kHz
Wire.setClock(100000);

Is the I2C device powered to the same 3V3?
Is the DS1307 VCC around 3V3?
Are the pull-up resistors on SDA/SCL pins connected and in the range of 4k7..10k?
Are there any other I2C devices connected to the I2C bus? It is recommended to test with one DS1307 directly connected to the ESP32.

Please notice that I2C communication problems are beyond the scope of this DS1307 library.

@josef2600
Copy link

josef2600 commented Jun 4, 2023

sorry to bug you here! but i wanted to thank [Erriez] and add few things:

  1. this is a perfect library. works perfectly with all its functions. including timezone and internet updating time and all. but in regarding the error's mentioned above, i have seen them too. they have nothing to do with this library.
  2. if you are using esp32 (any kind of them) you have to know something. although this esp32's are pretty unbeatable in many areas, there are designed and manufacturing in china. so, don't expect the same quality of MCU's like original microchip mcu's like pic32 or pic16 etc. personally, i learned coding with pic16 (around 20 years ago) and they have special places in my mined and my work. but in the past few years, i cant fined anything better than esp32 to work with. only if i have to do something very sensitive or special design i go with pic. they don't make mistake or bu-gout or creep out. and when i work with them. usually i don't have to have to fix something in the code or get in odd situations. but in esp32, almost never can get relax ! there is always something go bad. for example, right here in i2c mode. if you work with arm-pic-avr, there is no problem. but with esp32 there are a ton of errors and mistakes that will happens. for example, base on datasheet, when you put pins in i2c mode, it automatically make the pull up resistors inside, enable for both pins. but then good-luck working with it! it is never reliable. and if you want the speed more that 50khz, then good luck again! it is unreliable again! you have to use resistor's with the value of 2k ohm pull up on both pins. this is written on the datasheet for speeds over 100khz. but i have tested on many chips and the result is the same, nop! if you go over 50khz , you have to use 2k ohm resistors. i usually have to work with the speed of 10khz so i don't get errors like bad addresses or bad data. so, working with esp32 is a headache. but because of all its functionality and price, i am using it.
  3. i have moved from ds1307 to other rtcc like MCP79410 . it is extremely more accurate and more stable with way better options like more SRAM and 1k internal eeprom with low price. for one example, if you are using ds1307 you will get few hours error in a month, but with MCP79410 you get only few minutes (or less). it is because of newer design and having error correction inside it. ds1307 has a 120 ppm error (but it usually is more than that!) , but MCP79410 has a 1 ppm error! go figure. and MCP79410 is able to work with 5 volt battery and vdd of 3.3 volt. yes, you read it correctly! the vbat can be more than vdd and it wont use vbat unless vdd gets lower than 2.7 volt(datasheet). this thing alone is amazing. i am thinking of using rechargeable battery with 5 volt and vcc of 3.3 so i get alot more time with one charge.

hope i could have been some help.

@Erriez
Copy link
Owner

Erriez commented Jun 4, 2023

@josef2600 Thanks for sharing your info! The deviation error with the DS1302 is even worse, but DS3231 is already better than DS1307. However, it depends on the chip itself as there are a lot of clones / fake chips around. The MCP79410 is new for me, so I'll check where to buy it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants