This is an old revision of the document!


YL-40 A/D D/A Converter Module

adda.jpg

Measuring the output of a TMP36 and LM35

adda-sch.jpg

The YL-40 is a cheap analogue I/O device based on the PCF8591 I2C interface chip. There is at least one variant of this board not named YL-40 on but instead says QiFEi on the reverse.

These devices combine the silicon chip with a potentiometer, light dependant resistor, thermistor and two LEDs.

I have three YL-40 devices and one QiFEi. On two of the YL-40s the earth connection to the thermistor is missing on the PCB, with this fault the NTC (channel 1) will always return a value of 255.

Pinout

    SCL SDA GND VCC

  O/P PWR
  LED LED LDR NTC P4
              POT P5
                  P6
                    
AOUT AIN0 AIN1 AIN2 AIN3

P4=NTC ENABLE
P5=LDR ENABLE
P6=POT ENABLE

The LDR and NTC part numbers are unknown but the following characteristics were found.

Board LDR @ 10lx NTC @ 25'C Earth fault Jumpers
1 10K 4K7 / 3977 No RED
2 5K 6K8 / 3977 Yes BLACK
3 10K 10K / 3977 Yes NONE

As we can see, the components vary, plus there is a massive variation in response for the LDRs so they must be considered unique.

The LDRs are likely to be the GL/PGM 5516 (5K) and 5528 (10K).

PCF8591

Control Register Function Device
0 channel 0 Read ADC 0 LDR
1 channel 1 Read ADC 1 NTC THERMISTOR
2 channel 2 Read ADC 2 NC
3 channel 3 Read ADC 3 POTENTIOMETER
+64 analog OE DAC output O/P LED

The O/P LED will begin to turn on with the output set to 140 or more with VCC at 3v3.

RPi

Set up I2C as per the Slice of Pi/O.

Set O/P to VCC and turn on LED.

i2cset -y 1 0x48 64 255

Read POT.

i2cset -y 1 0x48 3 ; i2cget -y 1 0x48 ; i2cget -y 1 0x48

The first i2cget will read and discard any previous sample. This will be from the any previously read input channel and perhaps not the one required.

Resources

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies