Feather Adalogger can't access DS3231 - RTC

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
beaming
 
Posts: 6
Joined: Tue Feb 28, 2023 7:14 pm

Feather Adalogger can't access DS3231 - RTC

Post by beaming »

I have encountered a rather unusual problem, while attempting to use an external DS3231 real time clock with a Feather Adalogger M0 (Product ID = 2796). Since the Adalogger does not have a built-in RTC, I am attempting to use it with a DS3231 RTC module, so that I can time stamp my log entries stored on the micro SD card. The RTC I am using is labeled "ZS-042", and is one of three known working generic DS3231 modules that I have tried to use with the Adalogger. When I plug these RTC modules into another "ProMini" Arduino, they all display & retain the correct date and time, using the Serial Monitor on another PC. Since I removed the battery charging resistor and the power indicator LED from all of these RTC modules, they draw less than 0.08 mA quiescent current from the +3.30 volt supply, and they draw about 0.32 mA when they are being polled by the Adalogger.

The problem using the RTC with the Adalogger is this .... using the supplied example sketch from "Examples > Examples from Custom Libraries > RTClib > ds3231.ino", the date, time, and temperature readouts on the Serial Monitor are totally wrong. The date and times displayed are all scrambled, and look something like this :
---------------------------------------------------------------------
RTC lost power, let's set the time!
2000/38/15 (Thursday) 0:0:0
since midnight 1/1/1970 = 1031184000s = 11935d
now + 7d + 12h + 30m + 6s: 2002/9/12 12:30:6
Temperature: 17.00 C

2000/3/148 (Wednesday) 39:25:0
since midnight 1/1/1970 = 964711500s = 11165d
now + 7d + 12h + 30m + 6s: 2000/8/4 3:55:6
Temperature: 17.00 C
---------------------------------------------------------------------
When I take the same DS3231 modules to my other Pro Mini Arduino circuit, and load the same sketch, the dates and times are all still correct, using each of the three spare ZS-042 clock modules! Also, I know for a fact that the CR2032 backup batteries are all in the normal voltage range of 2.9 to 3.0 volts, so the "RTC lost power" error message is definitely bogus. I even went so far as to completely uninstall the older 1.8x version of the Arduino IDE and install the newest version of the IDE (version 2.0.4), but the new version of the IDE produces the same kind of error messages as the older version of the IDE.

I even thought that perhaps there was a hardware problem with the SDA or SCL data/clock lines in the Adalogger, but the odd thing is that the Adalogger can access an Adafruit "LIS3MDL" module via I2C with no problems, so that tends to rule out hardware problems with the I2C bus in the Adalogger. I even removed the "LIS3MDL" module from the circuit, but the same RTC errors are still there. It seems like there is at least SOME communication with the RTC, but the data coming from it is all scrambled.

So after trying all these things, I am drawing a blank as to what to try next to correct this RTC issue. Please provide me with some ideas about what to try next, to resolve this problem.

Thanks!

User avatar
dastels
 
Posts: 15819
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by dastels »

What exactly do you have? Where is it from? Can you post a link to a product page? Posting photos of both sides of the RTC board would be helpful as well.

Dave

User avatar
beaming
 
Posts: 6
Joined: Tue Feb 28, 2023 7:14 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by beaming »

Here is a picture of one of these DS3231 modules ....
DS3231.jpg
DS3231.jpg (379.86 KiB) Viewed 44 times
They are everywhere on Amazon & eBay - very common, and are surprisingly accurate considering the price. The three modules I am working with have stayed within one minute of the actual time, after sitting on the shelf for six months! (I checked their functionality using the same test sketch on a different Arduino.) They just don't work with the Adalogger.
Attachments
DS3231.jpg
DS3231.jpg (379.86 KiB) Viewed 44 times

User avatar
beaming
 
Posts: 6
Joined: Tue Feb 28, 2023 7:14 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by beaming »

OOOpps .... Sorry about the image size, and double image (newbie mistake).

User avatar
dastels
 
Posts: 15819
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by dastels »

I'm not sure what you expect. They aren't Adafruit boards and, frankly, the workmanship looks pretty shoddy in places. I'm not sure what your recourse is with wherever you got it, but you'd have to take it up with them. There's probably something borderline with some signals or timing that let it work on an old, slow ATMega328 and not the faster, more modern SAMD21.

Dave

User avatar
beaming
 
Posts: 6
Joined: Tue Feb 28, 2023 7:14 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by beaming »

I finally figured out what the problem with these modules was. Three years ago when I was using these modules for a battery powered project, I had previously removed the pullup resistor pack (next to the "VCC" pin). This resistor pack supplies a pullup voltage for the I2C bus at the RTC module. Without these pullups, the I2C bus voltage goes to zero, so no I2C bus communication happens. The other Arduino I was testing these modules with had the pullup resistors, but the Adalogger test circuit did not have them.

When I added two 10K pullup resistors from SDA & SCL to +3.30 Vcc, all was working correctly again - the time and date are now readable by the Adalogger. Problem solved!

Anyone who is using the ZS-024 / DS3231 module with both resistor packs installed should have no problems.

Thanks for the advice, Dave.

User avatar
dastels
 
Posts: 15819
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather Adalogger can't access DS3231 - RTC

Post by dastels »

That'll do it. In general, no Adafruit MCU board has I2C pullups. The exceptions are boards with I2C devices onboard. E.g. the Feather sense, or some of the newer ESP32-S* boards that have a battery monitor.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”