Artificial Taste

Building on last week’s research into Taste and Smell, let’s look at the technology of chemical sensors, especially the controversial use of breathalyzers.

Demonstrating an Alcohol Breath Analyzer. Photo: National Archives and Records Administration, Public domain, via Wikimedia Commons

Chemical Sensors Overview

The MQ series is the most widely used family of cheap metal-oxide semiconductor (MOS) chemical/gas sensors for hobbyists and basic industrial monitoring.

The setup is very simple: 5V power to two pins heats up a special metal disk with a chemical. When heated (~300-400°C), oxygen molecules react with the surface chemical, creating high resistance across two measurement pins. When target gas enters, it reacts with the chemical, lowering resistance.

The resistance can be measured like any other analog input; that said, it’s best to start with a mini breakout board that handles the voltage dividing and reduces the voltage to 3.3V that a Microbit uses. They also often have a digital output (Gas/no Gas), which has a tiny adjustable resistor that sets the threshold.

Sensor Target Gas(s) Key Use
MQ-2 Methane, butane, LPG, smoke Smoke detectors, flammable gas
MQ-3 Ethanol (alcohol), smoke Alcohol detectors, breath
MQ-4 Methane, CNG (primary); Methane/natural gas
MQ-5 LPG, natural gas LPG/natural gas
MQ-6 LPG, butane LPG
MQ-7 Carbon monoxide (CO) CO detectors, exhaust gas
MQ-8 Hydrogen (H₂) Hydrogen
MQ-9 CO, flammable gases Dual CO/flammable gas
MQ-135 CO, ammonia, benzene, alcohol, smoke Air quality
MQ-136 Hydrogen sulfide (H₂S) Toxic gas
MQ-137 Ammonia (NH₃) Toxic gas

There are a number of issues with these sensors - they are fairly imprecise, and have unique characteristics to design around:

It is amazing they last as long as they do; it is the heat stress that breaks them. The chemical reaction is reversible, not destructive; it reacts when heated and reverts when it cools, like a sponge absorbing and releasing water.

This sensor overview is meant to be very general, please don’t do anything life threatening! You may ask yourself: is this even worth doing with all of these limitations? The answer comes down to your project. These are essential measurements to solve real world problems; there’s no way to interact with the real world without real world constraints.

The MQ-3 alcohol sensor. Photo by the Author

MQ-3 Analog Alcohol Sensor

The MQ-3 alcohol sensor detects alcohol vapor in the air. There are various types of alcohol; Hand sanitizer is a good test material. The sensor ‘works’: it detects alcohol. It also demonstrates the extreme difficulty of engineering a device with life and death consequences. When you test it, you will see that the device takes a few minutes to warm up and stabilize the baseline analog reading. The sensor takes a minute or so to respond to alcohol vapor and another minute or so to “de-respond” to the baseline. The sensor needs a dependable “clean” baseline to compare a sample to. The device will always report a reading but the designer can’t simply say “an analog reading above 700 = drunk” because the sensor reading needs to be compared to the air in the room. If that room is a biker bar, you will get a different base measurement than outside. As noted, temperature and many other factors affect the vaporization of alcohol.

Even professional machines have been shown to have engineering errors. This is not to say the sensor does not ‘work’ but that the way they work is often a complex and under-defined question that a designer needs to engage deeply with.

Breathalyzer: A Case Study in Precision Theater

Drunk driving is a serious public safety problem, causing about 11,904 deaths in the U.S. in 2024; about 32 deaths per day. source Roadside surveys showed about 3% of drivers are legally impaired at any particular time, but between 1AM–6AM on Saturday and Sunday mornings about 14% of drivers are drunk. source source

A drunk driving law was passed in the US as early as 1906 source, but had limited practical enforcement, as drunkenness needed to be proved in a court of law.

One defining challenge of being drunk — perhaps also a benefit — is not knowing how drunk you are; likewise, it is difficult to predict from the outside which drivers are drunk enough to cause a car crash.

Field sobriety tests source (having a suspected drunk driver walk a line, etc) depend greatly on the skill of the officer, and are open to interpretation. The “Breathalyzer,” source originally a brand name, was developed by inventor Robert Frank Borkenstein in the 1950s. The hope was that science and technology could solve a persistent problem.

The intent is good, but the use of a sensor in a product has inherent flaws worth considering. Machines marketed as precise to three decimal places were found to produce results that were sometimes 40% too high. NY Times Article “These Machines Can Put You in Jail. Don’t Trust Them.”

source

The breathalyzer is not just a technical sensor — it is a legal instrument. The gap between “what the sensor measures” and “what the number is treated as meaning” is enormous; the number it shows can take away someone’s freedom, or let a drunk driver off the hook.

Electrochemical Fuel Cell Sensors (Professional/Law Enforcement) Used in: Law enforcement roadside breathalyzers, court-admissible devices, substance abuse centers, and high-end personal breathalyzers Alcohol in breath reacts with a platinum electrode, producing an electrical current proportional to alcohol concentration Accuracy: ±0.005 at 0.100 BrAC (very high) Pros: Extremely high accuracy, high specificity (resistant to false positives from non-alcohol compounds), stable calibration Cons: More expensive Lifespan: Sensors last ~1000 tests or 1 year before replacement

Semiconductor Oxide Sensors (Consumer/Personal) Used in: Budget personal breathalyzers (like MQ-3 based devices) How it works: Uses tin dioxide (SnO₂) — similar to MQ-3 sensor — that heats a film and measures resistance change when alcohol hits it. Pros: Cheap, portable Cons: Less accurate, more prone to false positives from other compounds (acetone, smoke, etc.)

Infrared Sensors (High-End Forensic) Used in: High-precision forensic and legal settings How it works: Measures how much infrared light alcohol molecules absorb in a breath sample Pros: Highest accuracy, preferred for legal/forensic use Bottom line: Professional/law enforcement breathalyzers use fuel cell sensors exclusively for court-defensible results. Consumer breathalyzers often use cheaper semiconductor sensors (like MQ-3) but are less accurate.

Code Sample: Hand Sanitizer Test (Alcohol Sensor)

This code snippet of a full program, showing the importance of averaging multiple readings to get an accurate measurement.

input.onButtonPressed(Button.A, function () {
  let sum = 0;
  basic.showIcon(IconNames.Chessboard);
  for (let i = 0; i < 10; i++) {
    // average 10 samples for a more accurate reading
    sum += pins.analogReadPin(AnalogPin.P0); // Connect the MQ-2 AO pin to the Microbit Pin 0
    basic.pause(500);
  }
  basic.showIcon(IconNames.Yes);
  serial.writeLine("Alcohol reading: " + sum / 10);
});

The Frontier: Where Chemical Sensing Is Headed

The field is just beginning. Dogs — and even some people — can clearly smell early-stage Parkinson’s, but detecting disease by smell remains largely out of reach. E-nose research, with arrays of hundreds of sensors + ML pattern recognition, is being used to detect:

Agricultural researchers are deploying mobile E-noses in greenhouses and open fields to sniff out plant stress hormones (such as methyl salicylate). The sensors can detect a fungal infection or pest infestation in a crop days before visual damage appears on the leaves.

Future toilets may perform continuous urinalysis to identify nutritional deficiencies or disease through micro-amounts of blood, protein shifts, or even cancer cells.

Tangible Takeaways