![Photo](http://www.gravatar.com/avatar/ceea06d95c2cfe21fe63e29dbd272585?s=100&d=http%3A%2F%2Fforums.netduino.com%2Fpublic%2Fstyle_images%2Fmaster%2Fprofile%2Fdefault_large.png)
DHT11 Temperature Sensor
#1
Posted 21 November 2010 - 04:52 PM
I bought this sensor: DHT11 from nuelectronics. Does anyone have any experience connecting this device to the Netduino? I tried to port the C++ code from the Arduino, but to be honest I have no idea how to do it! I really hope someone can help me out here!
Here is the arduino example: http://www.nuelectro...r_pde/dht11.pde
Here is the datasheet: http://www.micro4you...ensor/DHT11.pdf
Hope to here from you guys! Thanks in advance!
Ramon
#2
Posted 22 November 2010 - 08:37 AM
This sensor uses proprietary 'one-wire' interface (not to be confused with Dallas/Maxim 1-Wire), which requires microsecond delays - unfortunately, this is not possible to do in managed (C#) code, you'd need to implement a native (C++) driver in the firmware.I bought this sensor: DHT11 from nuelectronics. Does anyone have any experience connecting this device to the Netduino? I tried to port the C++ code from the Arduino, but to be honest I have no idea how to do it! I really hope someone can help me out here!
#3
Posted 22 November 2010 - 03:54 PM
#4
Posted 22 November 2010 - 06:27 PM
Unfortunately, not without modifications, because the communication requires sampling the input (the current implementation of BitBanger can only output clock and data). According to the device datasheet, after an initial 'reset' pulse (similar to 1-Wire Reset, but much longer >18 ms) and response, the sensor starts sending 40-bit data in form of '0' and '1' slots, where '0' is represented as 50 µs LOW followed by 26-28 µs HIGH, and '1' as 50 µs LOW + 70 µs HIGH.Would the "bit banger" driver work for RvBCrS's requirements?
Perhaps with clever sampling the native driver could be rather simple (e.g. wait and sample just to detect ~27 µs vs. 70 µs HIGH pulse), but IMHO it would still need some edge synchronization - depending on the actual HIGH signal duration deviance, it may be 40*2 µs worst case, which is the whole slot.
Or, it may be possible to do it via UART (similarly to 1-Wire), but I have not calculated the required baudrates; and in all likelihood an external circuitry (two transistors) is necessary to support open-drain data line (Tx and Rx wired together).
#5
Posted 22 November 2010 - 07:28 PM
![:)](http://forums.netduino.com/public/style_emoticons/default/smile.png)
#6
Posted 22 November 2010 - 07:50 PM
Would you consider using an 8-bit microcontroller (such as ATtiny or ATmega) as a 'bridge' between Netduino and the sensor?Anyone wants to buy a DHT11 sensor
#7
Posted 23 November 2010 - 01:57 PM
Would you consider using an 8-bit microcontroller (such as ATtiny or ATmega) as a 'bridge' between Netduino and the sensor?
Yes that would be a fine solution, the only problem is don't it need to be a Arduino then? And in all cases I need to write C++ or C witch is a problem for me as I don't know how
![:)](http://forums.netduino.com/public/style_emoticons/default/smile.png)
#8
Posted 27 May 2011 - 09:08 AM
#9
Posted 27 May 2011 - 04:05 PM
#10
Posted 27 May 2011 - 07:59 PM
#11
Posted 27 May 2011 - 10:19 PM
You could build a native driver and build it into your firmware...or perhaps use SimpleNGEN from Corey Kosak (if it supports reading values yet--not sure on that one).Hi Chris,
no, they're not one-wire. They use some own protocol.
Chris
#12
Posted 28 May 2011 - 11:06 AM
You could build a native driver and build it into your firmware...or perhaps use SimpleNGEN from Corey Kosak (if it supports reading values yet--not sure on that one).
Chris
Not sure if I could do this. Maybe I will use one Atmega168 just for DHT22 reading and pass the data via serial to NetDuino.
However I think a nice DHT11/22 support in NetDuino is essential.
#13
Posted 16 June 2012 - 11:03 AM
#14
Posted 16 June 2012 - 06:44 PM
Have you tried DHT11/22 sensor sample application? There have been a few cases where the communication did not work reliably, in all likelihood due to the deviations of the signal waveforms, but in most cases it works reasonably well.I bought a pair of RHT03 from Sparkfun, http://www.sparkfun.com/products/10167 (which are the same as DHT22), only to find out I can't use them with Netduino.
#15
Posted 18 July 2012 - 04:22 PM
![:)](http://forums.netduino.com/public/style_emoticons/default/smile.png)
#16
Posted 18 July 2012 - 07:52 PM
Would it be possible for you to determine what interrupts are lost - at the beginning or at the end? There is one [IMHO breaking] change in .NET MF 4.2, which could be related (issue 1073, fixed in changeset 12496): if the interrupt queue is full, the oldest entries are removed to make room for new ones. If I remember it correctly, the Netduino queue size is 128.I've just updated my Netduino to firmware version 4.2.0.0 RC5, and now I'm only seeing a max of 30 - 40 falling edges before communication stops.
#17
Posted 18 July 2012 - 10:38 PM
#18
Posted 15 November 2012 - 12:33 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users