When I attempt to run the following program (I am not the author of this code, as it is directly taken from the page I linked above), I am met with an error that seems to be a result of missing a key library.
For the RTC library, we'll be using a fork of JeeLab's excellent RTC library RTClib - a library for getting and setting time from an RTC (originally written by JeeLab, our version is slightly different so please only use ours to make sure its compatible!)
I have also added another sketch to my Github repository DS3231-_RTClib-Adafruit-Alarm-SetTest. It is based on the example that now comes with the library. I made it just so that I could test setAlarm times. It monitors the SQW pin and simply displays the current time and then when the alarm is triggered it displays the time it was triggered.
All the Adafruit RTC libraries take an instantiated and active I2C object(from the board library) as an argument to their constructor. The way tocreate an I2C object depends on the board you are using. For boards with labeledSCL and SDA pins, you can:
I have found that the use of the RTC chip- DS3231 is extremely hard using the arduino. Just setting the time is pretty complex, not mentioning the code. Therefore I have found a great and easy to use library which really enhances the use of the DS3231 chip. Let's get right onto it.
// DS3231_Serial_Easy
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved// web: A quick demo of how to use my DS3231-library to // quickly send time and date information over a serial link//// To use the hardware I2C (TWI) interface of the Arduino you must connect// the pins as follows://// Arduino Uno/2009:// ----------------------// DS3231: SDA pin -> Arduino Analog 4 or the dedicated SDA pin// SCL pin -> Arduino Analog 5 or the dedicated SCL pin//// Arduino Leonardo:// ----------------------// DS3231: SDA pin -> Arduino Digital 2 or the dedicated SDA pin// SCL pin -> Arduino Digital 3 or the dedicated SCL pin//// Arduino Mega:// ----------------------// DS3231: SDA pin -> Arduino Digital 20 (SDA) or the dedicated SDA pin// SCL pin -> Arduino Digital 21 (SCL) or the dedicated SCL pin//// Arduino Due:// ----------------------// DS3231: SDA pin -> Arduino Digital 20 (SDA) or the dedicated SDA1 (Digital 70) pin// SCL pin -> Arduino Digital 21 (SCL) or the dedicated SCL1 (Digital 71) pin//// The internal pull-up resistors will be activated when using the // hardware I2C interfaces.//// You can connect the DS3231 to any available pin but if you use any// other than what is described above the library will fall back to// a software-based, TWI-like protocol which will require exclusive access // to the pins used, and you will also have to use appropriate, external// pull-up resistors on the data and clock signals.//
I am trying to get a Adafruit 3028 feather working - this is the DS3231 RTC. The attraction of the DS3231 is that it is temperature compensated and super accurate +/-2ppm. I have tried the Adafruit RTC library which includes a driver for the DS3231 and also written a short library myself to try and get the RTC to work properly. After 8 hours trying everything I can think of I am still getting the same issue. I have tried 2 3028 feathers and a separate DS3231 module I have mounted on a proto board.
From the Web IDE, do i just manually edit the code in the .CPP file and save it to my application. I remember reading another feed from @ScruffR that there may be other requirements to modify/edit a community library and incorporate those changes?
What I would do is create your own local .cpp and .h files (using the + button in the top right of the window. Easiest to just copy exactly what is in the library except for RTCLib.cpp, plus in RTCSync.h I remember that you have to define the RTC device as DS3231.
Im currently stuck with the DS3231 (zs-042) chip. I found online a lot of library issues, i tried usingmultiple libraries (Rinky-Dink, ds3231-master) but nothing works. I found a simple code online to test the chip but when I upload it the following error shows up: "no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)"
On the left is the current DS3231 Library which I added through the arduino library manager. Its not the same as the one the right, it should be, but its not, copy the files from the unzipped DS32321 library into the Arduino/library/DS3231.
After Reboot on first calls the hwclock calls work, once I call a python script to access say the temperature, first call works, after that it throws errors, the call directly to the DS3231 via the SDL_DS3231 library reports device is busy.
Well, I have found a way without switch-case, everything works fine. Btw this library a little bit sucks, I mean it is really simple to use, but there are many methods missing compared to other libraries (getDOW, getHour, getMinute...).
I will be releasing a library for the PCF8563 in the next couple of weeks. I have already released the DS1307 and the MCP79400 libraries. The DS3231 library is on _SDL_DS3231.
The DS3231 (I used the SwitchDoc Labs DS3231 Module from our store ) is a 3.3V/5V device. You just connect it up to the Raspberry Pi I2C pins and you are ready to go.
Adafruit CircuitPython
Hello
Im having an issue with the esp8266 esp-01 module and the ds3231 working together using an Arduino Uno.
When I upload the code below something is causing major issues like disconnects and it wont send notification, date & time to the blynk app. I have tested by removing the RTC libraries, functions and timers and only left the send notification and it works perfect, sends the notification. Can someone look at my sketch and see right off what my problem might be? Or what ds3231 Library and sketch that will work with this setup
Thanks for your response. Was able to figure it out and everything is working fine now.
But I am now encountering a challenge, to get the RTC working, I needed to add the library to the IDE. When the library is in the internal memory of the OpenMV Cam, the time is always accurate with no problem. However, when I insert SD card, I am not able to access the library from the internal memory, so I will need to add it to the SD card. But when I access the library from the SD, the time will no longer be correct, there will be an offset of about a day and some hours. After resetting the time, it will be fine, but after disconnecting and reconnecting the board, the problem of time offset will happen again. I tried adding it to document folder of the OpenMV IDE, but when accessing it from the IDE, it will still need to be added to the SD card first.
The sketch begins by including the Arduino.h and uRTCLib.h libraries for communicating with the module. We then create an uRTCLib library object and define the daysOfTheWeek 2D character array to store the days information.
2 MILLION+ intelligent footprints & 3D models, easily customizable with your preferences - or simply use the IPC or manufacturer defaults. You have unprecedented control of your CAD library features with no limit on number of preference files!
Parts on POD must be used with the latest Footprint Expert.
In my application, before I set any alarm, I simply clear both registers. Here is the code in Arduino for clearing registers, then setting alarm (using DS3231.h library; this library unfortunately does not have a function to clear alarms properly):
I am using DS3231 as RTC for rockpi s.
Enabled rk3308-i2c1, i2c1-hym8563 in overlay.
mraa-i2c detect 01 confirms that rtc clock on i2c is detected.
Also able to read the rtc date time using the DS3231 library.
I'm trying to understand if it is better to use an external DS3231 RTC or use the library below to bring the nrf5340 out of sleep to talk to various I2C and SPI sensors, timestamp log some data, go back to sleep.
The Date-Time library is not relevant for waking up from sleep every x time. For that, just use what the normal Zephyr API as explained. Moreover, the Date-Time library specifically uses the nRF9160 cellular modem and is not generic, so it has no use on the nRF5340.) There is no out of the box solution that gives you a calendar in the nRF Connect SDK, but you have some of the building blocks (see Time Utilities).
As can be seen in the diagram, the DS3231 uses an I2C interface to interact with microcontrollers. Since we are using the Arduino IDE, we have the Wire library available to handle the I2C protocol in the ESP8266, which we will later use when creating the program to interact with the RTC.
As usual, the Arduino Environment provides a wide range of libraries to interface with different devices, and the DS3231 is no exception. So, we use the library shown in figure 3 which, as stated in the description, is tested on the ESP8266.
This library provides easy to use functions to interface with the RTC, without the need for the programmer to worry about the low level details of the I2C protocol. Besides that, it comes with some code samples to help us get started.
To make things simple and the code cleaner, the RTC library uses another class, called RtcDateTime, which allows us to create objects to hold the date and time information. This is easier to maintain than having to define a different variable to hold all the parameters from seconds to years.
ffe2fad269