I have to measure the up-time of devices such as refrigerators and geysers and store that data in the database. What is the easiest way to measure this up-time? I read that timing circuits could be used for the same. But there was no clarity on this application. As a mechanical engineer with absolutely zero knowledge about circuits, the simplest solution that comes to my mind would be to add a sensor that responds to electric current and then connect it to a timer who's reading would then be read by my micro-controller. Could someone tell me how I could implement the above solution? or could someone suggest a more efficient and cleaner solution?

EDIT: As requested, I will edit the question and clarify what exactly I want to do. The question as to why a refrigerator would be switched off, well power cuts? Now my main aim is to determine the time period for which the device is 'actively' consuming energy!

  • 3
    \$\begingroup\$ Do you mean "working and in service?" Or do you instead mean actively drawing power, such as a power meter might do except you want time? Like an engine hour meter? \$\endgroup\$ – jonk Aug 10 '16 at 6:33
  • 1
    \$\begingroup\$ How is your equipment powered? mains AC? DC? What do you mean exactly by up-time? For what applications are those devices intended? Please, provide more details of your entire problem and measurement environment. \$\endgroup\$ – Lorenzo Donati -- Codidact.com Aug 10 '16 at 6:37
  • \$\begingroup\$ Why would somebody switch a refrigerator off? \$\endgroup\$ – Andy aka Aug 10 '16 at 7:06
  • 2
    \$\begingroup\$ Are you planning to network the devices or collect the data later? It sounds as though you are doing a power survey and are planning to measure "run hours" and calculate power consumed. Please edit your question (rather than add comments) to clarify what problem you're trying to solve. \$\endgroup\$ – Transistor Aug 10 '16 at 7:23
  • 1
    \$\begingroup\$ An hour meter (q.v.) with manual logging of the recorded hours would work. \$\endgroup\$ – Andrew Morton Aug 21 '16 at 17:39

First, the current sensors. You don't even need to tap into the wires - a properly chosen coil placed next to a "live" mains wire (say, taped to the supply cable) with AC will have current induced in it if considerable (typical for running appliances) current flows through the wire. The values are well within readout range of common ADC inputs, making callibrating the input for "active/inactive" easy.

It's possible without ADC, using, say, a diode for a rectifier, a Schmidtt trigger to produce binary signal, and a potentiometer to tune the "active/passive" levels - about 3-4 extra parts per input on top of the coil, but currently microcontrollers with multiple ADC inputs are ubiquitous and you do need a microcontroller anyway; doing the readout/filtering in software will be easier.

Every microcontroller has a clock, so no problem here. You'd need an RTC if you want actual hours and not just durations, and your microcontroller will need a battery/capacitor backup (because almost certainly if the devices lose power, so does the microcontroller). It may not require exceptionally long sustained power - upon detecting input power loss, it can just record the measurements to the database in flash, and go to sleep, to be woken up when power returns.

You didn't write where the database is to reside, how it's accessed and how many devices are to be monitored - these are all factors in selecting the controller - anything between a simple 8-bit PIC, and an SBC like Raspberry Pi. The hardware part doesn't change though. Input from the coil provides a sine wave (possibly with bottom half cut off), or next to nothing; sum measurements over a period of say, 0.1s, if they are over the threshold, device is active.

One thing you wrote might be a problem: you plan to measure uptime of refrigerators. Refrigerators draw their nominal current when the aggregate is active, and performs cooling below the temperature set on the thermostat. Then the thermostat switches the aggregate off, and the refrigerator enters "idle" mode, until the temperature rises over the thermostat hysteresis threshold and it switches on. All refrigerators draw next to no current during the idle phase - about all older ones, and many new (without digital electronics) literally draw a flat zero, completely indistinguishable from the refrigerator being switched off from electrical point of view. This may pose a problem in your case.


My understanding of the question is that you are after monitoring the amount of time that a collection of devices are powered on and running. If we assume that you have the ability to characterise the devices; in other words you know what current they draw when in "up-time" and what current they draw when in any and all sleep/low power modes (if the device has operating modes other than on and off). Then the job becomes relativity simple: monitor the current into each device, if this is within the "up-time" current bands, then increment the counter on a microcontroller, which in turn uses a calibrated clock source, such as an internal or external real-time-clock (RTC).

