Skip to content
All notebook entries
Experiment · · Entry #28

The Sensor I Couldn't Trust and the Surprise Hiding in My Own Gadget

One of my most important sensors couldn't be trusted! The good thing was, the answer was hiding in one of my current sensors.

The Sensor I Couldn't Trust and the Surprise Hiding in My Own Gadget

Hi! It’s me, Sri!

This week I realized that one of my most important sensors couldn’t be trusted! The good thing was, the answer was hiding in one of my current sensors…

The Sensor I couldn’t trust:

The sensor I couldn’t trust was… THE MQ135! Now this was a big issue because the MQ135 was a key part of my gadget. The MQ135’s role was to smell the air and sense what gases were in the environment and how much of it there was. This part was very important because when food goes bad they release certain gases, the more gases that it releases in the air, the more spoiled it’s becoming. But when I tried the MQ135, I just saw it jumping around randomly from 500 - 1000! I was basically just guessing, not providing any real data. This wasn’t good. It wasn’t even reacting to any smells. I even tried to make it react by putting a Sharpie near it, but nothing happened. So, I either had to buy a brand new MQ135, or find another way.

The (not ly) ‘Brand New’ Sensor:

That was when I discovered that the BME688, a sensor that senses Temperature and Humidity, also senses gas! Now, it may sound silly that I discovered that so late because the reason the BME688 is famous is because of the gas sensor added onto it, also why it’s better than its predecessor, the BME680. But I really only bought it for the temperature and humidity, but anyways, I decided to run a small test code on my BME688 to make sure it’s working. I basically just ‘turned on’ the gas sensor part in my code and I watched the readings. The readings seemed to be working well, but just to make sure I breathed on the sensor. When I did, I noticed that the numbers started decreasing - this is a good sign. While in the MQ135, if it had been working properly the numbers would have gone up, in the BME688 the numbers would go down. This is because these two sensors function differently. For the MQ135, more gas = higher numbers. For the BME688 more gas = lower numbers. Anyways, after I stopped breathing on it, the numbers immediately went back to normal! This was a good sign.

Putting it to the test

To really try it out, I re-ran an old experiment: spoiling rice. I sealed some leftover cooked rice in the sensor’s box and let it log a reading every 5 minutes for 24 hours.

At first it looked like it was working perfectly, the moment I added the rice, the gas number dropped and the humidity jumped. I thought it was detecting the rice.

But I learned something important: that wasn’t spoilage. That was just the sensor noticing food was there. Fresh rice and spoiling rice both put moisture and smells into the air the second you seal them up. That first drop would’ve happened even with totally fresh rice. Detecting that food exists is not the same as detecting that food is going bad.

Over the full 24 hours, the real test was whether the number kept dropping as the rice spoiled. It didn’t. Instead it drifted up at night, peaked around bedtime, and came right back down by morning. A big circle that ended where it started. The sensor wasn’t following the rice. It was following the room as my house cooled at night, the air got drier and that moved the number way more than the rice did.

In the morning I opened it up. The rice smelled a little sour and looked slightly yellow. So it was starting to spoil, but just a little, and my sensor never caught that small change.

Why this isn’t as bad as you may think

I know “my sensor couldn’t catch it” sounds like a failure. But look at everything I figured out:

The MQ135 isn’t trustworthy so now I know not to rely on it.

The BME688 can do the job better and I used it just by fixing my code.

And I learned exactly why the rice test didn’t show spoilage: the rice only went bad a little, my box leaked, and the room’s temperature changes were bigger than the tiny spoilage signal.

Now I know how to do it way better next time: seal the box tighter, keep it somewhere the temperature stays steady, and maybe add a second “control” sensor with no food so I can tell the room and the rice apart.

I didn’t get a perfect spoilage graph this week. What I got instead was a more reliable sensor and a much smarter plan and honestly, that’s worth more.

Thanks for reading! More soon. Bye!

  • Sri
Related entries