Why This Was a Bad Design: My Wireless Climate Sensor!

by MrDIYLab in Circuits > Sensors

566 Views, 0 Favorites, 0 Comments

Why This Was a Bad Design: My Wireless Climate Sensor!

preview.png

This is my wireless climate sensor. The sensor can support DHT22 or DS18B20+. It consumes around 10 μA while in standby. It sends an update over ESPNow to the hub every 15 minutes. And in this article. I will discuss my findings and why this was a bad design and how I improved it.

Watch the Video

Why this was a bad design: my wireless temperature sensor!

The video walks through the design and my findings. Feel free to add your questions in the comment section of the YouTube video if you need any further assistance.

Introduction

motion-climate.png

After I created my contact sensor, I wanted to use the same design to create more sensors. The first two that came to mind were motion sensors and climate sensors. In this video, I will focus on the climate sensor. Luckily, creating a climate sensor didn't require a lot of work as it was very similar to the contact sensor: they are both wireless and have a lot of components in common. and since the wake up mechanism was done in software, I just needed to modify the code.

Design

contact-climate.png
microswitch.png
attomy.png

In the contact sensor, I used an external micro-switch to wake it up. But in the climate sensor, I need to wake it up periodically to send the temperature readings. Luckily, the Attiny has a timer that I can use. By doing a quick research into how often I should be sending updates, I found that most temperature sensors do it every 15 minutes so I will use that. Small issue though: the longest sleep period for the attiny is 8 seconds.

To solve it, I counted roughly 120 sleep periods to get my 15 minutes intervals. So that means, every 120 wake ups, the attiny powers up the ESP8266 just like the contact sensor. The ESP8266 then reads the climate data, sends it over ESPNow and goes back to sleep ...and this repeats over and over again - every 15 minutes. Well, not exactly 15 minutes exactly as the internal clock of the Attiny is not very accurate but it is good enough. And that was the basic idea behind this climate sensor and it worked surprisingly well without too many modifications. For for the actual temperature and humidity readings I chose this!

Issue #1: Reliability

dht.png
projects with dht22.png

Which brings me to the first problem: THIS temperature and humidity sensor - DHT22. If you google "Arduino temperature projects", you will find this sensor, hands down, dominates the field. But in practice, specifically for battery operated devices, this is such a terrible sensor. And to narrow it down, I would highlight two major issues that I faced:

First reliability. They are not reliable. In theory, they look like good sensors, easy to work with, tonz of libraries for them. They also have a very good temperature range: -40°C to 80°C. The humidity is very good too, it covers the whole range 0 to 100%. It only requires one wire for its serial digital communication. What else can you ask for? Actually a lot. Right out of the box, they need to be calibrated. Out of 5 sensors, 3 needed major adjustments. On top of that, some didn't make it past 2 years. So yes, from my experience, they are not reliable and they don't last long.

Issue #2: Cold Boot Period

garbage data.png
2 seconds.png
2 second power.png

The second issue I had with these sensors was the cold-boot period. This is the time the device needs to boot up, stabilize and send its reading. To their credit though, it is right there in the datasheet and I missed it. This sensor needs 2 full seconds before it is ready. This is very bad news for energy consumption as the ESP8266 will have to sit idle waiting for the temperature sensor to get ready.

To give you some perspective, the contact sensor is done in less than a fifth of a second. This includes waking up, reading the contact status, sending a message out and going back to sleep. This sensor, whoever, will require almost 10 times that amount. I tried to see if I can minimize this 2 seconds but the answer is no. Anything less than 2 seconds and I start getting garbage data. Again, not its fault. I don't think this sensor was ever meant for battery operated devices - at least efficiently.

An Alternative

ds18.png
less power.png
power vs.png

Luckily, while designing the PCB, I made a place for another sensor: DS18B20+. I was able to test and compare both side by side. I am happy to report that my 2 major issues are resolved. It has been reliable so far and by the time the ESP8266 is ready to read the temperature, it is already available. There is one downside though, if you have noticed, it doesn't provide humidity readings, only temperatures. But that is a trade off I am willing to accept at this point.

Shopping for the DS18B20+ sensor?

■ Amazon.com - https://amzn.to/38aMlTF

■ AliExpress - https://s.click.aliexpress.com/e/_AWsAGd

■ Amazon.ca - https://amzn.to/3iJJ7IF

The links above usually are affiliate links that support the channel (no additional cost for you).

PCBs

Screen Shot 2022-03-30 at 5.00.29 PM.png

A shoutout to PCBWay for providing these PCBs for my project. I have been using their service for over 3 years and had nothing but great experience and quality. If you are a hobbyist and in the market for PCBs, I highly encourage you to give them a visit. Get 10 PCBs for $5 USD at https://www.pcbway.com

Conclusion

case.png

So that is it for me. I hope you learned something or two from my experience.

If you too want to experiment with this design, I will make the PCB or maybe a kit available in my store. The source code can be found here - https://gitlab.com/MrDIYca/ultra-low-power-trigge...

Thank you for reading!