In a previous post I’ve been presented an idea for creating a kind of satellite solution for watching over pandemic progress over the world using low cost connected thermometers. You can get the details of this idea in my blog post “What IoT can propose against Pandemic“. Basically the proposal is to add an ultra low cost IoT communication feature into a thermometer and report the information when an over heat has been detected. That way we could be able to determine the level of pandemic and its geographical progression over time. So I won’t detail all the business model and financing proposal, you will find all of this in my previous post.
The second step is now to make a prototype of a such device to show how too make it possible. For making this I’ve selected the thermometer you see on the picture above and decided to hack it and connect it to Sigfox network. This thermometer comes from Amazon and cost 14€ but is really like all low cost thermometer we can find.
A low cost thermometer is a really cost optimized hardware. You can’t expect to wire a lot of things to get a signal to trigger a message but all the thermometer have different user interfaces: LCD where you read the temperature and sound feedback.
The sound is different when the temperature is normal or too high. This interface looks to be the easiest to interface with. the idea is to analyze the signal and detect the over-heat pattern.
The over-temperature signal is composed of multiple patterns of 3 short bip followed by a longer pause. Here is what we get from the oscilloscope:
The 3 bips have a duration of 138ms each with the same pause between each of them. Between 2 flows of 3 bips we have a 400 ms pause. The signal frequency itself is 6KHz.
So the purpose is going to detect this signal to trigger a Sigfox message and for this, to use an ultra low cost IoT solution.
You can notice the buzzer is not connected to the ground but between 2 GPIO so that way we have a 3V amplitude of the signal bu changing the voltage direction on half period.
Then, we need to simplify that signal for being processed by the MCU. basically we do not need to keep the 6KHz signal as we are only interested in the number of bips and time between bips and bips flows. So we can make a simple low pass filter. 1Khz will be great.
After that filter we have the following signal:
This signal will be more easy to process by the MCU: we just need to measure time between the rising signals.
Here are some details of the corresponding timing:
We can compare the different situations:
- When the temperature is over the normal body limit. We have 10 series of 3 bips like this
- When the temperature in in the normal body limit. We have 10 single bip like this
- When the thermometer is starting or stopping, we have 1 bip like this one.
Now, we need top create a software to detect the specific situation of the over temperature. It means we need to create a software able to detect the 3×10 bips.
The easiest way to do this will be to count the bips in a given time window. basically we have:
- Start or stop is 1 bip withing 1 second
- Normal temperature is 10 bips within a 11 second window
- Over temperature is 30 bips withing a 11 second window.
So let’s consider a 2 620 ms time windows (something we can achieve with the CMT2189C timers, we should have after a first rising edge:
- 0 new rising edge in case of start / stop
- 2 new rising edge in case of normal temperature
- 7 new rising edge in case of over temperature
So basically the algorithm is going to be:
- wait for a first rising edge signal to wake up the device
- start counting 80 loops of 256 x 0.128ms = 2 620ms
- in parallel, count the coming rising edge
- after the 2620ms, if the number of new rising edge is >= 6, transmit an alarm.
The generated signal from the buzzer is not working correctly to be detected by the MCU, so we are going to add an amplifier:
That way we have an inverted, amplified, filtered signal the MCU is going to be able to detect. The transistor is a 2N222 or BC848C
Once implemented, here is the result on an existing board with an integrated antenna.
We see on the left the integrated Sigfox antenna. Then the added PCB with the amplifier / filtering circuit. The 2 wires going out are connected to the thermometer buzzer & ground. On the right we see the Radio MCU capable of analyzing the thermometer signal and generating the Sigfox modulation to report the over heat detection.
Here is the result:
Finally, here is the final (prototype) working version