Power Fail Logger by Microrusty

From media_wiki
Revision as of 02:34, 17 May 2021 by U731219879 rc (talk | contribs) (Created page with "'''Power Fail Logger ''' Optimized for no power at the AC plug <br> Automatic switching to battery on main power loss. '''Data Sheet''' https://www.nxp.com/docs/en/ '''F...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Power Fail Logger Optimized for no power at the AC plug

 Automatic switching to battery on main power loss. 

Data Sheet https://www.nxp.com/docs/en/

Features
 SPI bus SD Card for data logging power outages
 I2C bus for Real Time Clock with date and time
 Time Stamp provides year, month, day, hours, minutes, seconds 
 Automatic switching to battery on main power loss. 
 Captures Power Failures with time and date stamp written to SD Card.
 Captures Power Restored with time and date stamp written to SD Card.
 Captures system resets with time and date stamp written to SD Card.  
 
 Three time log registers triggered from battery switch-over as well as input driven events.
 Featuring clock output and two independent interrupt signals.
 ISP interface uses USBTiny
 SPI Interface 
 I2C interface
 16-MHZ Crystal Clock.
 
PCF85263AT-PCB.PNG

mid mid

Programming Power Fail Logger with Arduino IDE

To Set the RTC Using the Arduino IDE copy the follow program and paste in the IDE.

// https://github.com/rodan/ds3231

  1. include <Wire.h>
  2. include <ds3231.h>

struct ts t;

void setup() {

 Serial.begin(9600);
 Wire.begin();
 DS3231_init(DS3231_CONTROL_INTCN);
 /*----------------------------------------------------------------------------
 In order to synchronise your clock module, insert timetable values below !
 ----------------------------------------------------------------------------*/
 t.hour=20; 
 t.min=40;
 t.sec=0;
 t.mday=11;
 t.mon=4;
 t.year=2021;
 DS3231_set(t); //Comment out after setting RTC with time & date
 }

 void loop() {
 DS3231_get(&t);
 Serial.print("Date : ");
 Serial.print(t.mon);
 Serial.print("/");
 Serial.print(t.mday);
 Serial.print("/");
 Serial.print(t.year);
 Serial.print("\t Hour : ");
 Serial.print(t.hour);
 Serial.print(":");
 Serial.println(t.min);
 Serial.print(":");
 Serial.println(t.sec);
 delay(60000);
 }
 void print2digits(int number){
 if (number >= 0 && number < 10) {
   Serial.write ('0');
 }
 Serial.print(number);
 } 


Connect the Power Fail Logger to the Arduino uno.