by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 23 20:22
    Makuna closed #120
  • Sep 23 20:22
    Makuna updated the wiki
  • Sep 23 20:13
    Makuna updated the wiki
  • Sep 23 08:34
    T0m92 opened #120
  • Aug 27 15:58
    Makuna closed #119
  • Aug 27 15:58
    Makuna labeled #119
  • Aug 27 15:55
    Makuna closed #118
  • Aug 27 08:15
    Bredahl opened #119
  • Aug 03 15:39
    Flavian opened #118
  • Aug 01 19:24
    Makuna closed #117
  • Aug 01 17:19
    lucagrosshennig opened #117
  • Jul 31 17:46
    thijstriemstra opened #116
  • Jul 25 23:30

    Makuna on 2.3.5

    (compare)

  • Jul 25 23:28

    Makuna on NextRelease

    (compare)

  • Jul 25 23:28

    Makuna on master

    increment version (#115) (compare)

  • Jul 25 23:28
    Makuna closed #115
  • Jul 25 23:28
    Makuna opened #115
  • Jul 25 23:28

    Makuna on NextRelease

    increment version (compare)

  • Jul 25 23:25
    Makuna closed #37
  • Jun 26 18:54
    Makuna labeled #110
zekageri
@zekageri

Crash error:
codeGuru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was
was unhandled.
Core 0 register dump:
PC : 0x400f3635 PS : 0x00060f30 A0 : 0x800f3a7c A1 : 0 : 0x3ffd50e0
A2 : 0x00000020 A3 : 0x3ffd516c A4 : 0x00000032 A5 : 0 : 0x3ffbec44
A6 : 0x00004e20 A7 : 0x00000000 A8 : 0x800f362d A9 : 0 : 0x3ffd50c0
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3ffb31f8 A13 : 0 : 0x3ffc3cf0
A14 : 0x00002710 A15 : 0x3ffbec44 SAR : 0x00000013 EXCCAUSE: 0E: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0 : 0x00000000

Backtrace: 0x400f3635:0x3ffd50e0 0x400f3a79:0x3ffd5110 0x400edbe5:0x3ffd5130130 0x400edc99:0x3ffd5160 0x400edd1d:0x3ffd5190 0x400d3377:0x3ffd51b0 0x44f7:00ec4f7:0x3ffd5220 0x400ea277:0x3ffd5260 0x400ea31d:0x3ffd52a0 0x400ea5752f0:0x3ffd52f0 0x40157cc9:0x3ffd5310 0x40157dd5:0x3ffd5350 0x401583fe:0x3ffd789:5370 0x40089789:0x3ffd53a0 code

Decoded:
'code'

PC: 0x400f3635
EXCVADDR: 0x00000000

Decoding stack results
0x40089789: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143

'code'

Michael Miller
@Makuna
@zekageri This file "port.c" is not in my library. further, it is not in my Esp32 Arduino install, I also could not find anything with "taskwrapper" in the Esp32 Arduino code base. I would suggest looking at that line and see what its doing.
I suspect you can't call any of the WIRE methods within the web callback (a common problem with system level callbacks). Ask on the Esp32 gitter channel about calling Wire methods on that callback.
Michael Miller
@Makuna
Also, what version of the Arduino Esp32 core are you using?
zekageri
@zekageri
Thank you for your answer. I'am using espressif32 1.8.0 currently because the OTA update did not work with 1.9.0 for some reason. Iam in platformIO inside VSCODE. What do you mean that wire methods does not work in web callbacks? It is sometimes sets the time and sometimes goes with a crash. But if it is true i can see if i set the time from the loop with a flag.
zekageri
@zekageri
Okay i think that was the problem. If i set a flag in the web callback and watch that flag in the loop and set the time when the request setted the flag everything is working fine. God bless you Makuna. I did not know that Wire methods does not work in web callbacks. :O
Michael Miller
@Makuna
@zekageri I would ask on the Esp32 gitter channel if there is a solution for this. There maybe something simple that makes the callback more usable. The Esp32 is a dual core processor and some issues are that the callbacks happen on a different core.
zekageri
@zekageri
Yeah, that is true. I had some issues because of the 2 cores in the past. The 0. core is totally useless if you want to run a complex async webserver. You can use your "first" core as usual if you do that. I tried to measure a 8Khz frequency on core0, and all my web things was slow A.F. But thats okay if you want to almost totally full one of the cores. But if i run something simplier on core0 , the web things are slow A.F again. If it is not a blink function, than that core is just for the web handlings.
Boris van Galvin
@vangalvin
I just had some fun with the WiFi D1 Mini RTC and Micro SD board. There is a resistor and diode acreoss the battery. Not quite sure what its puropose is other than maybe pulling the voltage down if the battery is stuck in the wrong way.
Anyway the Diode shorts the battery. So removed that and the resistor and its working perfectly with the library thanks. :)
I do have to however ask, how do you get just the EPOCH time? I was looking at using this to timestamp sensors.
Michael Miller
@Makuna
@vangalvin once you have the RtcDateTime, just call Epoch32Time() or Epoch64Time() on that object to get what you want.
Its listed here in the wiki
Boris van Galvin
@vangalvin
Awesome, Yep got that thanks :) works a treat!
Just as a heads up the unit is heading down to Antartica to be installed on the side of Mt Erebus and will be collecting temperature data. there are about 60+ temperature sensors per node.
Michael Miller
@Makuna
Is there a public web site on your project? I like to add links to the wiki to projects people do with my libraries.
Boris van Galvin
@vangalvin
Sadly not as yet. I may end up making one at some stage however due to time constraints and I am having issues finding the time to get all the electronics built, design and machine the housing and get the programming done. lol. 8AM starts and its justgone 3AM and im still up working. Man i wish the hours were billable :P
Bashar3
@Bashar3
Hi I'm having trouble with showing the right time using the method "RtcDateTime now = rtcModule.GetDateTime();" it's showing wrong hour and wrong minute. I'm using Arduino Uno.I'm trying to print the time to an oled display. my method updateTime() looks like this:

