RPI reading random values from SPI 10-bit ADC MCP3008 problem

Ask QuestionAsked todayActive todayViewed 22 times1

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.  Is this normal?raspbianshareedit (1)  follow  close 4flag asked 15 hours agoYuanLin Ng1 New contributor

  • 1The 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 14 hours ago
  • Post a clear photo of your wiring. – CoderMike 13 hours ago
  • 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 11 hours ago   
  • / 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 11 hours ago   
  • / 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 10 hours ago    
  • / continued, … (2) penzu.com/p/e800ce64 (3) chat.stackexchange.com/rooms/102745/… (4) raspberrypi.stackexchange.com/questions/98867/…. Happy learning. Cheers. – tlfong01 10 hours ago   

add a comment

1 Answer


To answer your question.

No, it is not normal.shareedit  follow  flag

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.