This requires a current sensor per device, a microcontroller which can communicate with the current sensors, a uninterruptible power supply (UPS) for the microcontroller (could be as simple as a battery pack). If you want more details about what current sensors you should use, you'll need to provide more information about the environment and set up of the equipment you are a looking at.

If you can control where all of these items are located and powered from, it would be possible to power them all from one power source, monitor the current at that source and use that one current reading to work out which units are running downstream. But this assumes you have a very reliable model for the current draw of all devices.

As for knowing the current draw of each device you are trying to monitor, there are various ways of finding it out. If the device is only on or off, the unit will have some label telling you the power consumption, or you could measure it. But you would have to pay attention to the voltage supplied to the units, the AC mains is not very well regulated, in the UK it can go from 210 to 250 Volts (I think), so the current could easily vary by the same factor.

Don't forget that most fridges have more than on/off modes: it will draw more current when actively cooling than it will when it is sat there monitoring the internal temperature. But depending on what you mean by "up-time", it may or may not be an issue.

There are multiple other ways of carrying out this task depending on the devices that you are monitoring. Smart fridges for instance should be able to monitor these values easily enough with their own micro-controllers, which can already be connected to the network/internet for you to gather the data from multiple devices. Alternatively, simply buy a plug power monitor for each device, many of these devices have loggers on them, telling you the power draw over time.

  • \$\begingroup\$ thanks for the reply. the device in question is a cooler, one in which you would place soft-drinks (and maybe beer). They are commercial coolers, such as those placed in bakeries and shops. So could you now suggest current sensors for this application? \$\endgroup\$ – don_Gunner94 Aug 22 '16 at 3:28

To sense appliance on a current transformer is required a "burden" load resistor to determine the suitable Vout vs Iin. THis can be made in a 5V range for example and the rectified with a precision FW bridge Op Amp cct.

To accumulate current consumed during the day, we need to measure the average voltage and convert to RMS with a scale factor and accumulate the readings using a uC using floating point calculations.

For time we choose a 1ppm watch Xtal for frequency chosen to easily derive a 1 second clock and accumulate readings on this interval, while a separate counter keeps track of external reset input and end of 24hr period. IF desired, the events can be accumulated for longer periods and averaged per day.

You need one unit per appliance or make it a multi-appliance unit with remote current sense to 4-20mA analog link.

the power can be derived direct from the AC source with an offline regulator to float charge a small battery for back up. The output display can be a binary LED count or a 7 seg display with additional cost to cover the range of Ah expected in a 24hr period.

Other features could be added if needed.


I would use a MCU hooked up to inductive current measurement sensors, like this:

inductive sensor

They come in all ranges, the one I showed is good up to 30A. You open the clamp and put it around the wire going to each device. This is nice since you don't have to mess with the high voltage, or cut any lines, etc.

The outputs of all of these sensors (one for each device?) could be fed into a MCU's (Arduino is very user friendly) analog input ports.

From here you can do all sorts of stuff. Plot each device by itself over time to see energy usage trends per device. Add all the outputs together to get a plot of the total energy usage vs. time. Or, whatever other analysis you want.


The definition of "up-time" is not defined sufficiently to answer this question. You could argue that "up-time" for a refrigerator means the length of time since the last temperature failure. Because typical refrigeration units cycle on/off under control of the thermostat. So does "up-time" mean the amount of time the unit is actually drawing current? Or does "up-time" mean how long has the refrigerator maintained the designated temperature range? I would think that monitoring the performance of a refrigerator is more about monitoring the internal temperature and noting when the temp goes outside (over or under) the designated range.

What is that nature of the environment? It is possible to run a Cat5 network cable from each monitored equipment to a network hub? With that kind of access, you could poll all the equipment on some schedule (every 5 minutes, or whatever is appropriate) With the proliferation of the "Internet of Things" (IoT) there are many off-the-shelf solutions for monitoring various conditions (current, voltage, temperature, etc.) That would also have the benefit of real-time monitoring such as having a display that shows the status of all the monitored gear. And even notification (alarms, text messaging, etc.) for fault-condition (like refrigeration failure, etc.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.