How to interface humidity sensor with PIC18F45K80

Status
Not open for further replies.

Djsarkar

Member
Hi
I have humidity module. I want to interface with



T microcontroller works on the digital signal. If the sensor gives an analog signal, the microcontroller will not be able to read it.

Do I need an external ADC?
Should I use inbuilt ADC in pic micro?
 
The has a built in ADC, and that would be the easiest to use.

Almost all ADCs work best with a signal that changes over most of the range of the supply voltage. The will probably be running from 5 V, so the ADC will work best if the signal from the sensor covers a good proportion of the 0 - 5 V range.

You don't say what the range of the humidity sensor analog signal is, but if it's not a voltage in the range 0 - 5 V, and it if doesn't change by more than about 1 V in the humidity range you are interested in, then some sort of signal conditioning would be needed or would help.
 
With an analog sensor, you would normally use an ADC within the PIC.

However, the module you show has a serial data output, not analog.
Data sheet here; the three and four pin versions work pretty much the same:

You need to use an I/O pin configured for "open collector" (or switch it between out and in using the TRIS bit), plus a pullup resistor from the data line to 5V.

Edit - here is an example for using one with a PIC18F:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…