Using just the PCF8591 chip or adding alternative sensors

A circuit diagram of the PCF8591 module without the sensors attached is shown in the following diagram:

Circuit diagram of the PCF8591 module without sensor attachment

As you can see, excluding the sensors, there are only five additional components. We have a power-filtering capacitor (C1) and a power-indicating LED (D2) with a current-limiting resistor (R5), all of which are optional.

Note that the module includes two 10K pull-up resistors (R8 and R9) for SCL and SDA signals. However, since the GPIO I2C connections on the Raspberry Pi also include pull-up resistors, these are not needed on the module (and could be removed). It also means we should only connect this module to VCC = 3.3 V (if we use 5 V, then voltages on SCL and SDA will be around 3.56 V, which is too high for the Raspberry Pi GPIO pins).

The sensors on the PCF891 module are all resistive, so the voltage level that is present on the analog input will change between GND and VCC as the resistance of the sensor changes:

A potential divider circuit. This provides voltage proportional to the sensor's resistance.

The module uses a circuit known as a potential divider. The resistor at the top balances the resistance provided by the sensor at the bottom to provide a voltage that is somewhere between VCC and GND.

The output voltage (Vout) of the potential divider can be calculated as follows:

Rt and Rb are the resistance values at the top and bottom, respectively, and VCC is the supply voltage.

The potentiometer in the module has the 10K ohm resistance split between the top and bottom, depending on the position of the adjuster. So, halfway, we have 5K ohm on each side and an output voltage of 1.65 V; a quarter of the way (clockwise), we have 2.5K ohm and 7.5K ohm, producing 0.825 V.

I haven't shown the AOUT circuit, which is a resistor and LED. However, as you will find, an LED isn't suited to indicate an analog output (except to show the on/off states).

For more sensitive circuits, you can use more complex circuits, such as a Wheatstone bridge (which allows the detection of very small changes in resistance), or you can use dedicated sensors that output an analog voltage based on their readings (such as a TMP36 temperature sensor). The PCF891 also supports the differential input mode, where the input of one channel can be compared to the input of another (the resultant reading will be the difference between the two).

For more information on the PCF8591 chip, refer to the datasheet at http://www.nxp.com/documents/data_sheet/PCF8591.pdf.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.219.166