2

I have used the Adafruit's simpletest.py to test out the MCP3008. The supposed result shows '0' for channel 2-7 and '0' for channel 0-1 if touch sensor is untouched.

However for mine, the returned result shows random numbers for all channels if touch sensor is untouched. If touched, it will return 1023 for channel 0 and random numbers for all other channels.

enter image description here

Is this normal?


EDIT: I have managed to successfully resolved this issue. what i did was ground all the inputs that are not used. thanks all for your help and contribution :)

6
  • 1
    The MCP3008 is, by itself, just an ADC and knows nothing of touch sensors etc. What have you attached to it and how? Random values are very likely to occur for open inputs (inputs not connected to anything)
    – PMF
    Commented Oct 16, 2020 at 9:42
  • 1
    Post a clear photo of your wiring.
    – CoderMike
    Commented Oct 16, 2020 at 11:12
  • If you use Adafruit_Python_MCP3008 simpletest.py - Tony DiCola github.com/adafruit/Adafruit_Python_MCP3008/blob/master/…, you import the following two modules: (1) import Adafruit_GPIO.SPI as SPI (2) import Adafruit_MCP3008. The problem is that these two modules might not be very compatible to Rpi3/4 stretch/buster. Some hackers have written similar modules for Rpi3/4, but there is no guarantee that they are updated to buster. / to continue, ...
    – tlfong01
    Commented Oct 16, 2020 at 13:24
  • / continue, ... Reading MCP3008 (8 channel) /MCP3201 (i channel) involves (1) writing a couple of bytes to MCP3008/MCP3201 and read back the raw results, (2) decode the raw results from binary to decimal. MCP3201 is very similar to MCP3008, except MCP3201 is 12bits, 1 channel, but MCP3208 is 10 bit 8 channels. MCP3201 is actually easier to program, because there is no need to select which channel. I have written a simple demo program for MCP3201. IF you understand MCP3201, then you can program MCP3008 with very little extra effort. / continue, ...
    – tlfong01
    Commented Oct 16, 2020 at 13:30
  • / continue, ... But you need to know some basic idea of SPI read/write two/three bytes (but no need to mess around with any device registers, becuase MCP3008/3201 are so simple that they don't have any register to read or write! :)). You might need to spend a couple of hours to thoroughly study and understand what is going on. Here are some random tutorial notes, and a fully debugged demo program to read MCP3201 (Sorry, no demo for MCP3008): (1) raspberrypi.stackexchange.com/questions/99550/… / to continue, ...
    – tlfong01
    Commented Oct 16, 2020 at 13:35

1 Answer 1

-1

To answer your question.

No, it is not normal.

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