void updateTime(){

oldMinute = minutes;
RtcDateTime now = rtcModule.GetDateTime();

hours = now.Hour();
minutes = now.Minute();
seconds = now.Second();

Bashar3
@Bashar3
the sketch I'm building exists in this code in GitHub also https://github.com/kjellcompany/Arduino_701/blob/master/GrandFinale/GrandFinale.ino
Michael Miller
@Makuna
@Bashar3 Are you sure that you set the date and time on the module?
While I saw nothing obviously wrong with your code; I would suggest that you look at the examples I provide and add at least a little of the checking code; like making sure the RTC is even running and that the datetime and is valid.
Bashar3
@Bashar3
@Makuna I'll take a look at it, appreciate your answer.
Mehrdad
@mehrdad987
hi Mr miller
are there any ways to change my time in ds3231 from the internet?
I set the time from my computer and also I can see there are a possibility to change time with NTP but I wanna change it from my own server
Michael Miller
@Makuna
@mehrdad987 I don't know exactly what you are asking, as all you have to do is construct a RtcDateTime object and set the date and time from the many ways it supports. The source of the date and time is irrelevant as you just need to use a method that works best.
See https://github.com/Makuna/Rtc/wiki/RtcDateTime-object#constructors for the constructors, and you also have epoch time init methods https://github.com/Makuna/Rtc/wiki/RtcDateTime-object#void-initwithepoch32timeuint32_t-time
Mehrdad
@mehrdad987
@Makuna
Sorry I didn't notice
Thank you, Mr Miller now I can change the ds3231 time through my server
raza505050
@raza505050
hello there! i wants to get millisecond in return as a timestamp using RTC DS3231, can anyone help me how can i solve this issue?
raza505050
@raza505050
anyone?
Michael Miller
@Makuna
Did you read the Spec sheet? The DS3231 doesn't track time down to milliseconds. I am not sure there is an RTC modules that does.
The only way I could think of doing it is to use the SQW pin to trigger a one second timed pulse, then attach an interrupt to it, and in the ISR capture the uCs millis()/cyclecount. And then when ever you get the time, just compare the current millis() to that captured value to get the milliseconds since the last second.
Marco
@marcolino7
Hi, I would like to put all rtc code into external .cpp and .h file and use in main.cpp only the created object Rtc. Is there any example on how achieve this?
Michael Miller
@Makuna
Why do you want to do that?
No, there are no examples of this. Basically, you would have to wrap it in your own class, as the library is not written to be a binary distributed library, as that would bloat the code. The code is written using templates.
Marco
@marcolino7
@Makuna thanks for clarification. I'm writing a firmware that have a lot of code, so I prefer to split function in more files. This is the main reason.
Michael Miller
@Makuna
@marcolino7 My suggestion would be to then follow a design pattern that you abstract what you need the RTC to accomplish within your code behind an API (.h/.cpp) and then in that code include and instance the RTC object. It should accomplish your goals.
Sterminatore
@Sterminare
Hello, I'm looking for some help. Im a bit of a beginner. I am making a clock with three voltmeters, one for hour, minute, and second. I need to take the hour, minute, and seconds value, and convert it to a value between 0-255 so I can analogWrite it to each voltmeter. Basically I just need to know how I can have a variable equal to the hours, another equal to the minutes, another equal to seconds value and I can do the rest. Thanks
Michael Miller
@Makuna
Just use the accessors methods on the RtcDateTime object.
See wiki pages here
Sterminatore
@Sterminare
Im sorry i don't really understand the terminology well, am I supposed to write 'uint8_t' or is that a placeholder for something else?
Sterminatore
@Sterminare
analogWrite(secondsPin, (RtcDateTime.Second() / 60) * 255);
doesnt work
Michael Miller
@Makuna
@Sterminare do you know what a uint8_t is? How about byte? Search for these terms and you will learn them.
When you say it doesn't work, how does it not work? What did you do to investigate how it doesn't work? My first suggestion is take your little math routine and print out in debug the results. I think you will you find you get either a zero or 255, nothing else. You need to understand how C/C++ handles integer math types. What is 59/60 calculate out to be when doing integer math? Answer this and you will understand whats wrong.
Sterminatore
@Sterminare
So I need to figure out how to make sure it doesnt round, that
is something I can figure out, but is it right that RtcDateTime.Second() is the value of how many seconds have passed since the last minute? etc for RtcDateTime.Minute() since last hour and RtcDateTime.Hour() since midnight?
Sterminatore
@Sterminare
What I put above does not compile, it says 'primary expression expected before ".". I tried changing it to RtcDateTime().Second() but that doesnt seem right and unsurprisingly trying to print this to serial it is just blank (I assume undefined).
I've gotten it figured out. I was able to declare global seconds, minutes, hours variables and then in the printDateTime() function, after printing it to serial I have it seconds=dt.Second(); minutes=dt.Minute(); hours=dt.Hour();
Jay
@jay-ramani

Hi Michael, I'm working on a DS1302 based RTC on an Arduino Uno R3, and trying to reduce global storage while I'm already pressed for RAM with other global variables I cannot do away with. I'm not well versed in C++ (though I have worked on C), and having trouble doing away with a dedicated ThreeWire object with the statements below

ThreeWire interface_three_wire(PIN_ARDUINO_RTC_IO, PIN_ARDUINO_RTC_SCLK, PIN_ARDUINO_RTC_CE);

RtcDS1302<ThreeWire> Rtc(interface_three_wire);

to

RtcDS1302<ThreeWire> Rtc(ThreeWire(PIN_ARDUINO_RTC_IO, PIN_ARDUINO_RTC_SCLK, PIN_ARDUINO_RTC_CE));

With passing an object like this, I'm getting this error:

RTC_DS1302:373:29: error: cannot bind non-const lvalue reference of type 'ThreeWire&' to an rvalue of type 'ThreeWire'

Would be great if you could help. Thanks.

Michael Miller
@Makuna
C++ is not C# (or Java/Python/etc), objects DO NOT have reference counts or lifetimes based on held references.
The issue is that the argument is defined to be a "reference" to the object. The compiler is catching that you are passing a temporary object. After the construction of the RtcDS1302, the object you pass will no longer exist and the rtc object would have had an invalid reference.
Michael Miller
@Makuna
Due to how Arduino defines most wire as a global object rather than let the user create it, the interface of the Rtc libraries requires the passing of the reference.
VoicelessProximity1701
@VoicelessProximity1701
Hi
I am having a problem with my DS3231 module, in that it keeps on saying etc not declared in this scope
Here is the code I am using

include <RTClib.h>

include <SD.h>

include <SPI.h>

include <DS3231.h>

File myFile;
int pinCS = 53; // Pin 10 on Arduino Uno
void setup() {

Serial.begin(9600);
pinMode(pinCS, OUTPUT);

// SD Card Initialization
if (SD.begin())
{
Serial.println("SD card is ready to use.");
} else
{
Serial.println("SD card initialization failed");
return;
}
rtc.begin();
}
void loop() {
Serial.print(rtc.getTimeStr());
Serial.print(",");
Serial.println(int(rtc.getTemp()));

myFile = SD.open("test.txt", FILE_WRITE);
if (myFile) {
myFile.print(rtc.getTimeStr());
myFile.print(",");
myFile.println(int(rtc.getTemp()));
myFile.close(); // close the file
}
// if the file didn't open, print an error:
else {
Serial.println("error opening test.txt");
}
delay(3000);

I am using an Arduino/Elegoo Mega 2560
Michael Miller
@Makuna
@VoicelessProximity1701 Your sketch has many issues and does not match my library in the calls you are using. Please review the samples included with the library and you will should discover all the issues I spot.
VoicelessProximity1701
@VoicelessProximity1701
Ok thanks 👍