Page 2 of 3

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Thu Oct 07, 2021 10:14 am
by AndyGadget
I've got 2 LILYGO E-Paper screens on order but it was one of those offers which "if it sounds too good to be true . . . .". 2 screens (without touch) for 20 quid! It did look like a reputable seller; lots of other items and they're still trading, but at that price I feel I may be testing AliExpress' refunds procedure soon. Still within the delivery window, but time will tell.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Fri Jan 28, 2022 3:13 pm
by AndyGadget
I've now got a couple of AM2320 devices to fiddle with as a replacement for the AM2302.
Look here : [Local Link Removed for Guests] for code to drive them.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Sat Jul 09, 2022 7:23 pm
by BeanieBots
I'm little late to this party but thought I'd my experiences to the pot.

Over the years, Ive used litterally 1000's of DS18B20 temperature sensors both commercially and for home projects.
I've only ever had an issue with 3 which were clearly fakes from a Chinese source via Amazon.
I've even run them on 25m of screened cable with 1k pullups instead of 4k7. Not recommended but never had an issue with it except they can suffer with self heating if read very frequently.
Never had one more than 0.5'C over 0 to 100'c out from 'real' temperature and yes, I've checked the calibration of every damn one of them.

With BME280, I bought 2, received 3 (bonus) and they have been running perfectly for a few years.
So I bought another and they turned out to be BMP280 with no humidity sensor.

I have one DHT22 which has been running for a few months now.
Every now and then it would error returning "nan" instead of a valid value.
I put in a trap to catch these and count the occurances. I divide that by the number of 'good' reads to give a percentage.
Initially, I was getting up to 20% percent fails, but this has steadily fallen to about 1:300 when being read every 5 seconds.
Maybe they need a burn-in period?

Humidity sensors are very fussy devices. The enclosure can have a major effect. Especially plastic ones. Even if they no longer smell of mould releasing agent, the enclosure can still be giving off VOCs which can have even permanent detrimental effects on many types of humidity sensor.

To calibrate a humidity sensor, put it in a closed container with a cup of saturated salt solution at 21'C. It should read 75%. Applying an offset to remove the typical +/- 10% should bring it in as close as you're ever going to get. Also, they suffer with hysteresis so will always read a bit high when comming down and a bit low when going up even when allowed to settle for a long period.

@electroguard. (to answer your earlier question) If you have a temeperature sensor in an enclosure that has electronics which is warming it up, you should be able to correct with a simple offset.
A constant power will produce a constant temperature offset. Very frequent reads will also produce an offset due to self heating. This is NOT a constant and depends on the thermal connection to the surroundings so will even be affected by humidity if it's measuring air temperature.

Just my tuppence worth.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Sat Jul 09, 2022 8:32 pm
by Electroguard
Hi BeanieBots,
I've found that its usally more problematic than just adding or subtracting from the reading, because often the difference at lower temps is not the same as the difference at higher temps - which means it will only be correct at one temperature... like a broken clock will be correct twice a day.
I vaguely remember a 'normalising' formula from school days which could give the correct result across the range, but that was half a century ago.

Anyway, is not a problem any more since I've been using the self-contained Xiaomi BLE thermometer/humidity.pressure sensors like CiccioCB used on his Epaper display. I'm using them with TFT Touchscreens, but they could be used with anything, even just displaying in a web page.
Bluetooth has at least the range of any wired sensors but obviously needs no physical contact, so is much more convenient, especially for external sensors. I protect the external ones by suspending them in a sort of miniature bee-keepers helmet to keep out bugs and shade them from direct sun or rain while still keeping them out in all weathers. They've been running faultlessly for nearly a year, still on their original button-cell batteries.

Image

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Sun Jul 10, 2022 10:53 am
by BeanieBots
Hi Electroguard,
When you say like a 'bee-keepers helmet' do you mean just a mesh to keep out the bugs or have you also added a 'Stephenson's screen' like they do on "professional" meteorlogical setups to keep out direct sun influences?
I am not familair with the Xiaomi device. I must look into it because it sounds like just what I'm after. At the moment I'm using a basic 8266f (painfully removed from a DOA nodemcu board) and BME280. It runs off 3 x AAA NiMh (via a diode to keep the volts down a bit) and sends over ESPnow (out of noraml WiFi range but ESPnow is rock solid) every 3 minutes, sleeping most of the time. I only get about 6 weeks per charge which is a bit of a PITA but manageable. I did have a small solar panel on it but after day 3 the squirrels chewed through the cable. :x I plan to post the whole project at some time because there are a few tricks that some others might find useful.

As for temperature error, you may also have a gain issue. You can fix that with a simple y=mx+c formula.
Obviously, things get much more complex for tempertures outside 0 - 100'C with latent heat of freezing/boiling and black body radiation etc. etc. but for 'normal' room temperatures it should be simple enough to make a fair correction. (or just move it away from the local heat source!). Also, don't forget to add a bit to the humidity reading as warmer air will indicate a lower reading.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Sun Jul 10, 2022 12:59 pm
by Electroguard
I suppose the technical term for for my external sensor housings would be Electroguard Sensor Contraption MkII... but you can think of it as a 4" length of 4" wide plastic pipe with an over-hanging conical hat covering the top without sealing it, deflecting all runoff to the outsides.
Basically a chimney cowling with shielded sides and a fly-mesh screen.
The thermometer unit is suspended within the pipe so that it does not rest against anything.
The bottom of the pipe is extended downwards another inch with fly mesh, which then also extends across to form the bottom.
So the unit is isolated from direct contact with sun, rain or bugs, but any difference in air temp between inside and outside the pipe will cause an ambient equalising convection air current to flow past the sensor.

