Firmware module for DHT11 sensor


#1

I made a firmware module for the DHT11 sensor, which measures air (relative) humidity and temperature. It’s the same as the DHT22 firmware, except for some lines when transforming sensor data to temperature and humidity.

The DHT11 is a cheaper version of the DHT22, same shape and pinout. It is slower, and the ranges are smaller, but I think it is still useful. A short comparison here in Adafruit; and here a more detailed insight by Robert Smith. I copy a part of the former here, for convenience:

DHT11

    Ultra low cost
    3 to 5V power and I/O
    2.5mA max current use during conversion (while requesting data)
    Good for 20-80% humidity readings with 5% accuracy
    Good for 0-50°C temperature readings ±2°C accuracy
    No more than 1 Hz sampling rate (once every second)
    Body size 15.5mm x 12mm x 5.5mm
    4 pins with 0.1" spacing

DHT22

    Low cost
    3 to 5V power and I/O
    2.5mA max current use during conversion (while requesting data)
    Good for 0-100% humidity readings with 2-5% accuracy
    Good for -40 to 125°C temperature readings ±0.5°C accuracy
    No more than 0.5 Hz sampling rate (once every 2 seconds)
    Body size 15.1mm x 25mm x 7.7mm
    4 pins with 0.1" spacing

Code in Github . I don’t know if there is something like a fork request :sweat_smile: . It is tested alone and also with the rest of the modules.


How to set up and test a fixture?
#2

Could you please post the firmware_module json for this? Git has the code, but no this portion that is needed for getting it to compile and load to the Arduino.

Thanks,


#3

Hello Howard, sorry for the delay. Probably you already solved it but anyway…
Firmware module is a dependency for every firmware module: https://github.com/OpenAgInitiative/openag_firmware_module

You can declare dependencies on your module.json file, and also have to declare them in your fixture file ( one example fixture is here: https://github.com/OpenAgInitiative/openag_brain/blob/master/fixtures/default.json )

I tested it running

openag firmware run_module -p csv -t upload [argument: pin number]

inside the folder containing the source.

Then, for watching the output:

platformio serialports monitor

I suppose this still works for the current version of the brain.


#4

Thanks. I did get it working.
It was not clear that the module.json was the same code that went into the firmware_module_type.
All of this may be mute now, with the latest changes to v2.0 (though I think the change is a bad idea).