Difference between revisions of "Power Fail Logger by Microrusty"
(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...") |
|||
(18 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | '''Power | + | '''Version 1.0 Copyright © Microrusty.com 2021 ''' |
− | + | Latest Release : 04/12/2021 <br> | |
− | '''Data | + | Software written By '''Jim Merkle''' and '''Rusty Cain''' <br> |
+ | Hardware design by '''Rusty Cain''' <br> | ||
+ | |||
+ | '''Notes:''' | ||
+ | The program only writes to the SD Card when there is a change in the AC Power Status from Power Good to Power Failure back to Power Good. | ||
+ | To set the DS3231 RTC You must use another program called : DS3231-Set-Time-Date.ino See link below for How to set. | ||
+ | Serial Console Settings: '''9600 Baud 8 bit.''' | ||
+ | Program creates a file with the filename '''"REBOOTS.TXT"''' that captures each time the system is power cycled. | ||
+ | Example of '''REBOOTS.TXT''' file: | ||
+ | System Rebooted Date : 04/10/2021 Time : 14:31:37 | ||
+ | System Rebooted Date : 04/10/2021 Time : 17:02:21 | ||
+ | System Rebooted Date : 04/10/2021 Time : 20:24:53 | ||
+ | |||
+ | The program checks the '''RTC Board''' and '''SD Card reader''' to ensure both devices are working. <br> | ||
+ | Program sends '''SD Card reader''' status to console port.<br> | ||
+ | Program sends '''power''' status to console port. | ||
+ | '''Example :''' | ||
+ | Initializing SD card...Setting up logging time | ||
+ | Power Good | ||
+ | Data written to file: | ||
+ | Power Good | ||
+ | |||
+ | Program also creates a file called '''DATALOG.TXT''' that captures the Power status with date & time. | ||
+ | Example of '''DATALOG.TXT''' file: | ||
+ | Power Good : Date : 04/10/2021 Time : 17:02:21 | ||
+ | Power Bad : Date : 04/10/2021 Time : 17:08:36 | ||
+ | Power Good : Date : 04/10/2021 Time : 20:24:53 | ||
'''Features''' | '''Features''' | ||
− | SPI | + | Microchip Atmel ATMEGA328P Microcontroller |
− | I2C | + | 16-MHZ Crystal Clock. |
+ | ICSP interface uses USBTiny for programming the Microcontroller | ||
+ | UART Communication Module (RS232) | ||
+ | SPI Communication ATmega328P | ||
+ | I2C Communication Module | ||
+ | SPI SD Card for data logging power outages | ||
+ | I2C Real Time Clock with date and time | ||
Time Stamp provides year, month, day, hours, minutes, seconds | Time Stamp provides year, month, day, hours, minutes, seconds | ||
Automatic switching to battery on main power loss. | Automatic switching to battery on main power loss. | ||
Line 14: | Line 46: | ||
Three time log registers triggered from battery switch-over as well as input driven events. | Three time log registers triggered from battery switch-over as well as input driven events. | ||
Featuring clock output and two independent interrupt signals. | Featuring clock output and two independent interrupt signals. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Libraries used:''' | |
− | + | #include <Wire.h> // For I2C Interface SDA SCK | |
− | + | #include <ds3231.h> // For the DS3231 RTC library | |
+ | #include <SPI.h> // SPI Interface that the SD card module will use | ||
+ | #include <SD.h> // for the SD card | ||
+ | Download the libraries using the '''Arduino IDE''' refer to: '''Download the Drivers''' in '''Setting Time and Date for the DS3231 RTC''' | ||
+ | |||
+ | [[File:PowerLogger-Top.PNG |350px|left]] | ||
+ | [[File:PowerLogger-Bottom.PNG|350px|mid]] | ||
+ | ==[[ Power Fail Logger by Microrusty ]]== | ||
+ | ==[[Initializing the Microcontroller]]== | ||
+ | ==[[Setting Time and Date for the DS3231 RTC]]== | ||
==[[ Programming Power Fail Logger with Arduino IDE]]== | ==[[ Programming Power Fail Logger with Arduino IDE]]== | ||
− | + | ==[[Installation and use]]== | |
− | + | ---- | |
− | + | ==[[ Main Page ]]== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 21:51, 18 August 2021
Version 1.0 Copyright © Microrusty.com 2021
Latest Release : 04/12/2021
Software written By Jim Merkle and Rusty Cain
Hardware design by Rusty Cain
Notes: The program only writes to the SD Card when there is a change in the AC Power Status from Power Good to Power Failure back to Power Good. To set the DS3231 RTC You must use another program called : DS3231-Set-Time-Date.ino See link below for How to set. Serial Console Settings: 9600 Baud 8 bit.
Program creates a file with the filename "REBOOTS.TXT" that captures each time the system is power cycled.
Example of REBOOTS.TXT file: System Rebooted Date : 04/10/2021 Time : 14:31:37 System Rebooted Date : 04/10/2021 Time : 17:02:21 System Rebooted Date : 04/10/2021 Time : 20:24:53
The program checks the RTC Board and SD Card reader to ensure both devices are working.
Program sends SD Card reader status to console port.
Program sends power status to console port.
Example : Initializing SD card...Setting up logging time Power Good Data written to file: Power Good
Program also creates a file called DATALOG.TXT that captures the Power status with date & time. Example of DATALOG.TXT file: Power Good : Date : 04/10/2021 Time : 17:02:21 Power Bad : Date : 04/10/2021 Time : 17:08:36 Power Good : Date : 04/10/2021 Time : 20:24:53
Features Microchip Atmel ATMEGA328P Microcontroller 16-MHZ Crystal Clock. ICSP interface uses USBTiny for programming the Microcontroller UART Communication Module (RS232) SPI Communication ATmega328P I2C Communication Module SPI SD Card for data logging power outages I2C 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.
Libraries used: #include <Wire.h> // For I2C Interface SDA SCK #include <ds3231.h> // For the DS3231 RTC library #include <SPI.h> // SPI Interface that the SD card module will use #include <SD.h> // for the SD card Download the libraries using the Arduino IDE refer to: Download the Drivers in Setting Time and Date for the DS3231 RTC