Skip to content

Espurna doesn't seem to recover from error in sensor DHT #1918

Closed
@JavierAder

Description

Hi; my data

  • build on commit cf3bd49 (2019-09-10)
  • Sonoff Pow R2
  • DHT22 in GPIO 4; added using custom.h
  • Thingspeak enabled

Probably I have some problem in hardware, but I am not totally sure.
When I power my Sonoff, it reads the sensor correctly; some time later I get (via telnet) timeouts errors:

[306269] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[312277] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[318281] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[324532] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[330285] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[336293] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[342297] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[348305] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[354307] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)
[360564] [SENSOR] Error reading data from DHT22 @ GPIO4 (error: 3)

Then, if I reset Espurna via command "reset" in telnet, the error persists after the boot; but if power off and power on the sonoff, the problem disappears (at least for a time).

I suspect the following code in DHTSensor.h

// Send start signal to DHT sensor
        	if (++_errors > DHT_MAX_ERRORS) {
                     _errors = 0;
                    digitalWrite(_gpio, HIGH);
                    nice_delay(250);
               }


because digitalWrite is not preceded by "pinMode(_gpio, OUTPUT);". Is it possible that this is the reason why it does not seem to recover?

By the way; DHT_MIN_INTERVAL is set to 2000; it is not to low?

PD: I will try to force the error timeout disconnecting and connecting GPIO 4

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions