Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : DHT22 PicoMite 5.07.06 jumping readings
Page 1 of 3 | |||||
Author | Message | ||||
smileyint Newbie Joined: 25/12/2022 Location: SingaporePosts: 7 |
Previously on 5.07.04, DHT22 reading only jumped once in a while. But on the current version, the jump is more obvious every couple of seconds. The delay in the main programe is half a second. Even a long delay cannot evade the jumping readings. Both the temperature and humidity will shoot to 1000. Tested with another DHT22 and problem still persisted. Anyone with similar problem? Thanks. |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3800 |
Sensor or module & how are you connecting it? John |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
If memory serves to get correct readings a DHT22 should only be read at 2 second intervals. When it receives a "wake" pulse it retrieves the last readings from memory and sends them then takes new readings, saves them and goes to sleep and won't accept another "wake" pulse for 1.8 seconds. BITBANG HUMID returns 1000 if it does not get a response, or the checksum is wrong. Edit Just tested a DHT11 on b10 and BITBANG HUMID works perfectly with 2 S intervals and alternates with 1000 with 1 S intervals. Edited 2023-01-27 22:16 by phil99 |
||||
smileyint Newbie Joined: 25/12/2022 Location: SingaporePosts: 7 |
I connect to 3.3v, gnd and pin17 as Bitbang HUMID GP17, temp, humidity. Thanks Phll99 for the in depth workings of DHT22. Try at exactly 2s and added another 2s before looping still have more sporadic 1000. On earlier version 5.07.04 much less occurance of 1000. > RUN Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.7 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.6 Temperature is 30.9, Humidity is 67.5 Temperature is 30.9, Humidity is 67.5 Temperature is 1000, Humidity is 1000 Temperature is 1000, Humidity is 1000 Temperature is 30.9, Humidity is 67.4 Temperature is 30.9, Humidity is 67.3 Temperature is 30.9, Humidity is 67.3 Temperature is 30.9, Humidity is 67.3 Temperature is 30.9, Humidity is 67.3 Temperature is 30.9, Humidity is 67.3 Temperature is 30.9, Humidity is 67.2 Temperature is 30.9, Humidity is 67.2 Temperature is 30.9, Humidity is 67.2 Temperature is 30.9, Humidity is 67.2 Temperature is 1000, Humidity is 1000 Temperature is 30.9, Humidity is 67.2 Temperature is 30.9, Humidity is 67.1 Temperature is 30.9, Humidity is 67.1 Temperature is 30.9, Humidity is 67.1 Temperature is 30.9, Humidity is 67.1 Temperature is 30.9, Humidity is 67.1 Temperature is 30.9, Humidity is 67.1 > Edited 2023-01-27 23:54 by smileyint |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Try adding another pull-up resistor. The modules usually have a 10k between V+ and Signal pins, which is ok at 5V but at 3V3 might not be enough. put another 10k from GP17 to 3V3 and see if that helps. If the problem persists modify your code to discard readings of 1000, replacing them with the previous readings. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
No problems here with beta10 and my DHT22 What speed are you running the CPU at? I tried 133 and 200 without any problems. Jim VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9110 |
Just run 900 samples at 2 sec intervals with no errors V5.07.07b10 |
||||
smileyint Newbie Joined: 25/12/2022 Location: SingaporePosts: 7 |
I did not use any resistor because i do not have many and that value. I using half size breadboard for all components including the pico itself in close proximity since ver 5.07.04. I will try the beta later and revert if there is any different. It is a very good ideal to discard readings of 1000 and i will try to code that. I did not overclock or do i know how to. I think overclock will shorten the soc life without additional cooling. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
The exact value of the resistor isn't critical in this application. Anything between 2.2k ohms to 15k would be worth a try. One way to remove the 1000s. For n = 0 to 100 BitBang Humid GP17, T1, H1 If H1 < 101 then Humidity = H1 Temp = T1 EndIf Print "Temperature is " Temp, " Humidity is " Humidity Pause 2000 Next The CPU speed should not affect BitBang Humid. Edited 2023-01-28 12:45 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
Breadboards are a common source of bad connections. I would try and find the source of the bad readings and only then code around them. Jim VK7JH MMedit  MMBasic Help |
||||
smileyint Newbie Joined: 25/12/2022 Location: SingaporePosts: 7 |
Highest resistor i had is 1k Ohm out of the few i had unfortunately. Thanks Phil99 for the code which i will incorporate in my main programme. I had rechecked the breadboard connections prior as i used up all the pico pins except gnd mostly for the ssd1963 with touch. I happy to report the beta did not had the frequent 1000s as ver 5.07.04 before. And i will skip ver 5.07.06. My main programme had a time clock that had a while loop with a 500ms delay and yet the DHT22 seems to be able to handle as before. If i need a longer delay like 2s, i need to add some counter logic for the DHT22 to poll after 4 counts which i will try. Thanks everyone. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9110 |
There has been no change in the DHT22 code since the very first release of the PicoMite |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Just out of interest, I ran a test overnight - a loop reading once every 2 seconds. Pico on a PCB with DHT11 connected by 3 short leads - signal,3v3 and ground. The Pico is powered by external 5V from bench P/S and uses a LDO 3v3 reg on the PCB (Pico 3v3 disabled). Firmware is 5.07.07b10 Total run loop count was 27400 with a total error count of 65. The errors seem to occur in groups between 2 and 8 over between 10 and 2 or 3 hundred cycles between errors then there will be clean runs of 400 or so up to longest clean run of 1900 cycles. Not a clear pattern however. Am going to try and hook up a logic analyser to try and catch an error run. Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
A while ago I spent some time playing with different ways to get the data from a DHT11 and DHT22. There are a couple of different data sheets for them that are not in complete agreement. One says the "Wake" pulse must be 18mS for the 11 and 1mS for the 22 while another says these are the minimum times. I think BITBANG HUMID uses 1 & 18mS so might be on the borderline of working / not working for some units. For the DHT11 I used 20mS and found that reliable. The minimum time between "Wake" pulses might also be a bit rubbery as @smileyint has found his DHT22 works at 500ms while my DHT11 becomes unreliable below 1.6S Another difference is one dasheet suggests the DHT11 only outputs whole degrees (used by BITBANG HUMID) while the other shows it using 1/10s, which turns out to be the case. The DHT11 is less accurate so the 1/10s mean little unless you measure the error at two temps so the readings can be corrected. A logic analyser could determine if the issue is no response or corrupted data. . |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
I measured the start pulse at 1.05mS for the DHT22 and 19mS for the DHT11 VK7JH MMedit  MMBasic Help |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Those times indicate any DHT should be reliable unless it is below spec. Another way to check the error type without a logic analyser. Link a count pin to the DHT pin and let the following run. > setpin GP6, cin > do:pin(GP6)=0 :bitbang humid GP7,t,h,1 :? n,pin(GP6),t,h :pause 2000:inc n :loop 0 43 23 74 1 43 22 67 2 43 22 72 3 43 23 71 4 43 23 72 5 43 23 72 6 43 22 72 7 43 22 72 8 43 22 72 9 43 23 72 10 43 23 72 11 43 23 72 No response gives:- n 1 1000 1000 Corrupt data should give 43 pulses (or close to 43) and 1000 for t & h. Edit Finally captured an error. Corrupt data not lack of response. 3320 43 22 75 3321 43 22 75 3322 43 22 75 3323 43 1000 1000 3324 43 22 75 3325 43 22 75 3326 43 22 75 Edit 2 @smileyint As your highest resistor is 1k I have tried that and it causes no problem so it would be easy for you to see if it reduces your errors. . Edited 2023-01-29 14:43 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
I have been playing also. I only have a DTH22 so no comparison possible. It took a while for me to capture a bad reading but since I connected the CRO lead today I get a bad read every few hundred. The following table is part of a spreadsheet of CRO data. There is one difference. With a bad reading the low time is always 40nano seconds shorter and the high time 40 nS longer. The CRO samples every 4nS so it is not a sampling error. The bad reading checksum calculates correctly and the values make sense so it is a reading the data problem. The other timing of note is the 'low' state before each byte is 10uS longer than the other low state times. That doesn't get a mention in my data sheets. The full data attached. dht22.pdf Ignore the sample column uS is the time that the device stayed in either high or low state is the corresponding high or low sate bit is the bit determined by the length of a high state byte is the 8 bits of the previous column Temperature and humidity are X10 Jim VK7JH MMedit  MMBasic Help |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
That is similar to what I got using CSUB LOG to capture the data. I didn't know if the problem was at the DHT end or Pico end. What I did find was stretched highs were often followed by short lows, so decoding accuracy was greater when only using the interval between rising edges rather than the duration of the highs. Edit So far the simple error detector above has recorded 6 errors in 4600 samples. Edit 2 I got the bit about rising edges wrong, It's the interval between falling edges that works best. https://www.thebackshed.com/forum/ViewTopic.php?TID=13832&P=3#174519 Edit 3 13 errors in 12000 samples. Edited 2023-01-29 20:45 by phil99 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
The pico firmware simply measures the 'high' time and any time greater than 50uS is a one. The length of the low time is not measured. This should be reliable and very forgiving of any timing variations. My CRO did register some 4nS glitches but I put that down to the CRO and both good and bad readings had a similar number of these one sample glitches so I don't thing there are real glitches. I will have to find time to take a lot more readings but so far, I cannot see what causes the occasional bad read. Jim VK7JH MMedit  MMBasic Help |
||||
Glen0 Regular Member Joined: 12/10/2014 Location: New ZealandPosts: 86 |
I have been struggling with trying to get the temperature and humidity to display separately on an LCD for the past few days (only a few hours at a time of course) and then today decided to change to the latest firmware, PicoMiteV5.07.06.uf2. All of a sudden I am also getting regular "1000" readings whereas before there were none. Unfortunately I can't remember what FW version I was running, it was one of the RC's from December last year I think. Absolutely no hardware changes, just Firmware. Copy and paste from Maximite Control Centre: option list PicoMite MMBasic Version 5.07.06 OPTION AUTORUN ON > flash list Slot 1 in use: "" Slot 2 available Slot 3 available Slot 4 available Slot 5 available > RUN Temperature = 21.9Humidity = 74.4 Temperature = 22.3Humidity = 74.6 Temperature = 22.3Humidity = 74.6 Temperature = 22.3Humidity = 74.6 Temperature = 1000Humidity = 1000 Temperature = 22.3Humidity = 74.6 Temperature = 22.3Humidity = 74.6 Temperature = 22.3Humidity = 74.6 Temperature = 22.3Humidity = 74.5 Temperature = 1000Humidity = 1000 Temperature = 22.3Humidity = 74.5 Temperature = 22.3Humidity = 74.6 > Copy and paste from MMedit V5.0.3: 'HC-12 Transmitter SETPIN GP21, GP20, COM2 OPEN "COM2:9600" AS #2 DO Pause 100 Bitbang HUMID GP16, temp, humidity Pause 1 PRINT #2, temp,humidity Pause 10 Print "Temperature =" temp "Humidity =" humidity pause 1000 LOOP |
||||
Page 1 of 3 |
Print this page |