i ran the simpletest.py program for testing the mcp3008 and it is returning random values with 0 value at intervals to the pins left open and also to the pin getting input from MQ-9 sensor...

can anybody point out ....whats wrong in this...?

Here is the circuit diagram i am using

Here is the snap of the code output


here is the link of the code by adafruit to test mcp3008

but i get 0 and 1023 correctly when i connect the pins to ground and 3.3v respectively


1 Answer 1


Connect each of the pins you aren't using to the Agnd pin. That will ensure unused inputs don't get stray signals.

  • but i am getting gibberish input in pin 0 too......there sensor is connected.....still..... Dec 30, 2018 at 14:19
  • Then your sensor is either wired wrong or broken. You need to read the datasheet. Is Vcc on the sensor connected to Vref is Vdd connected to Agnd? Is it running at the right voltage?
    – Dougie
    Dec 30, 2018 at 14:23
  • the circuit is connected exactly as in the circuit diagram Dec 30, 2018 at 14:27

Your Answer

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

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