Git Product home page Git Product logo

ds3231_simple's People

Contributors

aloisdg avatar histefanhere avatar rmorenojr avatar sleemanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ds3231_simple's Issues

Is running?

Hi!
Which method should I use to know:

  1. first time i ran and the device wasn't running yet
  2. the battery on the device is low or even missing
    Some libraries have the method "isrunning" or "lostPower"...

Thanks

Not erasing logs after reading them

Hi,
Thanks for this great library.

Is it possible to possible to preserve the logs after reading them using readLog function?
Maybe disable the makeEEPROMSpace function in the readLog() to do that.

Thanks

Error Compiling

I am newer to programming and have successfully uploaded the code to a Nano for an LED Display clock. I am now trying to accomplish the same thing via an ESP8266 ESP-12F (WeMos D1 Mini) and am having issues with Verifying/Uploading. I keep getting the error message below and am wondering if I need to add a different code or a library, as I would like to keep the same project coding process, just with the ability to adjust the color scheme/set alarms through WiFi. any help would be appreciated.

Setting:
Arduino: 1.8.16 (Windows 10), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Messages:
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp: In member function 'DS3231_Simple::DateTime DS3231_Simple::read()':
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:414:12: error: '_BV' was not declared in this scope
414 | if(x & _BV(6))
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:428:10: error: '_BV' was not declared in this scope
428 | if(x&_BV(7))
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp: In member function 'uint8_t DS3231_Simple::setAlarm(const DS3231_Simple::DateTime&, uint8_t)':
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:491:33: error: '_BV' was not declared in this scope
491 | controlByte = controlByte | _BV(0) | _BV(2); // Enable Alarm 1, set interrupt output on alarm.
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:496:33: error: '_BV' was not declared in this scope
496 | controlByte = controlByte | _BV(1) | _BV(2); // Enable Alarm 2, set interrupt output on alarm.
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:508:70: error: '_BV' was not declared in this scope
508 | Wire.write(bin2bcd(AlarmDate.Dow) | (AlarmMode & 0B10000000) | _BV(6));
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp: In member function 'uint8_t DS3231_Simple::checkAlarms(uint8_t, uint8_t)':
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:537:44: error: '_BV' was not declared in this scope
537 | rtc_i2c_write_byte(0xE, StatusByte | _BV(7));
| ^~~
C:\Users\Chadwick\Documents\Arduino\libraries\DS3231_Simple\DS3231_Simple.cpp:556:46: error: '_BV' was not declared in this scope
556 | rtc_i2c_write_byte(0xE, PauseClock & ~(_BV(7)));
| ^~~
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.

Wake Arduino from Sleep

I have wrote a test sketch https://ufile.io/989881

It supposed that the DS3221 it will powered by the coin battery and not permanlty from the arduino power.

So VCC connected to PIN 13
pinMode(13, OUTPUT); digitalWrite(13, HIGH); Clock.begin();

When the PIN-13 goes LOW, DS3221 does not send any signal (interrupt) to arduino.

I have connected to UNO:
VCC to PIN 13
GND to GND
SDA to A4
SCL to A5

Seems like not keeps in memory the alarms?
Any help?

AT24C32 Not working

I have a DS3231 with the usual AT24C32 chip at address 0x57 running on an ESP32 (via Arduino).
The DataLogger and MultiDataLogger examples return no records logged:

..................................
# Of Log Entries Found: 0

Any tips on how to start diagnosing this? The rest of the library works great.

PauseClock option in checkAlarms uses wrong register - Missing alarms "race condition" concern is not valid

if(PauseClock)                                                                                                                                                                      
  {                                                                                                                                                                                   
    if(rtc_i2c_read_byte(0xE,StatusByte))

But it should be 0x0F:
https://datasheets.maximintegrated.com/en/ds/DS3231.pdf

Status Register (0Fh)
Bit 7: Oscillator Stop Flag (OSF).
....

On a related matter: Initially I agreed with the comments in code regarding the small possibility of a race condition and therefore missing the alarm. Hence the PauseClock option. However, given this code has had the wrong register in it since it was first published and given it is a popular library which has been used by thousands (?) of people, and no one ever complained about missing alarms... It's a hint.

Really, IMHO, this concern is just deeply flawed. This is the code.

rtc_i2c_read_byte(0xF,StatusByte);                                                                                                                                                  
                                                                                                                                                                                      
  if(StatusByte & 0x3)                                                                                                                                                                
  {                                                                                                                                                                                   
    // Clear the alarm                                                                                                                                                                
    rtc_i2c_write_byte(0xF,StatusByte & ~0x3);                                                                                                                                        
  }                                                                                                                                                                                   

You are only clearing the flag when it is set. So how can you "miss it"?

  • If you clear it, it was set, so by definition you have not missed it?
  • If it's not set when you do the read, then you won't clear it, and you will not detect (!) the alarm on this call of checkAlarm. But you will catch it on the next call? (this presumes polling, which is what this method is for, rather than interrupt).

Sorry if I have misunderstood something, but it seems to me that you are "treating a symptom that doesn't exist (missing alarms) with a placebo (writing to the wrong register)."

The only situation where your concern might still be valid, is if when using 2 alarms simultaneously. Ie 1 is set on read and 2 is not set, then 2 becomes set before we write and clear it. But even that is flawed if we (reasonably) assume that the DS3231 uses the same time in seconds to set both flags or none. So again you are not going to miss anything ...?

IMHO, the PauseClock param should be removed (complete with code writing to incorrect register). And same for the comments outlining the concern. The concern is not valid.

No longer working - seemingly due to an Arduino IDE update sometime in the last 12 months.

Almost exactly one year ago I used this library to make a 30 minute timer to automatically turn off a relay when the alarm triggers. It worked perfectly, I saved the Arduino sketch. Now I am attempting to build another such timer, and I have run into trouble. Here's what happened. I opened my saved sketch and attempted to build and upload to the exact same type of microcontroller (ATTiny85). It failed to compile. The errors were mostly related to "Stream" not being declared in ds3231_simple.cpp. Line 19, "void DS3231_Simple::print_zero_padded(Stream &Printer, uint8_t x)", seemed to cause the most trouble. There were a few other smaller errors, but they all went away at the same time.

I "fixed" the problem after deleting my Arduino15 folder under /AppData/Local. It was a last ditch attempt since nothing else was getting rid of the errors. Once deleted, I started Arduino IDE again. The IDE rebuilt everything that it needed that was missing from that deleted directory, and when I tried to upload the sketch, it compiled just fine. It even behaves correctly in everyway except things related to the DS3231. The power light on the RTC module is on, and it's wired exactly the same way as the working timer, but it never triggers the alarm. I want to debug this futher, but I'm not currently set up for it, and I could probably switch libraries faster. I verified that it IS the library that's broken by uploading the successfully compiled sketch to my older and working timer. Sure enough, same behavior. Everything is fine except the RTC. Same microcontroller, same RTC module, the only difference is the Arduino IDE, which apparently went through some "update" that broke everything. Now it even seems like it isn't broken, but it definitely still is.

I'd love to use this library again, because it's dead simple to get to work, but I'm now forced to move on.

Clock doesn't tick

Hello,

I'm relatively new to arduino and especially interacting with the RTC. I ran the hello world example sketch, as well as tried out the set time and read time, and no matter what I have done, the clock is static in the time I set. The Hello world sketch is not giving the right time. It has taken over a minute for the clock to progress even a second. Is this a known issue I just can't seem to find?

Print POSIX time

Hi,
thanks for your library, it's the one that I'm using ;) there's just a couple of things I feel the need for.

