Reading a DHT22 Temperature Sensor with an SIFB [message #1840040] |
Tue, 06 April 2021 05:39 |
Barry Dowdeswell Messages: 49 Registered: November 2018 |
Member |
|
|
I am currently building a custom SIFB which can read the temperature from a DHT22 temperature sensor. This is a serial I/O three-wire device. However, since the DHT22 uses a serial interface, it only uses one GPIO pin. I am not sure how to make the QX and IX share the same GPIO pin - that looks tricky. The protocol requires the GPIO pin to be an output first to wake up the device with a pulse, and then switch to being an input to sample the data stream.
I have the C++ code running fine on an Arduino and I have written the C++ code on a Raspberry Pi in a small program using wiringPi, but I want to learn how to do this in sysfs rather than wiringPi if possible.
I have studied the QX and IX function blocks thoroughly. They are running in a test application fine. with a LED and a switch. What I need to build is a new block that combines the capabilities of the QX and IX in a single block.
What I am finding hard to see in the QX and IX C++ source is where the PARAMS value that specifies which GPIO pin is used by specifying the BCM number.
Any help would be appreciated. Note that the DHT22 does not follow the SPI protocol properly otherwise I could perhaps use one of the SPI function blocks.
Thanks,
Barry
[Updated on: Tue, 06 April 2021 05:43] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03536 seconds