==== YL-40 A/D D/A Converter Module ==== {{:interfaces:adda.jpg?200}} \\ \\ {{:interfaces:adda-pi-3.jpg?200}} \\ \\ {{:interfaces:adda-sch.jpg?200}} 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 named 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 | |YL-40 #1| 10K | 4K7 / 3977 | No | RED | |YL-40 #2| 5K | 6K8 / 3977 | Yes | BLACK | |YL-40 #3| 10K | 10K / 3977 | Yes | NONE | |QiFEi | 10K | 4K7 | No | BLACK | As we can see, the components vary, plus there is a massive variation in response for the LDRs and they may 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 [[interfaces:slicepi#rpi_i2c|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 === [[http://www.vishay.com/docs/29049/ntcle100.pdf|Vishay NTC datasheet]] \\ [[http://en.nysenba.com/upfiles/file/LDR.pdf|GL series guide]] \\ [[http://akizukidenshi.com/download/ds/senba/GL55%20Series%20Photoresistor.pdf|GL55 series datasheet]] \\ [[http://www.token.com.tw/pdf/resistor/cds-resistor-pgm.pdf|PGM series datasheet]] \\