• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to interface humidity sensor with PIC18F45K80

Djsarkar

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

IMG_20201022_124312.jpg

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?
 

Diver300

Well-Known Member
Most Helpful Member
The PIC18F45K80 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 PIC18F45K80 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.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
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:
 

Latest threads

EE World Online Articles

Loading
Top