Go Down

Topic: Power Outage Timer (Read 2 times) previous topic - next topic

tlharv

I'm new to Arduino, but I have a project idea and I think Arduino is the answer.  I live in a rural area, and we have frequent power failures in the winter.  What I'd like is a device that you plug into the wall and detects power outages, then uses a battery backup to start a timer.  When the power comes on, a text file is written to a USB memory stick showing the date, time, and event (power off or power on).  Could use some advice on where to start.

Thanks!
Tom

michael_x

Use an SD Card instead of USB Stick, and where do you get Date/Time from ?
There's a DataLogger shield providing just those functions: RTC + SD Card Adapter.

Then you either need a dual power supply, or you simply assume to return from Power Off after a restart, and check until when you have been alive before ( implies writing temporary info to the
RTC RAM )

Chukdee

Instead of writing to a text file I was thinking about triggering a battery powered timer to start when power is lost and stopped when it comes back on and make sure it doesn't reset every time it starts.  That way you'll know the total length of power outage from the last time you checked the timer.  I would definitely like to build something like this but have no idea where to start.  I just registered today.

CrossRoads

Battery backed RTC chips have coin cell battery backed SRAM also (such as CR2032, 36 cents here qty 1
http://www.dipmicro.com/store/index.php?act=viewProd&productCode=BAT-CR2032) that will run the RTC for 5 or 10 years.

Write a simple sketch that reads the time once a second, and stores that time to SRAM. Can even use the 1 HZ oscillator from the RTC to signal when to read the time.
The next second, read the time and store it again, and note if just 1 second had elapsed.
When you find a time that is more than 1 second different, send out a serial message, or display on a display, the time difference found - there's your power-off time counter.

Or, get a battery powered clock and a normally closed relay. When power is on, the relay is held in the open position, when power is lost the relay reverts to the normally closed position and the clock runs for as long as the battery holds out, or until power comes back. Don't know how you'd tell when more than 12 or 24 hours had gone by, guess that would depend on the clock used.

Hearing we might have a winter that makes up for last year's relative lack of snow.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Jack Christensen

Recently I've been playing with the Microchip MCP79412 RTC. It records power down and power up times in internal registers. If you're only interested in logging power outages after the fact, as opposed to knowing about them while they are occurring, then no external backup battery, timer, etc. would be needed. As part of the initialization (setup), the sketch would check the RTC to see if an outage had occurred, and if so, save the power down and power up times. The MCP79412 has on-board battery-backed SRAM and also EEPROM. Like most, the RTC itself does require a coin cell to keep it running during outages; as CrossRoads says, these are usually good for quite a few years.

I've had a few breakout boards made to facilitate development, and am currently working on a library. If the MCP79412 RTC sounds like it would fit your application, I'd be willing to send you a board (pictures below) for the price of testing the library and letting me know how it works for you.

I'm liking the MCP79412 a lot. The DS1307 seems to be the standard go-to workhorse, and it's a fine chip, but the MCP79412 has several advantages. I've only had them running for less than a week, but they're looking more accurate than has been my experience with DS1307s, and there is the ability to trim them even closer. I also like the fact that they will run on less than 5V.












Feature MCP79412 DS1307
On-Chip Calibration ±127 ppm N/A
Alarms Dual alarms (single output) N/A
Power Fail/Restore Timestamps Yes N/A
Unique ID 64-bit ID N/A
EEPROM 128 bytes N/A
Battery-Backed SRAM 64 bytes 56 bytes
Vcc 1.8 - 5.5V 4.5 - 5.5V
I2C Interface Clock Frequency 400 kHz (Vcc ? 2.5V) 100 kHz
Square-Wave Output 1, 4096, 8192 or 32,768 Hz 1, 4096, 8192 or 32,768 Hz

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Go Up