Common Refrigerator Diagnostic Test-Bed Design, Part IV

Most common refrigerators and HVAC units are connected to the AC grid. Of course, there are also absorption, propane, kerosene, and other refrigerators but they are less popular and outside the scope of our study. Most of the electric energy consumed by a refrigerator goes into the electric motor that compresses the refrigerant (a very small portion is inevitably lost as heat due to resistance and other wastes). Sensing the details of a refrigerator's power consumption is as important as measuring the inside and outside temperature.

In this post we will describe the apparatus we use for measuring the consumed power in the refrigerator test-bed. One approach we could have taken is to use a home-appliance power measurement device such as the popular Kill-A-Watt appliance. It has been modified by the hackers community to interface with a Zigbee radio. Unfortunately, the low-resolution of the 10-bit Zigbee ADC, the relatively low sampling rate, and the difficulty to synchronize the hacked Kill-A-Watt makes it a bad candidate for our experiments.

Another approach would be to use an oscilloscope. While this would give us really good resolution and accuracy, it is not practical due to the long-duration of the experiments we envision. Continuously sampling with an oscilloscope during long hours and copying the result to a PC is achievable only with relatively high-end units. In addition to being expensive, the process is also unreliable and error-prone due to wiring and safety.

To provide more diagnostic information we have designed our own power logger. The PCB of this logger is shown below:


Of course, we can never be careful enough about electrical safety, so we put the power logger in a NEMA enclosure.


With the help of the above sensor we can log 24-bit power and voltage at 500 Hz. The sampling of two signals is synchronized, so we can easily compute the power.

Common Refrigerator Diagnostic Test-Bed Design, Part III

The main purpose of a refrigerator is to keep stable low temperature in the general compartment and even lower temperature in the freezer. The temperature inside and outside of the refrigerator is one of the most important sources of sensor data for the diagnostic process. Ideally, we would like to know the temperature at each time instance and at each point in the refrigerator and in the environment. This setup is, of course, ideal and unfeasible in practice, so we have to sample the space at several discrete points.

To measure the temperature we use the absolute champion of low-cost temperature measurement: the DS18B20 semiconductor sensor. The DS18B20 costs less than USD 3, has integrated Analog to Digital Converter (ADC), and even provides a unique laser-engraved identification code for easy location. The operating range is from -55^\circ{C} to 125^\circ{C} which is well-above our requirements. The resolution is 12-bit with an accuracy of 0.5^\circ{C}. We believe that the accuracy is often better than the one advertised in the data-sheet.

The DS18B20 is relatively slow and it may take up to 750 ms to convert a temperature measurement. On the positive side, the DS18B20 needs only two wires as it can be powered via the data-line. In our application we use external 5V power supply from the Arduino MEGA 2560 voltage regulator. Multiple DS18B20 can be chained in series. The only think that we need to connect a chain of DS18B20s to the Arduino digital I/O is a pull-up resistor of 4.7 k\Omega.

A instrumented refrigerator is shown in the photo below.


We managed to wire very thin wire outside of the refrigerator without drilling it (we used the whole for the refrigerant pipe).

The photo below shows the freezer sensor. The sensor is in a waterproof casing.


Finally, we mount two external sensors on top of the refrigerator:


Arduino Due Support for the ChibiOS

There are many advantages in using Arduino boards when building diagnostic test-beds or other embedded systems:

On the software side, there are the Arduino IDE and language. The Arduino language is close to C++ and it generates C++ code that is cross-compiled for the board. The Arduino language is extremely popular and there is vast amount of Arduino libraries for various hardware and software components such as LCD screens, keyboards and radios.

There are several disadvantages of the Arduino language:

  • Arduino is not an RTOS (Real-Time Operating System). The core Arduino implementation does not provide multi-tasking and inter-process synchronization;
  • Many Arduino drivers impose relatively large over-head.

In our diagnostic test-beds we have decided to use Arduino-compatible boards (Arduino MEGA 2560 for the common refrigerator test-bed and Arduino Due for the full-wave rectifier test-bed) and a non-arduino RTOS. Sometimes we use the Arduino IDE for quick prototyping and during development for testing new sensors.

As an RTOS of choice we have chosen ChibiOS. It is free, small, extremely neatly written, and offers a Hardware Abstraction Layer (HAL). Unfortunately, at the time of writing of this, there is limited support for Arduino Due in ChibiOS. To overcome this problem we have started developing our own Arduino Due port for the ChibiOS (click here to see the code repository).

At the time of writing of this, the implementation is very preliminary:

  • There is periodic mode only, i.e., multitasking is based on periodic timer interrupts;
  • Support for the GCC compiler only (I still have no experience with IAR or ARM RealView Compilation Tools);
  • At the HAL layer, there is only limited UART and PAL support.

In the near future, I will work on:

  1. The I2C driver;
  2. The SPI driver;
  3. The USART driver;
  4. The free-running mode.

Once the port becomes more stable and complete we will merge it into the official repository.

Common Refrigerator Diagnostic Test-Bed Design, Part II

The various feedback control mechanisms in many devices contribute to failures. Engineered devices that use bad choice of control algorithm (for example hysteresis control instead of Proportional Integral Derivative control) may not satisfy the design constraints. A proportional coefficient in a PID controller may need recalibration and the device it controls may start, for example, oscillating in an undesired way.

The refrigerator in the test-bed we are designing uses very basic hysteresis control (also known as on-off or bang-bang control). The thermostat, when warmed-up to the set-point temperature mechanically closes the circuit which starts the compressor. When the temperature drops below the desired set-point the thermostat opens and the compressor stops.

We will modify this basic electro-mechanical subsystem to provide computerized control. The new schematic is shown in figure 1.

modified control
Figure 1: The original refrigerator schematic is modified minimally when it becomes part of a diagnostic test-bed

Modifying the electrical circuit of the refrigerator is very simple and requires cutting the wire from the thermostat to the power connector and rewiring the compressor terminals. The process and the end-result are shown in the following photos:


The relay-board which is off-the shelf and is put in an aluminum box for electrical protection as shown below:


In the relay-board as well as everywhere else it is extremely important to do proper earthing. The reason for this is beyond safety: lack of good earthing can cause Electromagnetic Interference (EMI) problems. Finally, this is the Arduino shield which has all Arduino connectors for the refrigerator test-bed:


In the photo of the Arduino shield we can also see the current limiting resistors (for the thermostat and temperature sensors) and Light Emitting Diodes (LEDs) that provide basic indication for the health and operation of the test-bed. In our more modern Arduino shields we use Liquid Crystal Displays (LCDs) as they are also very cheap and easy to program.

By applying the modification described above, we can (1) change the type of control for this refrigerator and (2) inject failures. One of the possible changes in the control is to use different sensor instead of the existing thermostat control (for example a digital temperature sensor). More relevant to our goal is the ability to inject and retract thermostat open-circuits and short-circuits. Another failure is modifying the hysteresis time. We will have detailed discussion on the type of failure injections once we discuss the design of the benchmark scenarios.