attaching a AM2302 (wired DHT22) temperature-humidity sensor -
#1
Posted 30 September 2011 - 07:43 PM
They offer source code for the Arduino that I am going to try porting to Netduino+, but I need a few pointers
1) I would like comments on this as Temp / Humidity sensor if anyone has experience
2) I have a background in micro controller programming, but it has been along time and hardware has changed:
- I see how to connect power
- How to what type of input/# do I connect the data input wire on the Netduino+
- Any special settings in the netduino to access the AM2302 in prepartion to reading it /
coding?
Thanks in advance to any comments you have
Paul
#2
Posted 30 September 2011 - 08:22 PM
-- H.L. Mencken, "What I Believe"
#3
Posted 30 September 2011 - 08:35 PM
If this is DHT22 sensor, you may want to check out DHT11/22 sensor driver sample.I would like to use an AM2302 temp/humidity sensor with a Netduino+
#4
Posted 30 September 2011 - 08:48 PM
Reading that sensor is a bit tricky with the netduino, as it requires microsecond timing while reading the data. Are you restricted to that sensor?
Hi, No I am not restricted to that one. I did like the fact it was wired and seemed accurate. It had code to review which gave me a logical flow of what to do .net wise
Please suggest others, thank you
#5
Posted 30 September 2011 - 08:59 PM
Hi, Yes it is.If this is DHT22 sensor, you may want to check out DHT11/22 sensor driver sample.
The application is a temperature / humidity sensor for an attic. I don't need split second changes. This information will partially be used to activate/deactivate an attic fan. Readings less than 5 minutes apart have to be "de bounced" when the fan comes on because the fan cools the attic back down for the first couple of minutes, and then it warms back up. There is no advantage to running the big 30" for less than 5 minutes.
If the downside of getting the timing wrong is that a number of readings come back as errors because interpretive .net isn't ready, I can deal with that. However if it is tricky to get a reading at all, that's a different story.
Thank you both for your replies and any additional direction you can provide
Paul
#6
Posted 01 October 2011 - 05:22 AM
#7
Posted 01 October 2011 - 07:13 AM
Originally, I was thinking about [ab]using SPI too, but as it turned out, the interrupt-based communication works rather well (better if the firmware clock resolution is increased). I have both (DHT11 and DHT22) sensors, which I used during development, there are slight differences between the specification timing and real device.Of course, this is much like a hack, and a more elegant way is surely preferable, but...if anyone wish to try, I think would be really interesting. As stated, I can't try, being without such a sensor.
#8
Posted 01 October 2011 - 08:01 AM
#9
Posted 01 October 2011 - 08:29 AM
The sensor data can be read using the 'stock' firmware, no modifications are necessary. But, because the slow clock resolution is close to the length of bit pulses, it may cause false readings (also the real device does not have the timing exactly according to the specification), such errors can be detected via checksum or by checking measured values (both sensors have very limited measurement range and precision, which makes it easy to detect invalid values).Anyway, I don't understand...using your super-clock firmware, are/would you able to sample this sensor's data, collecting the sample in real-time?
I may believe about the clock increase, but I'm still suspicious about the managed code to store the collected data, PLUS the possible delays caused by the GC.
How would you solve this particular problem?
'Super-clock firmware' just decreases the error of pulse length measurement, it allows precision of ±2.7 µs instead of 'default' ±21.3 µs (which is significant, considering the bit pulses are 50 + 27 and 50 + 70 µs specified, about 54 and 73 µs in reality, depending on the particular sensor).
In my trivial application, I did not care about GC, it did not happen. You are right, GC can disturb the communication, but there is not really much we can do about that - the solution would be single-wire native driver (that can disable interrupts) or PinCapture.
#10
Posted 01 October 2011 - 01:44 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users