I am trying to find out how I can connect a DHT22, together with DS18B20 sensors on an emonTX V3.
I have the emonTX v3 working ok with a 3-Phase sketch and up to 4 DS18B20 and I was wondering if I could also connect a DHT22 and maybe free up an emonTH, I have close by for humidity measurements.
I found this example sketch, that supports 2 DS18B20 and 2 DHT22, but I couldn't find more info about this sketch on the forums, if it is a stock emonTX V3 and for the wiring of the sensors.
https://github.com/openenergymonitor/emonTxFirmware/blob/master/emonTxV3...
From I can understand with my limited knowledge of arduino programming and electronics, the first DHT22 data pin is connected to pin 19 of the screw terminal (that normally is used for 5V of the DS18B20).The second uses pin 2, that is normally not used. The DS18B20 use pin 5, that is the same they use normally.
What I am missing is where to connect the 5V pin of DHT22 and where the 5V of the DS18B20?
I am not interested much for two DHT22, one would be enough for me, if anyone could help.
Thank you
Re: DHT 22 sensor and emonTX v3
Hi bond79. I am also trying to add a DHT22 to a EmonTx v3 configuration, were you able to figure out the pin for the DHT22 data bus?
Regards
Re: DHT 22 sensor and emonTX v3
Hi Bond
I figured out how to do it and it works. Please let me lnow if you want me to post what I did
Regards,
Patricio
Re: DHT 22 sensor and emonTX v3
It's always better to share if you don't mind, future users will find this thread if they are trying to connect a DHT22 to emonTx v3 and use the search box, the open end won't help them much :-)
Paul
Re: DHT 22 sensor and emonTX v3
I would really want to know!
is it possible to use multiple units or only one? How did it affect power usage?
//J
Re: DHT 22 sensor and emonTX v3
According to the DHT22 data sheet, each device does NOT have, and is therefore not addressable by, an unique ID, so I think you can have only one DHT22 on the data bus.
Re: DHT 22 sensor and emonTX v3
You'll need to put each one on separate pins. You may be able to get away with just one additional pin per extra DHT22 (if not you'll need 2). You could re-purpose some of the existing pins if you alter the code...
http://wiki.openenergymonitor.org/index.php?title=EmonTx_V3.4#Port_Map
Re: DHT 22 sensor and emonTX v3
Ok, thanks!
I just want to run 5 sensors on one emonTX v3, but maybe that will limit my options to the dallas?
In order to measure the efficiency of the heat exchanger it would be nice to know RH as well, because temperature will not tell enough about the amount of energy in the air.
Som heat exchangers in ventilation systems recirculate humidity and heat, others only heat. So using the proper sensor will give more information to calculate this correctly.
Anyone has an idea how to do this? 5 sensors will be needed, or actually just 4 humidity sensors and one temperature sensor.
Thanks!
//J
Re: DHT 22 sensor and emonTX v3
Looking at the emonTX description link I sent, you could do this with the emonTX by changing the software, and using spare pins, or re-purposing existing pins. Which ones you use would depend on what else you want to do with the emonTX (e.g. Do you want to do current monitoring too? If so, how man circuits? Do you need the radio?).
I use Sensirion SHT21 temperature sensors instead of the DHT22s, as I expect them to have better long term stability / accuracy.
Each SHT21 has a temperature and a humidity sensor built-in. You'd need 5 pins for this I think (possibly 8, if it's not possible to share the clock signal between all the sensors).
If a project which I've been looking at goes ahead (not yet 100%), then I'll probably be adding two SHT21 sensors to a single emonTH in the next month or so.
Looking at the emonTX link I sent, on the emonTX 3.4, you could use (for example) digital 4 and 7 (which aren't used - assuming they're easy to get at on the board), and also 8 and 9 (if you don't mind not having the dip-switches working), not having any 1wire sensors would free up D5, and D19. If you don't want the pulse counter then D3 is available, and there's also D20 taken out to the RJ45.
You'd need to solder to get at some of these tho', so if you're not comfortable with that, it's probably a no-go.
Re: DHT 22 sensor and emonTX v3
The old emonTx V2 looks to be what you want, but only the PCB is available, full kits disappeared from the shop a while ago. (But it is slightly more noise-prone than the V3.)
Re: DHT 22 sensor and emonTX v3
Thanksfor replies!
To clarify my special needs the minimum i need is 3CTs, ac-ac and 4 DHT and 1 Dallas.
Total is 9 inputs.
This specific application is for ventilation systems.
However this can be minimized to on optical pulse reader, or transistor pulse reader, and 4DHT + 1 Dallas. It might be better to use a standard energy meter with pulse output and just hook it up. However it is not non-invasive but it reduces the amount of inputs to six and still measures the same things, maybe even more accurately so.
Energymeter is to measure energy usage from fans, heating battery and cooling battery.Temperature and humidity sensors are to control the temperatures in shafts and calculate the heat recycling.
//J
Re: DHT 22 sensor and emonTX v3
Hi Sorry for my very late response
You can only use one DHT22, connected to Pin 4 in the EmonTx block terminal, plus 5v and GND (pin 1 and 3 ). That means you are using digital Pin 2 (in order to declare it correctly in the code).
I used the DHT library, found here: https://github.com/adafruit/DHT-sensor-library where you need to define the Pin and the DHT type
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
Add the variables to the structure:
typedef struct { int power1, power2, power3, power4, Vrms, temp, tempExt, humidityExt; } PayloadTX;
Although the library expects a float value, I declared the variables as int. Maybe you can tinker with this, I didn't mind loosing the decimal information but I don't know if this will affect negative values (it doesn't get below 19º C here)
Initialize in the setup
dht.begin();
Read from the sensor in the loop
emontx.humidityExt = dht.readHumidity();
// Read temperature as Celsius
emontx.tempExt = dht.readTemperature();
That is pretty much it. I hope this helps!
Re: DHT 22 sensor and emonTX v3
Thank you Patricio!
I am not all that experienced with the programmin yet, still working on setting up the system and figuring out what i should monitor and how.
Its sad that the DHT22 does not go many on one I/O because the application i have in mind is more demanding.
I am sure that somehow i will get my head around this, thanks =)
//J