Water activity? And why would I want to measure it? Food always contains a certain amount of ‘free’ or unbound water. The more unbound water is present, the easier it is for micro-organisms like fungi to grow. Hence, the shelf life of food products is shortened by the presence of unbound water. Water activity is a physical quantity that describes the amount of unbound water in a product. Therefore, by measuring the water activity, you can estimate the shelf life of food. Only problem is the incredible amount of money you have to pay for a commercial water activity meter. In this article I describe an easy and cheap water activity meter on the basis of a humidity sensor, an NTC, and an Arduino Pro Mini.
Principles of water activity
For those not interested in the physics of water activity, skip to the sensor part.
Water activity aw is a thermodynamic quantity defined as the vapor pressure of water (p) in the substance and the vapor pressure of pure water at the same temperature (p0):
This is a value between 0 and 1, 0 meaning there is no free water in the substance and 1 meaning there is so much that the substance resembles pure water. Expressed as a percentage, water activity is also known as the equilibrium relative humidity. So, measuring the water activity of a substance is actually quite easy: it’s just a matter of measuring the relative humidity of the air above the substance.
Professional water activity meters are very expensive and usually based on a dew point measurement. The temperature of a mirror above the sample is slowly lowered until moisture condenses on it. The temperature at which this takes place is the dew point. Psychrometric charts are used to calculate the water activity from the dew point.
A much simpler solution uses either a capacitive or a resistive relative humidity sensor. This offers a direct way of determining the water activity and it is a much cheaper solution. But, since nothing is ever for free, lower price goes at the expense of accuracy and reproducibility. Nevertheless, for a rough estimate of shelf life, such a sensor will do just fine.
The aw meter has two sensors, a TS-NTC-232 temperature sensor and a Hygrosens EFS-10 humidity sensor. The temperature sensor is a quick response (15s) NTC with a 0. 5% accuracy. The humidity sensor is a resistive type with 2% hysteresis. It needs an alternating signal to read it out, probably to prevent drift from messing up the signal.
Water activity is strongly temperature dependent, so the measured water activity needs to be accompanied by a temperature value.
It is even possible to correct for measurement errors as a function of temperature, but that would mean that the aw meter be calibrated for different temperatures. I did not go that far just yet, for now all values need to be measured around 16 to 18°C. This is enough, since the meter will be used in a laboratory that is constantly kept at this temperature.
OK, let’s look at the central part of the electronics, the readout unit of the humidity sensor. The data sheet of the sensor explains that an alternating signal should be put on the sensor to read it. Looking around on the Internet I found a nice example of the use of EFS-10 on http:// www.sjmp.de/java/feuchtigkeitssensor-und-rs-232-mit-java/ (see the scheme). An oscillator is formed around the humidity sensor (Feuchtigkeitssensor), R1, C1, R2 , R7, and an opamp. The frequency of the oscillator signal depends on the resistance of the humidity sensor. This is the hart of the readout unit. R4, R5, C2, and the BAT43 diode are purely for transforming the signal in a nice block wave, at least, that’s what I found out by trial and error. R6, R9, R10 and the ‘Komparator’ I don’t use in my scheme, since all of this is solved by Arduino. The connection of IC2A seems a bit weird, but this is done to prevent noise on the inputs.
At this point, open the PDF file of the aw-meter schematics at the bottom of this page and follow along in the text. Connected to digital pin 2 of the Arduino Pro Mini there is the humidity sensor readout unit I just discussed. The temperature readout section is far easier, it just consists of the NTC in a resistance divider connected to analog pin 0.
The fan is controlled by digital pin 11. Since the DC motor (floppy drive motor, Mitsumi M25E-4) draws a bit more power than Arduino can provide, it is connected via a transistor switch. R6 and R11 are current limiters and D1 is a protection diode against inductive kick as a result of the motor switching on and off. The remaining digital pins are used to control a 16×2 line dot-matrix LCD display with nice blue backlighting (Conrad 181651).
In addition to the control PCB, there is a separate PCB for the control buttons. I found some really nice surface mount buttons with blue LEDs in them (Marquardt SMD tact switch blue, Conrad 703124) and decided they would go very nicely with my blue backlit LCD. However, I had to create my own library for the buttons in Eagle, since there was none (they are included in the Eagle files in the download section). The scheme of the panel shows the buttons with the current limiting resistors for the LEDs and pull-down resistors for the buttons.
I needed a robust case, so I bought an anodized aluminum box (168x103x42mm, Conrad 523224) and made sure that the control PCB perfectly fit the sliding rails inside the box. That way, it can easily be inserted and extracted when assembling the case. One of the shorter side walls is fitted with a power switch and a hole for the power cable. Holes were drilled in the bottom plate to fit the sensors (both temperature and humidity) and the axle of the fan motor.
The sample needs to be contained in a small closed volume to have an accurate and fast reading. I have been looking all over the place for a box that met the demands (not to high, not to wide, but wide enough to facilitate the sensors and the fan, flat cap, etc.). Finally I settled on a small container for hair gel. After cleaning it a few times thoroughly, I drilled holes at the positions corresponding to the holes in the bottom plate and mounted it. In the figure below you see the green cap mounted to the bottom plate. The white cylindrical protrusion is a special foam protector for the temperature and humidity sensors to protect against dirt and liquid spills. The other strange object can be recognized as a cross-shaped servo horn. Though not a propeller, this thing provides enough airflow to bring the humidity of the sample in equilibrium with the air in the container.
Finally, the panel and the LCD display were mounted in the top plate of the box. To this end, I used my hobby milling machine to make a nice square hole for the LCD display and mounted it using nuts & bolts. For the buttons I drilled four holes and milled a beveled edge on each hole. This was necessary, because the SMD buttons were not that high; they only protruded a few tenths of a millimeter. By beveling the edges, there was a little more room to push the buttons. The panel was glued to the back of the top plate with a two component epoxy kit.
Before I could actually write the firmware, I had to think of what functionalities I wanted my aw-meter to have. You should at least be able to control the fan speed, choose the measurement time, and do a measurement (obviously). I made a diagram of the menu structure with all possible actions (timeout, button presses) and their consequences. The diagram can be found in the downloads section. The menu is in Dutch (sorry about that) for a better user experience (at least for native Dutch..). From that, I created a finite state machine (FSM) and the control structure was done.
Retrieving the signal for the temperature sensor is easy; just readout analog pin 0 and convert the value to a temperature using a linear correlation. I calibrated the sensor with hot water and a calibrated digital food thermometer. The humidity sensor is a little harder to read, since the circuitry around it produces a signal with variable frequency as a function of humidity. The sensor was calibrated by registering the signals during humidity measurements of saturated solutions of KCl, NaCl, K2CO3, and NaOH. The real water activities of these solutions was found in tables of different sources on the internet. The signal is corrected for a slight variation in temperature, but only in the range of 16-18 °C. Finally, the fan speed can be controlled by PWM signals simply by writing a value (analogWrite) between 0 and 255 to the datapin it is connected to.
Currently, the aw-meter is in use in the flavors & fragrances lab of my brother’s chocolaterie (http://www.huizegeers.nl).