Questions tagged [rtc]
Real-Time Clock. Keeps track of current date/time. Some have batteries like the DS3231, and the DS3231 also has programmable alarms that can interrupt an Arduino.
188 questions
10
votes
3
answers
70k
views
Convert to and from Unix Timestamp
What is the best way to convert between date, hours, min, seconds to Unix timestamp in milliseconds in Arduino? I need to have this conversion, since I'm using RTC (date, hours, min, secs etc) and ...
8
votes
1
answer
33k
views
The difference between "time_t" and "DateTime"
I've run into an issue trying to combine 2 different Arduino timer projects I've found online.
For both projects I'm using a DS3231 RTC, but have been able use the DS1307 library just fine in my ...
5
votes
10
answers
15k
views
DS1307RTC Outputting cryptic 165/165/2165 date. What are some possible fixes?
My board.
I think I have it wired correctly (the lights aren't, but the board is).
I've read through the first few Google results to no avail.
My sample code to test the chip:
// Date and time ...
5
votes
3
answers
3k
views
Calculate absolute time based on cycles and RTC
I'm developing a low power data logging device. It samples sensors at the frequency of 20Hz, and also has a real time clock for absolute time (the logged time need to be exact down to ms).
I think ...
5
votes
1
answer
2k
views
ESP32 how to preserve RTC time during brownout
I want to use the ESP32 built-in RTC clock.
In my situation, my ESP32 will not have access to an NTP server
I do not want to use external RTC modules
ESP32 provides a pin VDD_RTC will powers the RTC ...
5
votes
1
answer
2k
views
RTC resets when power is off
I have a few RTC modules with a batteries. All of them have this same issue with my project.
They work fine when connected via USB. But if I disconnect the power then reconnect they reset to Jan 1 ...
5
votes
0
answers
2k
views
How to set ESP32 RTC clock source
According to the manufacturer's link below, the default RTC timekeeping in the ESP32 is supposedly based on Internal 150 kHz RC oscillator.
Apparently, there is another option called Internal 8.5 MHz ...
4
votes
2
answers
2k
views
RTC interrupts and coin batteries
Summary
I'm having problems with my RTC draining its coin cells quickly - fresh batteries are drained in a few months. The RTC is set to signal an interrupt every 5 minutes, and I wonder - if there ...
3
votes
6
answers
23k
views
Creating a timer using a Real Time Clock with start and stop times
I have an Arduino Uno with a motor shield, as well as a DS1307 RTC that I am using to control 2 pumps.
Ideally I would like to set a start time (startHour + startMinute) and end time (endHour + ...
3
votes
3
answers
830
views
How to have some code executed at a certain time of day with a DS3231 RTC?
I recently bought a DS3231 RTC, but I cannot seem to figure out how to get it to work. I have tried all different tutorials and example programs but I keep getting 2165.25.165 165:165:165 as the ...
3
votes
2
answers
1k
views
How to improve date-time control from RTC?
I want to run cameras at a remote site from external batteries as long as possible. I need power-miser Arduino to switch battery power on/off at set intervals (e.g. 5 min) during daytime only. I am a ...
3
votes
2
answers
2k
views
Nextion Display not getting updated data
I am using an Arduino Mega to display the readings of 4 pots on a Nextion Display as well as store them on an SD Card with a time stamp. I keep getting:
recvRetCommandFinished err
on the serial ...
3
votes
1
answer
9k
views
How to set Alarms on the DS3231 easily so the Nano doesn't have to go to sleep with delay statements?
I want my solar array sun tracker to shut down at night then move full east in the morning to catch the first rays.
I know the DS3231 can set alarms but it is not clear from its documentation how ...
3
votes
1
answer
6k
views
Comparing time_t values within an if statement
I am using an UNO with a RTC to control a light board. I'm using a simple control structure to decide when to turn things off and on. It's my understanding that a time_t value is just a number (number ...
3
votes
1
answer
1k
views
Using UART to Set RTC
I'm using an Adafruit NRF8001 Low Energy Bluetooth module and a Real Time Clock module with my Arduino board. I want to connect to the BLE module using UART to set the clock. I'll also be using UART ...
3
votes
2
answers
2k
views
How to wake up Arduino with an rtc?
I am doing a data logger with an Arduino Mega2560 and I want to use a code to make it sleep when no measure is needed and wake it up with an RTC when time comes. The reason I want this is because I ...
3
votes
2
answers
2k
views
Set control register to low in ds3231 rtc
I have been using ds3231 rtc module for keep tracking and make alarm along with backup battery. when I used it for first time it worked fine. but now it doesn't keep track my time when the power lose ...
3
votes
0
answers
227
views
Scheduling and BLE Read on demand
I'm building a data logging device with BLE capability using RFduino.
Sensors are read using timer interrupt to a buffer. When the buffer is full, then the whole buffer is written to SD card.
At the ...
2
votes
3
answers
10k
views
How to run a timer every 12 hours (exceeding the max size of int) without an RTC?
I'm experimenting with a Nano, and trying to trigger an action around twice a day. I'm aware that it's not super accurate, but I don't really mind, as long as it's in the ballpark.
I've tried using ...
2
votes
1
answer
2k
views
Reading atomic radio clock
i have some data logging to do. And i want some what accurate time meaning accuracy has to be +/- 1 minute.
I have considered a RTC, but then i thought. When i was 10 i got a watch that kept time ...
2
votes
2
answers
5k
views
Arduino RTC - getting the time from RTC after the power is cut off
I have a new DS1307 (original, not a Chinese rip off), with a new battery. It is working great, but when I turn the Arduino off (it is currently connected to laptop) and then turn it back on, it ...
2
votes
3
answers
3k
views
DS3231 not keeping time when Arduino is turned off
I am trying to make an LED clock using an DS3231 to keep track of time, but for some reason, it's not keeping time when the Arduino is turned off.
I tried to disconnect the clock from a power source ...
2
votes
2
answers
373
views
Use of "static" with "RTClib"
I've got a question concerning the Arduino library "RTClib" by Adafruit and the use of the word "static".
Here you can see an excerpt from the example provided for the pcf8523 real-time clock:
#...
2
votes
2
answers
2k
views
Adafruit RTC begin() not returning false
I am programming my arduino with the capability to keep time with the DS3231 from Adafruit. I do not have the module yet, but am trying to figure out the rest of the build without it.
However, it ...
2
votes
4
answers
335
views
Creating a clock using Arduino
I want to make a large clock, 16 inch x 7.5 inch, which will display dd Month yyyy.
What would be the best way to do this?
Does Arduino have a built in clock, and I'd just need logic to turn on/off ...
2
votes
1
answer
254
views
RTC DS1307 module not working
I have a problem with an RTC: it doesn't work correctly. When I try to read date or time, I only see the characters "àààààààà" or or the program is blocked.
#include <Wire.h>
#include &...
2
votes
1
answer
293
views
How to attempt connection to WiFi only once?
I am working on a garden timer project, I connect to WiFi once and if its successful show time from NTPClient or else show time from RTC.
I have been done the above, and it works in the sense that if ...
2
votes
1
answer
150
views
Arduino with interrupts enters in a locking state
I am quite noobish with using the interrupts on Arduino and I am facing a strange problem. I am using an Arduino Pro Mini, a light sensor and an RTC module(DS3231) which has set 2 alarms, one at ...
2
votes
2
answers
468
views
Using multiple RTC libraries in one program
There are multiple RTC libraries available, can I load several RTC libraries into my code and then use the functions I like from each one? Will there be some conflict if for example I include DS1307....
2
votes
6
answers
4k
views
RTC and SD work separately but not together
I am running a small project. I want to use an Arduino Mega 2560 v3, a PIR sensor, a micro SD card module, an RTC 1307 module, some LEDs, buttons and a buzzer. To enable and disable motion detection ...
2
votes
1
answer
209
views
Why this program runs on an R3 but will not run on R4 Wifi?
I have been working on this program for a few weeks now and finally got it somewhere near finishing. It uploads and seems to do what I want it to do on a R3 board but will not run on my R4 Wifi board ...
2
votes
1
answer
954
views
Second I2C on Due RTClib, can't start
I am using SDA1, SCL1 for my DS3232 with RTClib on Due. It works on a Mega2560 on SDA, SCL.
I ran I2c_test with success after I inserted
#define Wire Wire1
However with ds3231.ino this define doesnot ...
2
votes
1
answer
3k
views
How to Set RTC in ES32 using NTP server?
I am working on ESP32 And want to set RTC from the NTP server. How can I get epoch value I have done this thing on CC3200 launchpad and used an NTP server library to obtain epoch value.
2
votes
1
answer
237
views
Writing and Reading data from RTC module EEPROM_Arduino
i have took below code from https://lastminuteengineers.com/ds1307-rtc-arduino-tutorial/. i am not understand what these codes are doing. please help me to understand.
Wire.write((int)(eeaddress >&...
2
votes
2
answers
911
views
Using RTC DS3231 + Arduino UNO to calculate time lapsed [closed]
I am a beginner with no coding background.
I am trying to figure out an alarm that tells people how long they have been sitting on their chair.
The concept is very simple when the person would sit in ...
2
votes
1
answer
525
views
Advice for lower power clock type project
Arduino newbie here! I'm a programmer but my hardware knowledge is ... slim.
I'd like to build a clock type wake up timer for my daughter, using an Arduino type board. Probably overkill, but it's ...
2
votes
1
answer
285
views
Keep RTC time in a loop
I recently started a project with HC-SR04 sensors and RTC DS1302 clock. The idea is when a sensor detects an object, call and keep a timestamp (hh:mm:ss) all over the loop until Else If{} appears, ...
2
votes
2
answers
4k
views
How to code Arduino to follow schedule
I'm working on my system and I have to make arduino repeat such action or block of code if its the set time .. I'm using DS3231 module to track date and time .Example If I set the time in 6:00 AM and ...
2
votes
1
answer
731
views
What will use less memory, an array or if ... else?
I'm trying to make my sketch smaller. Right now I use an array for the AM/PM part of my time display. My thinking is this makes it easy to change the formatting:
char* ampms[]= {"am", "pm"};
void ...
2
votes
1
answer
178
views
Arduino code intermittent
I have an alarm for "tea time", "lunch time" and "tea time". It works well at times but occasionally it gets stuck on the alarm not resetting, other times it does not ...
2
votes
2
answers
197
views
How to prevent an alarm which checks minutes from going off many times within one minute?
How do I prevent an alarm, which checks if the current time matches an alarm time in hours and minutes, from going more than once within one minute?
I am using the DS3231 RTC module and RTClib from ...
1
vote
4
answers
487
views
How to manage two alarms with one interrupt?
I have a datalogger using the RTC DS3231 as an interrupt generator. I am able to have the interrupts work but here is my problem. I would like to take 2 separate measures from 2 different sensors (one ...
1
vote
3
answers
367
views
One free pin. Need to display output for the user?
I'm working with lightblue bean. I have a device that writes data to an SD card on a long button press and switches what will be written (from a list of 5 items) on short button press.
The output, ...
1
vote
4
answers
2k
views
need help for saving the millis function when arduino was rebooted
I have two questions want to ask
I'm using Arduino Uno with 16*2 LCD Blue ( also I have temp. sensor and two motors also 3 limit switches) ,, my code is working good, but sometimes my lcd stop ...
1
vote
1
answer
664
views
Why the unsigned long is overflowing?
I want to convert hour to seconds but unsigned long is overflowing, here's the code:
#include <Wire.h>
#include <DS3231.h>
RTClib myRTC;
unsigned long seconds;
char timestr[9];
void ...
1
vote
2
answers
8k
views
Arduino Time Library and RTC Libraries
I am using RTClib.h and TimeLib.h with an Uno.
Have been struggling for days in understanding the various RTC libraries available and how to use them with the Arduino Time Library.
Question 1.
If I do ...
1
vote
2
answers
1k
views
My RTC is returning a sporadic date/time
RTC seems to be sporadically returning bogus date/times. Here are the logs from my serial monitor:
2016/3/23 8:19:46
2017/3/23 8:19:46
2016/3/23 8:19:46
2016/3/23 8:19:46
2016/3/23 8:19:46
2016/3/23 ...
1
vote
1
answer
582
views
How to convert my Arduino setup to a PIC setup?
I have an arduino setup with LCD, RTC, EEPROM, Reed Switch, AC/DC Buck Converter, 4X4 Keypad.
What PIC IC will let me connect with all these(40 Pins), and yet accept Arduino Code.
I don't want to ...
1
vote
2
answers
4k
views
How to use RTC memory in NodeMCU to count awakes from deep sleep?
Problem: I need to retry at least 3 times (before giving up) to reconnect my NodeMCU if it doesn't get connected to Wifi, through deep sleep cycles in order to save batteries. I thought to use RTC ...
1
vote
1
answer
4k
views
DS3231 rtc.begin() always returning false
I am using Arduino UNO with a RTC DS3231 module.
I have connected SDA & SCL pins of RTC DS3231 with Arduino SDA & SCL pins near AREF pin.
RTC module is having attached battery also.
My code is ...