So, I'm building a battery-powered rocket motor thrust stand and I chose Arduino Nano to control everything. I need a precise clock to set timestamps correctly. I've connected DS3231 to Arduino Pro Mini and noticed a strange behavior – although all four connections are soldered correctly, the board doesn't go past rtc.begin(). I've tried many different libraries, so I'm sure the issue is hiding somewhere else.
You might think that the module is just faulty, that's what I thought too. Then, I've decided to connect it to Arduino Mega and it worked just fine. Since DS3231 module has SCL, SDA, VCC and GND pins on both sides, I've connected it to Mega using the available ones. These will be connected to HX711 after I'm done troubleshooting the issue. I've found out that I accidentally slightly shorted VCC and GND pins on the Pro Mini – it was heating up more than it should. I've de-soldered it and got Arduino Nano instead, thinking the problem will go away. It didn't. But, there's a very confusing configuration that allows the whole system to operate.
So, the setup is as follows:
Nano and DS3231 are connected to steady 5v battery power or USB when debugging
Nano and DS3231 are connected to each other via A4 - SDA and A5 - SCL pins
All four connections on the other side of the SD3231 are connected to Mega as follows:
GND - GND
VCC - 5V
SDA - SDA
SCL - SCL
Mega has the default blink test.
Nano has the DS3231 test.
Mega contributes literally nothing to this system, but as soon as I disconnect any of the 4 connections between it and DS3231, Nano stops printing date and time. Confusing. Here's something worth mentioning: the I2C scanner stalls on "scanning" when Mega isn't connected. Any ideas?
Interesting... You see, as with any new module I've tried searching for available tutorials and all of the ones I've seen never mention pull-up resistors, some of them use the Nano board. I guess I can try connecting SCL and SDA to 5V via 10K ohm resistors.
My DS3231 has no 3v battery attached. I don't need it either since I only need the time to be persistent, I don't care about long term time preservation. Do I need one to make the module work with Nano?
It looks like I've managed to solve the issue by connecting both SDA and SCL to VCC via two 179.1 ohm resistors. The Nano board began to spit out date and time without being connected to Mega. The thing is, I've tried disconnecting the resistors... and it continued to work just fine. Trying to figure out what's going on, I've unplugged the power. Then, I've reconnected it to the board. Now it's silent again.
It seems like the DS3231 module requires less resistance in order to start up properly with Arduino Nano. By providing the 179.1 ohm connection, I've bypassed 4.5K ohm resistors and allowed the module to initialize. Why? No idea, I'm not that good at electronics to determine the reason. But it works now, I guess I'll have to add these resistors permanently to the circuit. I don't know the parameters of the resistors that would be the best though, the 179.1 ohm ones were picked just because they were lying around.
UPDATE: no resistor soldering required! After trying to short SDA to VCC directly for a brief moment, DS3231 began working correctly. I'm not sure what exactly happened here since I didn't change anything permanently. Now it just works, even after complete power loss. Maybe it has something to do with the DS3231 firmware, I could've triggered something to change the initialization sequence. No idea, it looks like DS3231 is just a mysterious module that people struggle with for no apparent reason.