Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

BLE Hour Meter

Status
Not open for further replies.
I'm needing to design a bluetooth enable hour meter. I'm thinking of using a ESP32-WROOM module. My question is, how do I store the seconds value? If I increment a counter every 1 second while the device is powered, and then save it, I'll degraded the non volatile flash. Is there a counter IC that wont loose its value over a power cycle
 
I would like it to match a mechanical hour meter. I believe those count every second. The machines it will go in will run from just a few minutes to sometimes 48 hours.
 
If you dedicate 1 meg of flash to count seconds by setting one bit per second you will get 9 months before you run out. Use a byte counter to count how many times it's wrapped around and you can count over 100 years and have minimal wear on the flash.

Mike.
 
I'm needing to design a bluetooth enable hour meter. I'm thinking of using a ESP32-WROOM module. My question is, how do I store the seconds value? If I increment a counter every 1 second while the device is powered, and then save it, I'll degraded the non volatile flash. Is there a counter IC that wont loose its value over a power cycle

Why would you store the seconds value (or any other) in non-volatile memory?, you just store it in normal RAM - the fact that it disappears if you lose power doesn't matter, because if it's stored in non-volatile memory it's still going to be wrong, so not worth storing. Are you perhaps confused as to where variables are stored?.

If for some bizarre reason you want to store them?, then you could add a FRAM (either I2C or SPI) that doesn't suffer from multiple writes (I use them, but not to store clock variables).

Or use a battery backed clock module, they are freely available at low cost, and keep the clock running even when power is lost.

Or, as you're using an ESP, simply read the time off the Internet when it powers up, so it automatically resets the time whenever it boots - you could do that as well as storing the value (although I still fail to see any reason to want to store it?).

Assuming you're wanting to store a record of how long an item has been running?, then you only need to store the values when power is removed - simply detect the loss of power, and save the values before shutting down - no issues at all with multiple writes.
 
I'm only wanting to know how long it has been running, not the time. So I have two options. I could use some FRAM and update the value every second or I could maybe add a super cap to keep the ESP32 powered for a second after a power outage and store the value then. I lean towards the super cap option.
 
I'm only wanting to know how long it has been running, not the time. So I have two options. I could use some FRAM and update the value every second or I could maybe add a super cap to keep the ESP32 powered for a second after a power outage and store the value then. I lean towards the super cap option.

You don't need a supercap, a normal electrolytic will be perfectly fine.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top