Home › Forums › English support forum › Relay Box
- This topic has 20 replies, 2 voices, and was last updated 6 years, 10 months ago by
admin.
-
AuthorPosts
-
26/03/2018 at 14:43 #681
David De Laet
ParticipantHi,
For whom is interested, I created a Box to place esp32 module & a relay module into a box for 3d printing.
https://www.thingiverse.com/thing:2840379
Currently working on a sensor box design.26/03/2018 at 15:08 #683admin
KeymasterHi mstrdigi!!!
I’m impressed and very grateful for the design! I’m sure that other users will find it useful too. Thank you very much again.
Your opinions and suggestions are very appreciated tu. If you find bugs or you have suggestions, don’t hesitate and tell me.
Regards!
26/03/2018 at 15:10 #684admin
KeymasterHi again,
may you post some pictures how a real box looks like (with the esp32 and the relay)? I’m very curious about that.
Regards!
26/03/2018 at 17:25 #686David De Laet
ParticipantHi,
As requested, a pictures from inside the box. Don’t mind the extra cables, Converted a Default High to a Default low relay.
Red: VCC 5v -> esp32
White: Ground -> esp32
Yellow: Pin18 ->esp32
Purple: short COM+GNDAttachments:
03/04/2018 at 12:09 #704David De Laet
ParticipantThe first version of the sensor box is ready.
All the pins are soldered, and is assembled with snap-ins.and a wall mount bracket will be available soon.
03/04/2018 at 12:12 #709David De Laet
ParticipantThe stl files will be available soon on thingiverse.
If someone want a printed version, I could send one for the price of filament, electricity & shipping costs.Attachments:
03/04/2018 at 12:29 #711David De Laet
ParticipantAdded some extra details of the drawing.
03/04/2018 at 12:33 #715admin
KeymasterLooks very good! Thank you for the pictures. And thank you for the offer of printing the box. Maybe someone is interested.
I have one question. Do you use the DHT22 or the DHT11? Because I was using the DHT11, and after “upgrading” to the DHT22, it does not work. I receive always a timeout error when accessing the dht22 sensor.
03/04/2018 at 16:26 #716David De Laet
ParticipantHi,
I am using the DHT22 board from keyes. I do have some timeout errors, 1 out of 5 polls.
I’m looking at the sketch, with the Serial Console..
My first impression is that we are polling to fast, the DHT22 can only be polled every 2 sec. (2.5 to be safe) I would even poll only every minute.
I have added time stamps into the code for debugging, and will try some other dht libraries this evening.Mvg,
03/04/2018 at 17:22 #717admin
KeymasterHi,
I’m not sure if the pollin frequence is the problem. The thermostat should poll the esp32 each 10 seconds more or less. If the thermostat is polling faster, then something is wrong with the app.
In the future I can add a settings to configure the polling frequence.
I don’t have very much time in the next few days, but I will have a look at the sketch and the app asap.
Thank you for your efforts.
03/04/2018 at 17:49 #718David De Laet
ParticipantHi,
Indeed, after adding a time stamp to the sketch, I see a poll every 10 sec. 🙂
I assumed a polling issue, as many people on esp32 forums had this problem. My bad..Below the time stamp logs. I will try with another DHT lib en post the results.
New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, client disconnected
Tue Apr 3 18:35:55 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, client disconnected
Tue Apr 3 18:36:05 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, client disconnected
Tue Apr 3 18:36:15 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, client disconnected
Tue Apr 3 18:36:25 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0Timeout errorclient disconnected
Tue Apr 3 18:36:35 201803/04/2018 at 18:42 #719David De Laet
ParticipantHi,
I changed your code to use the SimpleDHT library, and added the temp readings to serial output.
Including catching the DHT errors, and had no timeouts anymore.Ps: found a small bug in the app. If you leave the calibration value empty instead of an value, the app will crash.
Connecting to *********
….
WiFi connected
IP address: 192.168.60.50
MAC: ***********
New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.90 client disconnected
Tue Apr 3 17:31:26 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.40 client disconnected
Tue Apr 3 17:31:36 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.50 C° Humidity= 53.20 client disconnected
Tue Apr 3 17:31:46 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
Tue Apr 3 17:31:56 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
Tue Apr 3 17:32:06 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
Tue Apr 3 17:32:16 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.10 client disconnected
Tue Apr 3 17:32:26 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
Tue Apr 3 17:32:36 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
Tue Apr 3 17:32:46 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
Tue Apr 3 17:32:56 2018New client
GET / HTTP/1.1
Host: 192.168.60.50
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.9.0DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
Tue Apr 3 17:33:06 201804/04/2018 at 07:14 #720admin
KeymasterHi!
Thank you for the bug report. I will fix it soon.
When you talk about the simple DHT library are you talking from this library?
https://github.com/winlinvip/SimpleDHT
Thanks!
04/04/2018 at 13:08 #724David De Laet
ParticipantHi,
Indeed this the lib I used.
This is code I changed, still quick & dirty, as I wanted to wait your response before I would clean the code up and add some more error catching. As this code is your work, I wanted you to have the final word 🙂 although I’m happy to help..
int chk = SimpleDHTErrSuccess;
double celsiusTemp = -10000;
double fahrenheitTemp = -10000;
float temperature = 0;
float humidity = 0;
if (DHTTYPE == 22) {
chk = dht22.read2(DHTPin,&temperature, &humidity, NULL );} else {
chk = dht11.read2(DHTPin,&temperature, &humidity, NULL );
}if (chk == SimpleDHTErrSuccess) {
thError=””;
Serial.print(“DHT OK,\t”); Serial.print(“TempCelcius= “);
Serial.print((float)temperature); Serial.print(” C°\t”);
Serial.print(“Humidity= “);
Serial.print((float)humidity); Serial.print(“\t”);
celsiusTemp = (float)temperature;
fahrenheitTemp = celsius2Fahrenheit(celsiusTemp);} else {
switch (chk)
{
case SimpleDHTErrDataChecksum:
thError = “Checksum error”;
break;default:
thError = “Unknown error”;
break;
}
Serial.print(thError);
}04/04/2018 at 13:18 #725admin
KeymasterHi Mvg,
if you think that this library works better than the DHTStable library from RobTillart I believe you. I will do some tests, but I don’t know when, because in the next days I will not have very much free time. Maybe in the weekend.
Your source code looks good. I am myself not very proud of the code that I wrote for the sketchs (I find the arduino ide irritating, it is not easy to refactor, and I have a lot more excuses 🙂 ) and I know that the code is not very clean and good as it should be.
Of course you can add the error handling and I can publish your version of the sketch, if you give me permission.
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.