Make hour counter to count running hours of LED lamp remaining life

Hi guys

i am trying to make a counter using arduino uno and DS1307 that can calculate the number of hours LED bulb works and display that on any LCD or even a serial monitor to know the actual life span Vs what is written in specs
i can handle the circuitry and hardware part but cant get a reliable code

Any advice for that?or does any body has a previously working code or something close to what i need and i can adapt

Thnks in advance for your help

Show us your schematic.

What kind of bulb ?

Hello larryd

AC bulb
the schematic is just small ac-dc (220AC-9DC)transformer connected in series with the bulb so that when its switch is switched on arduino can work and counts ,that is all

Suggest you monitor the light from the bulb.

When the light is on, a timer runs, or increment a counter every 1 second.

When the light is off, the timer pauses, counter stops incrementing; if need be, the counter could be saved to EEPROM.

One possibility for a light sensor is the simple LDR.

thx for the advice larryd

i am asking about the coding more than the technique and hardware stuff

You read the time from the RTC.

You look at current seconds, compare this value to the last time you read seconds.

If there is a change, you increment a run time counter variable.

Write down the time and date you switch it on.

Check every week or so if it's still operating.

It should be several years before it stops working (where life time may be rated in time to a certain percentage loss of brightness rather than total failure).

From a practical sense, it is largely a waste of time.
Lamp life is an estimate and a fairly broad one at that.
Drivers tend to be the weak link in any ac lamp and will fail long before the reported "lamp life".

mestek86:
i can handle the circuitry and hardware part but cant get a reliable code

mestek86:
i am asking about the coding more than the technique and hardware stuff

I think you should look at the technique and the hardware a lot more closely, also the nature of the end result, and then start worrying about the code. This seems like truly crazy stuff. A calendar on the back of the door with a pencil nearby should be all all you need, if you actually need anything at all, and quite likely more accurate than a DS1307 timing over the life a LED.

Nick_Pyner:
I think you should look at the technique and the hardware a lot more closely, also the nature of the end result, and then start worrying about the code. This seems like truly crazy stuff. A calendar on the back of the door with a pencil nearby should be all all you need, if you actually need anything at all, and quite likely more accurate than a DS1307 timing over the life a LED.

Hi Nick

writing in a calender using a pen can be forgotten that is why i need something automatic
i have read about DS1307 but do not know how to achieve the code using it for my purpose
any help for that?

bluejets:
From a practical sense, it is largely a waste of time.
Lamp life is an estimate and a fairly broad one at that.
Drivers tend to be the weak link in any ac lamp and will fail long before the reported "lamp life".

Hi bluejets
yes i need to know the practical life Vs that estimate

You only have to write on the calendar twice... once when you switch on the lamp, and much much later when it fails. Could be years, depending on the lamp. Stated lifetimes are typically something like 50,000 hours, that's almost 6 years.

Keeping it on all the time may also give very different result for lifetime compared a lamp that is switched on and off frequently.

1 Like

You have a start time.
Press and hold button. ETC.

Log the date and time in eprom

Sense light output
Run timer.
Light output ends then stop incrementing timer.

Display:
Lamp started 1/29/2021

...by the way happy birthday Deborah.

Running hours: 21,874

Since you have to sense the ouput and the lack thereof, you would know when iit Stopped outputting

Display
Lamp started 1/29/2021
Failed 7/17/2027
Total operational hours 40,171, and 23 miminutes
Started 745 times
Average run time 128 hrs
Shotest tun titime 1 min
Longest run time 12,867 hours
Lumonosity fell to 90% after 24,891 hours
Lumonosity fell to 80%...
To 70%...
To 60%.....

At that kind of run times, don't forget to take the deterioration of the luminosity sensor into account, and keep a record of how much dust has collected on the bulb.

wvmarle:
You only have to write on the calendar twice... once when you switch on the lamp, and much much later when it fails. Could be years, depending on the lamp. Stated lifetimes are typically something like 50,000 hours, that's almost 6 years.

Keeping it on all the time may also give very different result for lifetime compared a lamp that is switched on and off frequently.

ahaaaa,got u
this is totally true if i am going to monitor the bulb via continous work,but i need to monitor it during normal operation in daily usage ,that is why this can lead to forget writing the notes

wvmarle:
At that kind of run times, don't forget to take the deterioration of the luminosity sensor into account, and keep a record of how much dust has collected on the bulb.

good idea my friend
thank u v much

dave-in-nj:
You have a start time.
Press and hold button. ETC.

Log the date and time in eprom

Sense light output
Run timer.
Light output ends then stop incrementing timer.

Display:
Lamp started 1/29/2021

...by the way happy birthday Deborah.

Running hours: 21,874

Since you have to sense the ouput and the lack thereof, you would know when iit Stopped outputting

Display
Lamp started 1/29/2021
Failed 7/17/2027
Total operational hours 40,171, and 23 miminutes
Started 745 times
Average run time 128 hrs
Shotest tun titime 1 min
Longest run time 12,867 hours
Lumonosity fell to 90% after 24,891 hours
Lumonosity fell to 80%...
To 70%...
To 60%.....

very nice logic of building
do u have any code to start with?

mestek86:
writing in a calender using a pen can be forgotten

That sounds reasonable, indeed forgetting is a really good idea for an exercise as pointless as this. You've probably already got the life of the LED written on the back of the box, so at least you can read that now, and it will also provide you with a pretty accurate indication of how much time you are going to waste for no sensible result.
The speciifed life will be typical. All you will be doing is checking the life one specific item with no indication of how typical it is, and therefore a comparison that is utterly meaningless. Maybe your intention is to repeat the test 50,000 times, and that might indeed be more accurate. I guess, after that, there is a faint chance that you will have concluded that there is probably more to life than the life of light bulbs.

very nice logic of building
do u have any code to start with?

The example code that comes with an RTC library is an excellent start.

aarg:
The example code that comes with an RTC library is an excellent start.

hello aarg

i have checked yes the example code but the hours reset to zero after reaching 12 or 24 based on the timing system
any idea how to modify that as i am new to coding