0

I am working withe the turbidity sensor SEN0189 and I am using mcp3008 A to D converter but I am not able to get the values for it, as I am not able to download the adafruit mcp3008 libraries in my pi. As I'm not getting any output I have tried some other code so that it's showing the output but it shows 0 all the time and also please help me out about the wiring of the tubidity sensor. The code for which i am getting 0 is

 import mcp3008
 import time
     while true: 
 adc=mcp3008.MCP3008() 
 print(adc.read([mcp3008.CH0])) 
 adc.close() 
 time.sleep(1)

If you know some other code that works for it please let me know.

  • 3
    Add a photo of your wiring. – CoderMike Feb 24 at 9:42
  • You say " I am not able to download the adafruit mcp3008 libraries" then how are you able to get that code above to run at all? Here are the instructions for the mcp3008 and they include getting the libraries with pip3: learn.adafruit.com/… Also your code above isn't indented properly, but if you get any results, I'm assuming your version is corrected. – T. M. Feb 25 at 0:40
  • gpiozero.readthedocs.io/en/stable/api_spi.html that's a nice simple way to read MCP3008s. – Dougie Feb 26 at 11:33
  • I got the output by using the code in this link:"raspberrypi-spy.co.uk/2013/10/…" but make sure you make the correction spi.max_speed_hz=1350000 if you didnt get the output – Habeeba Feb 26 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.