A simple question: how can I print the timestamp in epoch format?

Thanks

P.S.
opening a separate discussion for the second question ;)

How can i set alarm like 19:03:00 everyday

first, Thank you to your library

I want to set alarm like 19:03:00 and 19:05:00 everyday

I want to turn on servo motor 1 at first alarm
and turn off at second alarm

Could you show me how to set alarm at special hour, minute, second?
How can i change this code?

` DateTime MyTimestamp = Clock.read();

// We want the alarm at this second
MyTimestamp.Second = 30;
MyTimestamp.Minute = 3;

// And now add the alarm to happen when the second matches
Clock.setAlarm(MyTimestamp, DS3231_Simple::ALARM_MATCH_SECOND);
Clock.setAlarm(MyTimestamp, DS3231_Simple::ALARM_MATCH_MINUTE_HOUR); `

Error - Import library on Arduino IDE 2.2.1

Steps followed: Sketch\Include Library\Add .ZIP Library and the error message appears:
"Error 13 Internal. Library installed failed: archive is not valid: multiple files found in ZIP file top level."

Set alarm every X minutes

Hi,
thanks for your library, it's the one that I'm using ;) there's just a couple of things I feel the need for.

I understand I can I can set these alarms:

ALARM_EVERY_MINUTE [fires every minute]
ALARM_MATCH_SECOND [fires every minute at a specified second]
ALARM_HOURLY [fires every minute]
ALARM_MATCH_MINUTE [fires every hour at a specified minute]

But how can I, for example, set an alarm every 5 minutes, 10 minutes, 15 minutes or 30 minutes? I'm using your library for a datalogger, and I would like to increase the logging interval. I'm using a counter for the moment, but hopefully there's a better way.

Thanks

P.S.
opening a separate discussion for the second question ;)

Daylight saving Time

Hello

very great Programm, i like it very much. I just miss one thing... that annoying summer- and wintertime.

what do you recommend for this problem? Can you make a sample program?

Wire.requestFrom() should not be followed by Wire.endTransmission().

In the file "DS3231_Simple.cpp", in the function "readEEPROMByte", there is Wire.endTransmission() after the Wire.requestFrom(). That Wire.endTransmission() is currently in the line 125 and can be removed.

The Wire.endTransmission() should only be used when writing data. It does not just send a stop, it does not just finish something, it can not correct something that went wrong. It should only be used when writing data and that is all it is supposed to do.

alarm every 5 seconds

Hi

I'm trying so set an alarm every 5 seconds:

MyTimestamp = Clock.read(); 
  MyTimestamp.Second   = 5;
  Clock.setAlarm(MyTimestamp, DS3231_Simple::ALARM_MATCH_SECOND);

But this only fires only once every minute, at 5th second.

Ds3231 HelloWorld example not properly working

I just imported this library for the first time and started the basic HelloWorld script. When I run it and answer the first two prompts, I get two more prompts consecutively. I try to answer them all separately but the loop just goes back to the first day of month input.

Count number of logs

Hi

I need to count the number of log entries before call readlog(), so i exposed findEEPROMReadAddress() and findEEPROMWriteAddress() (moved them from protected to public on the library).
I use this code to get the number of logs:

uint16_t start=Clock.findEEPROMReadAddress(); uint16_t end=Clock.findEEPROMWriteAddress(); int size=end-start; //size of log in bytes
When i print size, it gives me odd values. I tested writing 2 log entries of 12 bytes each (including timestamp) and the output is 2424 (should be 24). If i write 5 log entries the output is 6060 (should be 60).
It seems that Clock.findEEPROMWriteAddress() reports some kind of shifting...

Im i doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.