Electronic nose

Electronic nose

Wouldn't it be interesting if your Callopie Mini could smell? Distinguish a flowering flower from a bud? Or recognize thick air?

Medium

30 mins

from 8 years on

1What you need
- Calliope mini - Editor: https://makecode.calliope.cc/ - Sensor: Seeed SeedStudio Air Quality Sensor 1.3 popup: yes
2Story
In the beginning there was no nice topic: a child in my younger daughter's class claimed that another child would stink. Again and again a great topic, which is probably not left out in any class... But you can make something out of every topic and take it up pedagogically, can't you? How does smelling actually work? What can you actually smell and what not? And what actually smells good and what doesn't? And isn't there something possible with the Calliope mini?
3The sensor
At the beginning there is the question: are there sensors (yes, many) and right after that the question: are there already 3.3V sensors, so that it will be nice and easy? SeedStudio has had a 3.3 and 5V sensor with Grove connector for 2 years: how fitting! (Haha!) The "Air Quality Sensor 1.3". The sensor is a Winsen MP503 and it measures the following volatile organic compounds (VOCs): carbon monoxide, alcohol, acetone, thinner, formaldehyde and other slightly toxic gases.

If you find other sensors for 3.3V, please write to the original author HHF popup: yes. He is also looking for a "primary school safe" method to operate 5V sensors on the Calliope Mini.

In the beginning, I was at a loss about the connection of the sensor to the Calliope mini: I expected I2C or SPI and wondered if it would be difficult to initialize the sensor. Steini then helped me to get my brain up to operating temperature (fits the topic, see below) and then everything went very easily and very quickly. It's very, very simple:
Everything you need is on this SeeedStudio Wiki page: http://wiki.seeedstudio.com/Grove-Air_Quality_Sensor_v1.3/
Here you can find some more details in the C Code: https://github.com/Seeed-Studio/Grove_Air_quality_Sensor

The sensor actually has only one pin, which is read out analog. Use the right Grove connector on the Calliope mini and read out pin C16 analog. At the beginning you should wait 20 seconds, because the sensor has to be warmed up to reach its operating temperature.

Furthermore, there are (to put it simply) certain threshold values which say something about the measured air quality:

  • a value below 10 or above 850 means sensor error (the code says 800, but we measured 808 at 70% alcohol)
  • a value below 200 means low pollution (can be reduced to 100 if necessary, see below)
  • a value above 400 can be described as a high pollution level
  • a value higher than 700 means a very high pollution

In fact, the original C code works with two measurements and their difference, that's for advanced users, as below everything goes faster.

4The program
Daughter 2 had the idea to make the Calliope Mini LED shine in different colors depending on whether it smells a lot or smells little.(Please note that the sensor can actually only measure different forms of "toxic", and not "good" or "smells" at all, but only "much" or "little".) Then we coded it quickly. (Version 1 without heating phase, the value is simply displayed and the LED color is set) Error cases (value below 10 or above 850) are not catched.
5Measurements

And then we made a first series of measurements (protocol daughter 1):

  • outside air: 31
  • indoor air: 34-50
  • children's hair: 55-60
  • beer: 315
  • 70% alcohol: 808

Next, we looked for some blooming flowers and checked if the Calliope mini could smell them. That was not so easy, because in September of course not everything is in full bloom anymore.
But we took the two "most smelling" flowers and put them into cups for a few minutes, which have a lid with a straw opening: just right for the sensor.

The idea was that the scent could "build-up" in the cups and thus be easier to measure. We left one cup empty for testing. Result: - empty cup 40-42 - cup with flowers 50-51 after 10 minutes - up to 130 of the butterfly-bush after one hour in the cup. q.e.d.

Additional material:

Wikipedia: https://en.wikipedia.org/wiki/Electronic_nose

This text as well as the image is published under a CC0 1.0 Universal license popup: yes. It was originally published in German popup: yes by HHF popup: yes and translated into English by the Calliope team.

YOU CAN FIND THE FINISHED FILE BELOW.

The program can be opened directly with the MakeCode editor.

hex