1

I'm new to the raspberry pi and after getting a simple temperature sensor to work bought a YL-69 (comes with YL-38 too) but can't get any analogue data from it.

http://www.tiagoespinha.net/wp-content/uploads/2014/05/2014-05-09-12.51.20.jpg are the two sensors I have currently.

My current setup is:

YL-69 and YL-38 connected via the 2 pin side.

YL-69:VCC goes to the Rasp 3.3v power pin 1.

YL-69:GND goes to the ground pin on Rasp.

YL-69:AO goes to one of my GPIO pins(3).

I'm using the pigpio python library but pi.read(gpio) just gives me a reading of 1.

What do I need to do to get this to work, any ideas?

1 Answer 1

2

The Pi does not have any analog inputs, you will neeed to add an ADC and connect your sensors to the ADC. Adafruit has a nice tutorial using the MCP3008. Tutsplus has a tutorial using the MCP3008 with a moisture sensor.

6
  • Can any ADC be used? I've just noticed I have a ADC0832 in a kit I bought. I'm happy to dig a little deeper on how to get it to work, but you might be able to save me a bit of time if it's not compatible. Thanks!
    – john
    Sep 13, 2015 at 11:16
  • I have not tried so can't say unequivocally it but a quick google search appears to indicate that it will work. google.com/… Sep 13, 2015 at 11:20
  • 1
    The first link heinrichhartmann.com/2014/12/14/… looks promising.
    – joan
    Sep 13, 2015 at 11:34
  • That tutorial seems to use up 4 GPIO pins, is that normal just to get an Analog output?!
    – john
    Sep 13, 2015 at 22:37
  • 1
    @john If I remember correctly the ADC0832 is a spi chip so it is going to require a clock, mosi, miso and a slave select so this is normal. For reference you may want to read this article en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus Sep 13, 2015 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.