Dear all,
I want to measure humidity by using an humidity sensor RHT03.
It's a digital sensor, and output 40 bits signal response.
but the way it outputs is little bit strange.
MCU send out start signal to RHT03 and RHT03 send response signal to MCU
RHT03 send data to MCU When RHT03 is sending data to MCU, every bit's transmission begin with low-voltage-level that last 50us, the following high-voltage-level signal's length decide the bit is "1" or "0".
I don't know how to interface my cortex M3 (st32f107) with this sensor? What interface should I use?
I wanted to use GPIO. But the sensor interface with the MCU by only one bus (for both ways of transmission: for receiving and sending data).
the datasheet can be found here www.google.com.vn/url
Yes, SPI has clock and data. But the clock signal is only relevant if the other side also runs a synchronous transfer. So you do not use this signal.
But you can use the MISO and MOSI lines together to send and receive onewire data. Just remember that you need to add a bit of glue to make the transmit pin (MOSI) "open-collector" so it can drive the line when it wants to, but leaves the signal idle when the sensor is driving the wire. The MISO will just listen - analyze what it has and decide if you have seen a zero or a one.
Just a footnote - some people instead use a UART for onewire communication.
On the STM32 using the TIM in Input Capture or PWM Input mode might be the easiest to manage the response stream.
Bit-Banging ?
Thank you all for your support. I will try. Best regards