Go Down

Topic: Hot Swappable 1-Wire and DHT22 (Read 1 time) previous topic - next topic



I am having a play around with the Arduino, to use it to record temperature measurements (using the 1-Wire Network), in addition to Temperature and Humidity measurements using the DHT22 Sensor. The test run works, and outputs delimited data to the serial port, which a simple VB.Net app can work with to store the data in a database.

The issue I am having though, is that I want the system to be hot swappable, and be able to remove, or add sensors whilst it is running. The 1-Wire system reports the ID of the sensor, and the temperature, so it does not matter if another sensor gets added or removed (at least to the vb.net side) and the DHT22 sensors will be tied to specific pins, that is pins X through Y will be used, so I don't mind if different sensors get plugged in (at least if DHT22 - Sensor 1 gets plugged into pin x instead of Y.

My question is, how can i configure the wiring, or the code to allow me to be able to plug in new sensors, or remove old ones without having the unit reset?

Thanks for your help :)


If you use the OneWire library with the examples for the DS18B20, the bus is scanned for every DS18B20, and the checksum is calculated to be sure the data is correct.

I did some tests, and I could add and remove sensors runtime without problems.

You might have some data corruption if there is communication going on and you add or remove sensors. But you just get an checksum error, so you can detect a wrong value.

I forgot what the DHTxx communication looks like. But looking at the Adafruit code, there is a timeout in the code. So this should be no problem (I hope).


Set all the DHT22 pins to OUTPUT and HIGH.  You pulse the line LOW and switch to INPUT_PULLUP.  If the line does not get pulled low within a very short time there is no DHT22 on that line.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up