Datetime and dying battery issues

121 views
Skip to first unread message

Matias Andina

unread,
May 22, 2023, 10:12:31 AM5/22/23
to FEDforum
Hello all,

I found an issue here that I don't know if it's related to the battery dying or not. These are some of the last events recorded on the FED, notice how the DateTime is complete nonsense

84/00/2121 01:51:03,1.9.2,FreeFeed,35,3.52,1,1,Pellet,Left,3,4,21,0,Timed_out,0,nan
131/20/2000 00:22:03,1.9.2,FreeFeed,35,3.53,3,1,Pellet,Left,3,4,22,0,2.84,0,nan
00/20/2000 00:22:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,23,0,21.91,0,nan
131/20/2000 00:22:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,24,0,18.91,0,nan
131/20/2000 00:22:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,25,0,15.54,0,nan
99/00/2000 00:98:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,26,0,0.06,0,nan
99/00/2000 00:98:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,27,0,0.06,0,nan
131/20/2000 00:22:03,1.9.2,FreeFeed,35,3.53,1,1,Pellet,Left,3,4,28,0,0.56,0,nan

I changed the battery and it returned to normal datetime 

Best,
Matias

Lex

unread,
May 22, 2023, 10:47:01 AM5/22/23
to Matias Andina, FEDforum
Hi Matias! It could be .. the coin cell for the RTC has an expected battery life of 3-5 years, so it's possible it's running out and no longer operating correctly.  It's cheap and easy to replace though, I'll try to record a video of how to replace it and attach to this thread!

--
You received this message because you are subscribed to the Google Groups "FEDforum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedforum+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fedforum/CAAAsrMP01_5SJGE9gXjuWkMsrbMHbQiCSwEF9PpOJge23m8J%2Bg%40mail.gmail.com.

Matias Andina

unread,
May 22, 2023, 10:53:04 AM5/22/23
to Lex, FEDforum
Hi,
Sorry for not being clear, I was talking about the FED's battery, not the clock battery. That's why I found this weird.
Best,
Matias

Lex

unread,
May 22, 2023, 10:59:50 AM5/22/23
to Matias Andina, FEDforum
Oh ok, I'll record that RTC battery change video anyway, it's been on my to do list 😊

Yes, I could see the SD card data getting corrupted if the main battery were very low.  Writing to the SD card can briefly pull up to 100mA of current, so if a battery voltage were low and not able to supply that it might cause data corruption.  I'm not sure why the Datetime is the only corrupted column but it is written first so perhaps it's most vulnerable to a power issue. Were FED3 batteries very low?  We run them down to ~3.5V and I haven't seen this.

Matias Andina

unread,
May 22, 2023, 11:15:02 AM5/22/23
to Lex, FEDforum
The FED battery was so low that the device turned itself off. I turned it in while plugged and was seeing these events with wrong dates. The power was low enough that the motor couldn't engage properly too...
I guess it's a warning for the future not to run them so low (this one clogged and that's why it killed its battery overnight)

Matias Andina

unread,
Jun 9, 2023, 1:31:12 PM6/9/23
to FEDforum
Following up on this:
I was running FEDWatcher with this particular FED and thus had instances of duplicated data (that on FEDWatcher, and that on the .csv saved by the board itself). There is a linear relationship between the difference in Pi_Time and the time as seen by the RTC clock (we know the clock gets a little bit off per day, so over 10 days we get this linear trend). 

image.png
After a little bit of hustling, making the date from the previous events be carried forward from previous non-corrupted data and using a linear fit to account for drift in the RTC, I was able to recover the proper timestamps as best as I think it's possible.

image.png

Something good about this is that it could be done afterwards, that is, connecting the same fed to FEDWatcher can give an estimate of the drift in the clock and one could possibly fix the corruption problem retroactively. 
I incorporated the function to make the lm fit into the R fed3 package (https://github.com/matiasandina/fed3)

Best,
Matias

Lex Kravitz

unread,
Jun 12, 2023, 11:41:05 AM6/12/23
to FEDforum
Cool analysis!  The RTC in FED3 can be calibrated to make it more accurate... I've never tried doing this but there are posts on the Adafruit forums about it.  If you have an accurate measurement of the drift (which you do!) you can work backwards to calibrate each FED3.  Keep in mind that each device would have to be calibrated independently, the variance in RTC drift comes from variance between the timing crystal so each device will have a unique rate of drift. 
Reply all
Reply to author
Forward
0 new messages