Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:06 24 Nov 2024 Privacy Policy
Jump to

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 with Micromite

Author Message
alanb007
Newbie

Joined: 08/05/2015
Location: Australia
Posts: 7
Posted: 08:03am 17 Oct 2024
Copy link to clipboard 
Print this post

Hi Guys
Firstly - i apologise for this message because it feels like i am missing something very simple.

I have correctly wired up a DHT22 to my micromite but the code in the example does not work.

My test programme is a simple 2 liner ie

humid 17, temp, humidity
print temp, humidity

The wiring is correct as per the example in the Micoromite notes

Doesnt matter whether i am running it on PIC32MX470 or the 170F256, i get the same error when i run it ie

> RUN
[3] humid 17, temp, humidity
Error : Unknown command

Running micromite 5.05.01

Everything else on my circuit works so its not the circuit

So can some wise person please point out my mistake?

many thanks
Alan
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2075
Posted: 08:49am 17 Oct 2024
Copy link to clipboard 
Print this post

No mistake. If you look in the firmware zip you'll find a folder called "Embedded C Modules" and in there you'll find an explanatory PDF called "Humid.pdf"

TLDR; Humid was removed from the firmware around V5.03 (space considerations). Copy the below code into your prog (somewhere near the end is usual) to restore the HUMID statement.

A warning: those DHT modules aren't terribly cracky, can be a pain to get working and long term the humidity sensor can become saturated giving false readings (atch, they all do if exposed to high humidity all the time, but DHT11/22 seem particularly bad and often not-recoverable).

As things progress with your project, consider moving to something like the HTU21D which is a very robust I2C device (so no freaky one-off comms protocol) - a quick search on this forum turns up working code for it if you don't fancy the chore.


CSub HUMID integer, float, float
0000002B 27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008
27BD0008 27BDFFE0 AFBF001C 00002021 3C059D00 24A50040 27A60010 0411FFF1
00000000 8FA30010 3C029D00 8C4200BC 3C049D00 24840414 0040F809 00832021
8FBF001C 03E00008 27BD0020 00041080 000419C0 00621823 00642021 000418C0
3C029D00 8C420000 3C047735 34849400 8C420000 0082001B 004001F4 00002012
0064001B 008001F4 03E00008 00001012
27BDFFB8 AFBF0044 AFBE0040 AFB7003C AFB60038 AFB50034 AFB40030 AFB3002C
AFB20028 AFB10024 AFB00020 00808821 00A0A821 3C029D00 8C420000 8C430000
3C020098 34429680 0062102B 10400003 00C0B021 0411FFC7 00000000 3C109D00
8E02001C 8E240000 0040F809 24050006 8E020010 8E240000 24050009 0040F809
00003021 8E02001C 8E240000 0040F809 2405000E 8E02001C 8E240000 0040F809
24050005 8E020004 0040F809 240403E8 8E02001C 8E240000 0040F809 24050006
8E020080 240403E8 0040F809 00002821 AEC20000 AEA20000 0411FFB8 24040190
00409821 0000A021 40944800 00008021 10000005 3C129D00 40104800 0270102B
1440008E 8FBF0044 8E420020 0040F809 8E240000 1440FFF8 00000000 10000007
3C129D00 40104800 0270102B 50400004 8E420020 10000081 8FBF0044 8E420020
0040F809 8E240000 1040FFF6 00000000 10000007 3C129D00 40104800 0270102B
50400004 8E420020 10000074 8FBF0044 8E420020 0040F809 8E240000 1440FFF6
00001021 00001821 AFA20010 AFA30014 0000B821 10000005 3C129D00 40104800
0270102B 14400065 8FBF0044 8E420020 0040F809 8E240000 1040FFF8 00000000
40944800 10000006 8E420020 40104800 0270102B 14400059 8FBF0044 8E420020
0040F809 8E240000 1440FFF8 8FA30010 000317C2 8FA50014 0005F040 005EF025
00031040 AFA20018 0411FF6C 24040032 0050102B 8FA30018 00431025 AFA20010
26F70001 24050028 16E5FFE0 AFBE0014 001E1600 8FA50010 00052202 00442025
001E1200 00058E02 00518825 7CA33C00 308200FF 00621821 322200FF 00621821
93A50014 30A200FF 00621021 8FA30010 00431026 304200FF 1440002F 001EA603
3C109D00 8E130064 8E020080 30847FFF 0040F809 00002821 00409021 8E020080
2404000A 0040F809 00002821 02402021 0260F809 00402821 00408021 AEA20000
3C020080 8FA50010 00451024 5040000C 3C109D00 3C029D00 8C520058 8C420080
2404FFFF 0040F809 2405FFFF 02002021 0240F809 00402821 AEA20000 3C109D00
8E120064 8E020080 02202021 0040F809 02802821 00408821 8E020080 2404000A
0040F809 00002821 02202021 0240F809 00402821 AEC20000 8FBF0044 8FBE0040
8FB7003C 8FB60038 8FB50034 8FB40030 8FB3002C 8FB20028 8FB10024 8FB00020
03E00008 27BD0048 20555043 65657073 6F742064 6F6C206F 000A0D77
End CSub

Edited 2024-10-17 19:39 by CaptainBoing
 
alanb007
Newbie

Joined: 08/05/2015
Location: Australia
Posts: 7
Posted: 09:19am 17 Oct 2024
Copy link to clipboard 
Print this post

Aaaaaaah
That explains it

Thankyou so much for the quick response and i will checkout the alternative

Thanks again
Alan
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 11:10am 17 Oct 2024
Copy link to clipboard 
Print this post

If you already have the DHT sensor you may as well get some use out of it.
It is possible to get reasonable accuracy and life from the humidity sensor by reading it no more than once every 30 seconds. Internal heating seems to reduce its accuracy. Between reads the DHT sleeps minimizing heating and my experiments found 30S to be optimum.
To extend its life dry it out by warming it to 50°C in dry air for at least 2 hours every few months.

Another good one to look at is the AHT10. It's I2C and can be read with just Basic commands, no driver needed. AHT10 thread
 
alanb007
Newbie

Joined: 08/05/2015
Location: Australia
Posts: 7
Posted: 07:21am 19 Oct 2024
Copy link to clipboard 
Print this post

Thats great advice - thanks for your help guys

Very much appreciated
Alan
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024