Datalogger for my Electric meter (pulses)

I need a little guideway/help to my little datalog from my electric meter for my house.

My requierments is like:

  • count inputs pulses from at Electric Power Meter (S0-pulse)
  • These totally “counts”, shall be logged to SD-Card every 00,10,20,30,40,50 minutes for each time (6 times pr. hour)

ect. 15 pulses between 16:00-16:10 shal be logged into SD-card like:


ID,Date,Time,pulses
#00001,15-08-2012,16:00,21
#00002,15-08-2012,16:10,15 <— Theese are the pulses between 16:00-16:10


If the power go, and then turn on again, the controller should start where it come from, just without the missing data.

To log the time, I have a DS1307 RTC. Atm. I use RTClib.h

Somebody who can help with the code?

Somebody who can help with the code?

What part of it do you need help with?

You have a realistic set of requirements. Break the project into steps.

Read the pulses. Toggle an LED to show that a pulse was received. Increment a counter.

Read the clock. Determine if it is time to log anything.

Write data to the SD card. Reset the counter.

My biggest issue is the timed action. ect. when the clok is 16:10 the counted pulses shall be logged. I know how to log it, but I have no idé how to determine the actual time.

but I have no idé how to determine the actual time.

You said you have a real time clock, and are using RTClib.h. If you have data to log that includes the time, logging only at specific times is trivial. What am I missing?