Sorry one question. Why the waiting time in register all sensors to gateway?
Posts made by Jasper van Winden
-
RE: Multiple DH22 sensors
-
RE: Multiple DH22 sensors
Thx for your changes, I now understand were I went wrong. I gave it a quick try and it seems to work!
I understand comments about arrays. Will try to improve the code now I have some understanding of it.
Thank you verry much for your qick reply
Thank you erry
-
Multiple DH22 sensors
Hi Guys,
Recently I've made my first sensor based on a Pro mini with DH22. (And ethernet gateway) I can read the data with Domoticz.
Now I wanted to go one step further and connect multiple (3) DH22 sensors to one Pro mini. (Fore use in more intelligent home ventilation system) Electrical seems not to be much more difficult took input pin 3, 4, and 5, but progamming is (for me).
I managed to recieve date for three sensors. The problem is the data send for al three sensors is identical. Serial plotter shows sending / recieving is ok, and Domoticz shows the three sensors. (With identical values.)
I guess it may has something to do with this part:MyMessage msgHum1(CHILD_ID_HUM1, V_HUM);
MyMessage msgTemp1(CHILD_ID_TEMP1, V_TEMP);
MyMessage msgHum2(CHILD_ID_HUM2, V_HUM);
MyMessage msgTemp2(CHILD_ID_TEMP2, V_TEMP);
MyMessage msgHum3(CHILD_ID_HUM3, V_HUM);
MyMessage msgTemp3(CHILD_ID_TEMP3, V_TEMP);Or with the part:
float temperature1 = dht.getTemperature();
(because how does the progamm knows what pin)Could anyone be so kind to give me some pointers
Thank you
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. */ #include <SPI.h> #include <MySensor.h> #include <DHT.h> #define CHILD_ID_HUM1 0 #define CHILD_ID_TEMP1 1 #define HUMIDITY_SENSOR_1_DIGITAL_PIN 3 #define CHILD_ID_HUM2 3 #define CHILD_ID_TEMP2 4 #define HUMIDITY_SENSOR_2_DIGITAL_PIN 4 #define CHILD_ID_HUM3 5 #define CHILD_ID_TEMP3 6 #define HUMIDITY_SENSOR_3_DIGITAL_PIN 5 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) MySensor gw; DHT dht; float lastTemp1; float lastHum1; float lastTemp2; float lastHum2; float lastTemp3; float lastHum3; boolean metric = true; MyMessage msgHum1(CHILD_ID_HUM1, V_HUM); MyMessage msgTemp1(CHILD_ID_TEMP1, V_TEMP); MyMessage msgHum2(CHILD_ID_HUM2, V_HUM); MyMessage msgTemp2(CHILD_ID_TEMP2, V_TEMP); MyMessage msgHum3(CHILD_ID_HUM3, V_HUM); MyMessage msgTemp3(CHILD_ID_TEMP3, V_TEMP); void setup() { gw.begin(); dht.setup(HUMIDITY_SENSOR_1_DIGITAL_PIN); dht.setup(HUMIDITY_SENSOR_2_DIGITAL_PIN); dht.setup(HUMIDITY_SENSOR_3_DIGITAL_PIN); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo("HumiditySensorDrieineen", "1.0"); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_HUM1, S_HUM); gw.present(CHILD_ID_TEMP1, S_TEMP); gw.present(CHILD_ID_HUM2, S_HUM); gw.present(CHILD_ID_TEMP2, S_TEMP); gw.present(CHILD_ID_HUM3, S_HUM); gw.present(CHILD_ID_TEMP3, S_TEMP); metric = gw.getConfig().isMetric; } void loop() { delay(dht.getMinimumSamplingPeriod()); float temperature1 = dht.getTemperature(); if (isnan(temperature1)) { Serial.println("Failed reading temperature from DHT1"); } else if (temperature1 != lastTemp1) { lastTemp1 = temperature1; if (!metric) { temperature1 = dht.toFahrenheit(temperature1); } gw.send(msgTemp1.set(temperature1, 1)); Serial.print("T: "); Serial.println(temperature1); } float humidity1 = dht.getHumidity(); if (isnan(humidity1)) { Serial.println("Failed reading humidity from DHT1"); } else if (humidity1 != lastHum1) { lastHum1 = humidity1; gw.send(msgHum1.set(humidity1, 1)); Serial.print("H: "); Serial.println(humidity1); } float temperature2 = dht.getTemperature(); if (isnan(temperature2)) { Serial.println("Failed reading temperature from DHT2"); } else if (temperature2 != lastTemp2) { lastTemp2 = temperature2; if (!metric) { temperature2 = dht.toFahrenheit(temperature2); } gw.send(msgTemp2.set(temperature2, 1)); Serial.print("T: "); Serial.println(temperature2); } float humidity2 = dht.getHumidity(); if (isnan(humidity2)) { Serial.println("Failed reading humidity from DHT2"); } else if (humidity2 != lastHum2) { lastHum2 = humidity2; gw.send(msgHum2.set(humidity2, 1)); Serial.print("H: "); Serial.println(humidity2); } float temperature3 = dht.getTemperature(); if (isnan(temperature3)) { Serial.println("Failed reading temperature from DHT3"); } else if (temperature3 != lastTemp3) { lastTemp3 = temperature3; if (!metric) { temperature3 = dht.toFahrenheit(temperature3); } gw.send(msgTemp3.set(temperature3, 1)); Serial.print("T: "); Serial.println(temperature3); } float humidity3 = dht.getHumidity(); if (isnan(humidity3)) { Serial.println("Failed reading humidity from DHT3"); } else if (humidity3 != lastHum3) { lastHum3 = humidity3; gw.send(msgHum3.set(humidity3, 1)); Serial.print("H: "); Serial.println(humidity3); } gw.sleep(SLEEP_TIME); //sleep a bit }```
-
Starting problems with new sensors
Hello,
I've just started with my sensors and am a bit of a noob.
I have made a ethernet gateway and it seems to work.
Configured it in domoticz.Furthermore I've made 3 temp hum sensors with (dht22 sensors on pro mini's).
Here comes the problem.
No matter what I do, I only see one sensor in Domoticz. It seems to work fine with a temp and hum value.-How will an extra sensor present itselve in domoticz? Will it show in devices tab as undefined sensor or under hardware and than settings as new node?
-Do I have to define the node_id myself? (I have now loaded the std sketch, but do not see a option for edditing node id, only child id.
-Can It be that te sensors now send their data to the gateway all as node 1. Thus readings are from more that one sensor (thus wrong)This is a reading from my sensor :
send: 1-1-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0 send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.4 send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0 read: 0-0-1 s=255,c=3,t=6,pt=0,l=1,sg=0:M sensor started, id=1, parent=0, distance=1 send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=8,sg=0,st=ok:Humidity send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0 send: 1-1-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=ok: send: 1-1-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok: send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:23.2 T: 23.20 send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:57.1 H: 57.10 send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:57.0 H: 57.00 send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:31.0 T: 31.00 send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:99.9 H: 99.90 send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:30.2 T: 30.20 send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:32.4 T: 32.40
Thank you for your help!
-
RE: Hardware advice for newbe
The longest cable will be 10meters.
The central audrino is exactly my idea. Why? Cheaper, easier to acces, not much space where i would like to place the sensor, no battery replacement needed and ethernet cable available. -
Hardware advice for newbe
Hello all,
I would like to make my first mysensor project. Since I am a complete newbe to this I hope you can help me get started. I have read a lot on the website, but would just like to get some things clear.
My idea;
I would like to measure the humidity and temperature of 5 rooms (maybe even more rooms) with sensor DHT22. A convenient place to measure for me would be the ventilation vent in the rooms. I can still easily access these en I can place the sensors out of sight.
I would like to connect the five sensors to one audrino board that is located at a convenient place. At this place Ethernet cable and power is available. The readings I would like to monitor in Domoticz, which I have running on a rasberry pi, in another room.
I prefer this set up and not an separate functioning sensor in every room since than I have to power everything by batteries (which have to be replaced) and take more room in the vent.My questions / uncertainties;
1 After reading the website I believe my idea is feasible (even for a noob), right?
2 What is the best board for my project (size does not matter)? Audrino uno ethernet? or Audrino uno R3 with shield? or?
3 Can the distance between sensor and audrino be several meters? (Maybe use ethernet cable for this)
4 Other advice?Thanks in advance for any answer!