Why Use a Sensor When a Pseudo-Sensor Will Do? [Hackaday]

View Article on Hackaday

Usually, when you need to sense something in a project, the answers are straightforward. Want to sense air temperature? There’s a sensor for that. Particulate content in the air? There’s a sensor for that, too. Someone sneaking up on you? Get yourself some passive infrared sensors (PIRs) and maybe a smart camera just to be sure.

But sometimes you can be sneaky instead, saving the cost of a sensor by using alternative techniques. Perhaps there’s a way to use the hardware you already have to determine what you need. Maybe you can use statistical methods to calculate the quantity you’re looking for from other measurements.

Today, we’ll examine a great example of a “pseudo-sensor” build in an existing commercial device, and examine how these techniques are often put to good use in industry.

Case Study

When they were introduced in 2009, Coca-Cola Freestyle dispensers were a step change in the way soft drinks were dispensed. Suddenly, you weren’t limited to five or six choices on the soda fountain. You could instead sample virtually the entire Coca Cola range, all on one machine! If you’re a big soda head, this was a very rad thing. If you were a maintenance tech for Coca Cola, though, you probably saw the machine differently — not as some godly fount of soda, but as a machine to be troubleshooted, repaired, and improved. Over time, it became obvious that the Freestyle unit had a high rate of Flow Control Module (FCM) replacements in the field. And yet, 50% of the FCMs returned to Coca Cola weren’t faulty. There was something strange going on.

The problem, as revealed in a presentation from the company, was that the Freestyle machine didn’t have a dedicated pressure sensor in the fluid line. If a machine had an FCM fault or a pressure loss, it would present much the same way. Thus, techs would often swap out a perfectly good FCM when the problem was actually elsewhere. The solution was obvious: there needed to be a way to sense pressure in the system, so techs could determine if an FCM was faulty or if the problem was a lack of pressure upstream.

There’s a characteristic dip in the current flowing to the FCM valve when it opens—and it change with pressure.

To address this, an engineer might have specified an off-the-shelf pressure sensor, figured out how to retrofit it to the machine, and rolled them out in the wild. Instead, Coca-Cola developed an innovative (and presumably cheaper) solution: a  pressure pseudo-sensor, largely using equipment already on the machine.

The pseudo pressure sensor operates by analyzing the relationship between electrical and mechanical work within the FCM. Basically, the FCM is a valve that opens to allow the flow of fluid through the machine. Thus, the pseudo-sensor monitors the current at which the valve starts to move, a value that correlates with the pressure inside the system. As pressure increases, a characteristic V-shaped drop in current is observed; this pattern shifts as pressure changes, allowing the system to estimate the pressure based on the observed current.

A complicated function ties pressure to the features of the FCM current curve.

To create the pseudo-sensor, a whole lot of data was collected from the Freestyle hardware. Over 5,000 drink pours were performed with a number of FCM modules, at pressures from 1 to 140 pounds per square inch (PSI) at 5 PSI intervals. The data collected during testing was then fed into MATLAB and Simulink in order to create a mathematical model. The aim was to link the peak size of the current feedback voltage dip measured by the current sensor, and link that to pressure. Sadly, a good reliable correlation was hard to come by.

More work ensued, which tied pressure to multiple timing and voltage features on the curve. These were fed into a multi-variable regression that spat out a monstrous model that calculated pressure from six features and 26 terms. It was messy, but far more accurate, and it did the job.

From there, it was a simple matter of deploying the model that measured FCM current and spat our pressure measurements. It was loaded on an ARM Cortex M microcontroller and put through 3,300 tests over 10 different FCMs and two different Freestyle controller boards. The model predicted the correct pressure within a bound of +/- 10 PSI a full 85% of the time.

Admittedly, that would be rubbish for a proper pressure sensor. However, for a simple pseudo-sensor that’s mostly just used to see if there’s pressure in the system? It’s pretty darn good. The pseudo-sensor software has since been deployed on Freestyle machines in the field, with work ongoing to further develop the system’s diagnostics using this new tool.

The pseudo-sensor actually does a pretty good job!

Other Examples

The simple fact is that you can often get by with indirect measurement techniques if you’re constrained by things like cost, complexity, or practicality. We’ve seen other work along these very lines before. Back in 2022, we covered the work of Brian Wyld, who wanted to measure the level of a body of water. Pressure and direct surface-level sensors were impractical, so he got creative. He built a rotating arm with a float on one side, and threw on a microcontroller board with an accelerometer included. The accelerometer readings were enough to allow him to figure out the angle of the float, and in turn, mathematically derive the water level as desired via simple geometry!

“We need to measure the water level but we only have an accelerometer!”
“No problem.” Credit: Brian Wyld

We’ve also seen how this can go wrong. For example, capacitive sensors are often suggested for measuring soil moisture levels. The idea is that by measuring the capacitance of the soil, you can measure how much water content there is. The only problem is that moisture isn’t the only thing that changes the capacitance of the soil.

For these indirect techniques to work well, what you’re measuring needs to have a fairly direct correlation with what you’re trying to find out. Hence why Wyld’s float was a success — because the float angle is directly relevant to the water level. Similarly, in Coca-Cola’s case, pressure was what determined the change in the current curve of the Freestyle FCM. If the curve also changed significantly with ambient temperature or some other factor, it wouldn’t be possible to measure it and get out a reliable pressure value.

Ultimately, pseudo-sensors can be a useful tool to have in your engineering toolkit. They can let you achieve surprising feats with some mathematical insight and basic equipment. Just make sure there’s a strong basis for what you’re doing so you don’t end up with junk outputs that cause you more harm than good.



Leave a Reply