Post your best Lua script examples here

User avatar
By f4n
#11452 hi everybody,
i have similar problems with my ESP8266 and a DHT22 and do not get any valid values.
i tried it with a cap between GND and VCC to stableize the power and i tests to use a 4k7 pull up on the data pin, nothing worked.

i'm guess the wireing should work because i got valid results with an alternative firmware (http://harizanov.com/2014/11/esp8266-po ... r-reading/)
but i want to use the lua firmware to be a little bit more flexible.

here is the result from the test script:
Code: Select allchecksum    103
checksumTest    103
humidity - timing of bits      0 1 1 1 1 1 5 1 5 1 5 1 1 5 5 1
temperat - timing of bits      1 1 1 1 1 1 1 5 5 2 5 5 5 5 5 1
checksum - timing of bits      1 5 5 1 1 5 5 10
Humidity:    2.6484375%
Temperature: 1.7421875 deg C
User avatar
By jankop
#11473 I don't know if the measured values are correct, but the sensor is read well.
You only have incorrectly set the type of sensor in the test program.
Code: Select allchecksum    103
humidity - timing of bits      0 1 1 1 1 1 5 1 5 1 5 1 1 5 5 1 = 0000 0010  1010 0110  = 678
temperat - timing of bits      1 1 1 1 1 1 1 5 5 2 5 5 5 5 5 1 = 0000 0001  1011 1110  = 446
checksum - timing of bits      1 5 5 1 1 5 5 10 = 0110 0111  = 103
2,6484375*256=678  678/10=67,8%
1,7421875*256=446  446/10=44,6 C