I bought 5 sensors for about a fiver each at the time - am using 1 for inside, 1 for outside, 1 for the ground void underneath, + 2 spare
Like all chinese products the price goes up not down, but they are still very reasonable.
https://www.aliexpress.com/item/4000693 ... 0080%21sea

Be aware that by default they transmit their data using proprietary encryption which their phone app decrypts... but the firmware can easily be re-programmed to transmit clear text which Annex can read.
https://github.com/atc1441/ATC_MiThermometer

BTW, thanks for the normalisation formula.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Sun Jul 10, 2022 10:43 pm
by BeanieBots
Thanks for the info and links on how to change the firmware.
I'll probably treat myself to a couple as the price is still quite reasonable.
Just a shame about that dreadfull smily face :roll:
How often does it update? Or that configurable?
What sort of range do you get?
It would be nice if I could get one to work in my workshop which is about 25m from the router.
I get a typical RSSI of -90 which only gives Internet access to some devices placed at the right angle.
ESPnow is rock solid over that distance but I doubt BLE will be OK.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Mon Jul 11, 2022 10:39 am
by Electroguard
One internal sensor is about 8m away, the other two external sensors are about 2m and 5m, all being received on the same Annex32 BLE receiver.
From memory, the sensors transmit data (including battery %) a couple of times a minute.
I had forgotten that the sensors don't read atmospheric pressure, only temp, humidity and battery %.
I got around that by including a BME directly with the TFT device just to read pressure, which works fine.
I don't even notice the smiley cos I'm reading details from my Annex TFT display... and can't see the sensors anyway inside their protective cowls.

Obviously you are not going to get 25m BLE sensor range... but you can achieve your goal in other ways.
Firstly, you can easily extend your shed-to-house reliability by having external aerials on those communicating devices.
Your Annex32 device inside the shed can have an external wifi antenna, possibly even a directional antenna pointing towards the house.
That alone would probably be sufficient, but if you hunt around you can get routers with removable aerials, so you take an original leg off and replace it with an external antenna, perhaps even a directional yagi pointing at the shed.

Or even easier is if you have an old router lying around (or buy an old 2.4GH cheapy for < 20 quid), which you can put in the shed as a wifi repeater.
There are sections in the article linked below which explain how to have extended overlapping wifi zones without any adjacent channel interference.
(I am using 7 wifi routers extending 2 subnets over overlapping zones)
https://sites.google.com/site/annexwifi ... ng-routers

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Mon Jul 11, 2022 1:42 pm
by BeanieBots
HaHa, you're obviously familiar with my stunningly beautiful, enormous workshop that took me two years to dig the foundations for!
My wife calls it the shed too ;) I don't mind but what should I call the shed that sits just 5m to right of it :?:
Anyway, thanks for the tips, many of which I've already tried. I already have a WiFi repeater in a back room with LOS to the 'shed'.
When you mentioned a directional antenna it reminded me of something I tried a few decades ago when I was on 64k dial-up and no WiFi.
I came across a design which the developer called 'cantenna'. The clue is in the name. It consisted of an appropriately sized metal can with a 1/4 wave dipole positioned inside. Extremely directional but phenomenal gain. I live on top of a hill and the neighbouring hill has a hotel on top. Back then, the hotel was one of the few places that had WiFi. I've never measured the distance but it's a good 40 min brisk walk. Using the cantenna I could use their WiFi which was much better than my 64k dial-up!
I am actually RF qualified to HAM certification but all that means is that I know enough to know that I don't know enough.
2.4GHz is a very finnicky thing. Just moving the anntena to the left or right an inch can be the difference between a great signal and no signal. It is also the reasonant frequency of water molecules, so gets absorbed by rain or anything wet. (the reason microwave ovens use it).
The reason 'they' gave it to us for general public use is because it's a completely useless frequency for transmitting data. Similar to what 'they' did with CB radio. Gave us a frequency that was 5kHz off what everyone else was using and using a modulation method that was different to the rest of the world.
There are some lovely other fequencies but the MOD keeps them for themselves. eg 212MHz which is reserved for Lancaster to Lancaster comms only.
There is only ONE flight worthy Lancaster! Sorry, rant over.

Back on track. Good to know that other sensors can be added to that device. Though I doubt pressure needs to be included in an outside enclosure. I would expect the indoor pressure to be very similar to the outside pressure. With appropriate filtering, door closures etc. can easily be filtered out.
I have a bunch of BMPs (sold as BME) looking for a project.

Re: Back from the dead - DHT22 / AM2302 problem.

Posted: Mon Jul 11, 2022 4:30 pm
by Electroguard
You misunderstood, I added the BME with pressure sensor to the internal Annex32 BLE device which has the TFT touchscreen display, exactly because (as you say) there is no real difference between internal and external atmospheric pressure.
And getting chinese BMP's instead of the more expensive advertised BME's is a common sellers trick, but unfortunately I don't think the BMP's can sense atmospheric pressure.