I am trying to create a voltage sensor using a Raspberry Pi 3 with Raspbian (February 2017 release because that is the one I need for the rest of my project) by connecting the SPI pins to an MCP3008 ADC, but when I try to run this code (http://osoyoo.com/driver/voltage.py), I always get an output of 0.00 V. I followed the tutorial where this code came from:


I have tried using different Pis (a Pi Zero W instead of a 3), different versions of Raspbian, different pins and even different MCP3008 chips but to no avail. I am starting to believe that the SD card or something might be bad because I cannot understand where I am going wrong. I have also tried various other Pi-to-MCP3008 to get something that works, but that hasn't panned out well either. I am really trying to use the software configuration (discussed here: https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008)

If anyone could please let me know if there is an issue in the code or circuit design, or if there is some other method I could follow to attain these results, I would be incredibly thankful.

closed as unclear what you're asking by Milliways, techraf, joan, Steve Robillard, Darth Vader Dec 18 '17 at 14:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you use the search function... RPi Exchange: Voltmeter-mcp3008 – RubberStamp Dec 5 '17 at 2:04
  • This is unanswerable (in a useful way) without clear photos of your wiring. – joan Dec 5 '17 at 7:54
  • Did you activate the SPI communication by uncomment the line #dtparam=spi=on in /boot/config.txt to dtparam=spi=on? Also need to reboot after the change. – hcheung Dec 5 '17 at 13:14
  • Thank you for the responses. Below is the picture of my circuit. Not shown in the picture is that I have been plugging a wire from the 3.3V line into input CH0 on the MCP3008 as a means of testing. imgur.com/UxdGyGW – Mike Dec 5 '17 at 19:54