dushyantahuja/Smart-Infinity-Mirror

Code get stuck at rtc.begin();

Closed this issue · 6 comments

I only have an UNO, RTC and DC converter conncted.
IMG_20200519_200813

Code stops at "rtc.begin();" in the beginning of setup().

I need to unplug both wires for PC4 and PC5 to the RTC DS1302 before the code continues.
Then I get next printlns....
The LED strip never turns on.

RTC broken? Wrong HW setup? Error in RTClib?

20:01:48.454 -> Point after Serial.begin(115200);
20:01:48.454 -> Point after Wire.begin();


20:01:55.608 -> Point after rtc.begin();
20:01:55.608 -> Point after FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
20:01:55.608 -> Status: 
20:01:55.608 -> BG: 0 255 0
20:01:55.608 -> SEC: 255 255 255
20:01:55.608 -> MINUTE: 255 0 0
20:01:55.608 -> HOUR: 0 255 0
20:01:55.608 -> Light set - High:55

I'm sorry I don't have an RTC module at hand to check the issue. Can you try running the sample code within the Arduino IDE and check if the RTC is working correctly.

The LEDs won't switch on till the arduino know what the time is (and that requires the RTC).
Maybe try switching A4 and A5 - maybe you have the wires crossed.

It seems to lock when it communicates with the RTC. In the list of item you have listed the DS1302. Hower the lib is for a DS1307. DS1307 communicates over I2C interface and the 1302 communicates over SPI... I guess that is the problem. I have ordered a 1307 now, hope to this solves the issues.

It seems to execute a bit longer in the setup code for the RTC when I use a RTClib lower than 1.7.0.
1.7.0 get stucks earlier in the code compared to the lower revisions.

Hmmm - can you try to use this library instead:
https://github.com/NeiroNx/RTCLib

Looks like Adafruit library is not supporting DS1302.

Then you will need to change line 26 from

RTC_DS1307 rtc;

to

// ce_pin  (RST): 6
// sck_pin (CLK): 7
// io_pin  (DAT): 8
DS1302 rtc(6,7,8);

Connect the DS1302 to pins 6,7,8 as above.

Ok, thanks
6,7,8 = PD6, PD7 and PD8?

They are marked as 6,7,8 on the Uno - you have the LEDs connected to 5 - so, the pins next to it.

Thanks code seems to to be working now, but I have maybe broken the DC1302 when I connected it to analogue ports (as DS1307). Because writing TIME to it do not work. I following the set_time all the way to the adjust function in RTClib.cpp. Correct data is goint to the writes to the RTC, but when I read them back, I get only zeros.
I ordered a DS1307, so I have to wait for it. Thanks for the help. Hope I get it working with a new RTC.