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.

Temperature sensor
Hygrosens TS-NTC-232


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.

Humidity sensor
Hygrosens EFS-10

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.

Hardware design

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.  

Scheme of 'feuchtigkeitssensor und rs-232 mit java' at sjmp.de

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 16x2 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 aw-meter opened up
The AW meter opened up

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.

The aw-meter sensor fan
The sensor fan


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.

Calibration with saturated salt samples
Calibration with saturated salt samples

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).






0 # Kenth 2014-08-05 20:00
Fantastic, i will build one to my sausage salami making
Reply | Reply with quote | Quote
0 # Mat 2014-09-02 11:45
Hey, nice Arduino project! I actually came to your blog from the Arduino website because I saw the nice little faceplate you made up. Hardly see anyone actually completing a project to the point where they actually have nice display surfaces made up, but that's what I want to do!

Did you have the metal laser cut?
Reply | Reply with quote | Quote
0 # BetaWolf 2014-09-02 13:54
@Mat: thanks for your kind comments. I usually try to do projects all the way, including casing and user interface. For this one in particular, it was essential, since it would be used in a working environment.

The faceplate I milled on my Proxxon benchtop mill (see my blog article http://www.betawolf.nl/2-uncategorised/12-look-ma-no-hands). At that time it was still hand wheel operated, I recently converted it to CNC. Look at the faceplate of the CNC control system, that one was created by feeding a CAD design to the mill.
Reply | Reply with quote | Quote
0 # Sebastian 2015-08-04 06:13
Great work indeed! I'm evaluating building a device.
Is there a measurement related reason that you tied the sensors and the measurement chamber together with the main case? I would think that an external chamber connected with a cable would be more flexible to use, also for cleaning. Is the fan inside the measurement chamber absolutely necessary? Did you evaluate how much time one gains with the fan to get a stable reading?
Reply | Reply with quote | Quote
0 # BetaWolf 2015-08-04 07:58
@Sebastian: thanks for the compliments!
There is no specific reason I tied the measurement chamber to the main case, other than that it is convenient in construction because you don't need to make a separate enclosure in which you integrate sensors. But in use, it might have been more convenient to make an extra enclosure. The fan I put in to create at least some movement. I did not do a detailed analysis of its effectivity, but from my experience in transport phenomena I know that already the slightest convection speeds up equilibration significantly. But I can probably do with a better design...
Reply | Reply with quote | Quote
0 # Sebastian 2015-11-11 16:39
Hi, about one or two months ago I actually finished in reproducing you project with some a bit different chamber setup. Was fun to do it - I can send you pictures if you like. I found the calibration quite tricky. Especially it to me it seems (from measurement and from data sheet) that the sensor is not very good in measuring humidity above 90 %. So with my current calibration everything above 85 % or so will show an aw of 0.84. I also had problems to figure out a suitable temperature calibration. Probably my brain is too small :-0. How did you make up the temperature calibration part of the formula (you mention at least valid for a small temperature change)?
I'm thinking of using another sensor, or even of building a aw meter based on dew point measurement. Of course much more complicated and to get good measurements, last but not least, one had to measure tiny temperature diffences...
Reply | Reply with quote | Quote
0 # BetaWolf 2015-11-11 18:11
Hey Sebastian, nice to hear you made one, too! I'd like to see the pictures. Are they online? If so, I can link to your site, if not, then please send them to me. I'll send you a personal mail in a sec, so you'll have my email address.

Indeed, the sensor suffers a bit at higher humidities. I think this may be due to the relatively high uncertainty at lower values of the impedance of the sensor (at higher humidities). It may also be due to a slight non-linearity in the sensor at higher values of humidity or the fact that our calibration set of salt solutions is limited to 4 salt solutions. By the way, be careful at these high values of humidity, especially at elevated temperatures. You may have local condensation on the sensor and liquid droplets really mess up the measurement.
Reply | Reply with quote | Quote
0 # BetaWolf 2015-11-11 18:18
Temperature dependency was only limited in my case, since I did not have the means to conduct measurements in a thermally equilibrated environment with accurate temperature control. I simply assumed a linear model in the limited range I mentioned. I tried to get my samples at the right temperature and measure their humidity while monitoring the temperature. Bit of a hassle ...

An aw meter using dew point can get you higher accuracy, but it is a little more challenging project. I am really interested to see the results, once you've made it. Could you keep me informed about your progress?
Reply | Reply with quote | Quote

Add comment

Security code