Here's the project I am working on: I would like to read in the voltage change on a sensor that I have. It has a positive and negative wire coming from it. I then have the raspberry pi 2. The positive end of the sensor has 5v coming out of it. I am using a MCP3008 ADC chip to get the analog signal to digital.

I hook it all up and turn it on, and the sensor does not turn on. The only thing I don't know where to place, is the negative end of the sensor.

Any and all help is appreciated.

  • What sensor are you using? What do you mean "turn on", generally the negative end of a sensor goes to ground – Steve Robillard Dec 14 '15 at 18:30
  • If you don't want to end up with a broken Pi it will be safer if you post the connections you plan to make to the ADC and to the Pi. – joan Dec 17 '15 at 23:04

The MCP3008 measures the voltage input to it relative to its reference voltage. If you're attaching one end to the +3.3V line and the other to the chip input, what happens next depends on the pull up/down in the MCP 3008, as its resistance relative to the sensor's resistance is what will determine the voltage at that point and, therefore, what the MCP3008 returns (if the chip even has pull-ups, which might not be true).

A few other things to check: 1. Correct channel. The MCP 3008 numbers channels starting with 0, not 1 (also check which end the channel numbering starts on).

  1. This tutorial: https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview as it goes over how to hook up the MCP.

  2. If you want to hook up a variable resistor (like a photoresistor), look at this tutorial: http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/

Without more specifics on your sensor I can't give more help than this.

| improve this answer | |
  • Thank you, this was very helpful. One last question, is there a way I can input a 5v signal into channel 0 in the MCP chip? – AbsoluteZ3r0 Dec 16 '15 at 20:56
  • I think so. My current use for the MCP 3008 is to read potentiometers (basically the same as the tutorial), which can output anything from 0V to the voltage of the line you run them on. Note, however, that the MCP can only read as high as the Vref you input. If your Vref is the 3V3 line, then no. If you are using the 5V line, yes. But if you have an option, I would suggest running both the sensor and the MCP off of the 3V3 line, as that is regulated and so has less voltage fluctuations, which can result in inaccurate readings. – dpdt Dec 16 '15 at 22:38

Your Answer

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

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