Relay Box

Home Forums English support forum Relay Box

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #681
    David De LaetDavid De Laet
    Participant

    Hi,

    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.

    #683
    adminadmin
    Keymaster

    Hi 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!

    #684
    adminadmin
    Keymaster

    Hi 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!

    #686
    David De LaetDavid De Laet
    Participant

    Hi,

    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+GND

    #704
    David De LaetDavid De Laet
    Participant

    The 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.

    #709
    David De LaetDavid De Laet
    Participant

    The 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:
    #711
    David De LaetDavid De Laet
    Participant

    Added some extra details of the drawing.

    #715
    adminadmin
    Keymaster

    Looks 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.

    #716
    David De LaetDavid De Laet
    Participant

    Hi,

    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,

    #717
    adminadmin
    Keymaster

    Hi,

    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.

    #718
    David De LaetDavid De Laet
    Participant

    Hi,

    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.0

    DHT OK, client disconnected
    Tue Apr 3 18:35:55 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, client disconnected
    Tue Apr 3 18:36:05 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, client disconnected
    Tue Apr 3 18:36:15 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, client disconnected
    Tue Apr 3 18:36:25 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    Timeout errorclient disconnected
    Tue Apr 3 18:36:35 2018

    #719
    David De LaetDavid De Laet
    Participant

    Hi,

    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.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.90 client disconnected
    Tue Apr 3 17:31:26 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.40 client disconnected
    Tue Apr 3 17:31:36 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.50 C° Humidity= 53.20 client disconnected
    Tue Apr 3 17:31:46 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
    Tue Apr 3 17:31:56 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
    Tue Apr 3 17:32:06 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.20 client disconnected
    Tue Apr 3 17:32:16 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.10 client disconnected
    Tue Apr 3 17:32:26 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
    Tue Apr 3 17:32:36 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
    Tue Apr 3 17:32:46 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
    Tue Apr 3 17:32:56 2018

    New client
    GET / HTTP/1.1
    Host: 192.168.60.50
    Connection: Keep-Alive
    Accept-Encoding: gzip
    User-Agent: okhttp/3.9.0

    DHT OK, TempCelcius= 24.60 C° Humidity= 53.00 client disconnected
    Tue Apr 3 17:33:06 2018

    #720
    adminadmin
    Keymaster

    Hi!

    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!

    #724
    David De LaetDavid De Laet
    Participant

    Hi,

    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);
    }

    #725
    adminadmin
    Keymaster

    Hi 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!

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.