3

I have an MCP3008 ic. I am pretty new to the Raspberry Pi world, as anyone ever used the MCP3008 to simply measure voltage? I just am really not sure how I would go about doing it.

Any advice would be amazing!

  • learn.adafruit.com/… this can suits the project regarding the views i seen – user49380 Jul 21 '16 at 6:26
6

There is a full guide available with someone making a voltmeter setup here - this also includes scripts. You also can connect it by following the setup detailed here - basically you set up a circuit as so:

enter image description here
For testing you can use a potentiometer as shown, you can also use something like a Light Dependent Resistor (LDR) etc

Install needed packages (may not be needed for some Pi images)

sudo apt-get update
sudo apt-get install python-dev python-setuptools
sudo easy_install rpi.gpio

As for the script, theirs is for a volume control - all you should need to do is connect to the SPI interface and read values. Note with the values:

The MCP3008 is a 10-bit ADC. That means it will read a value from 0 to 1023 (210 = 1024 values) where 0 is the same as "ground" and "1023" is the same as "3.3 volts". We don't convert the number to voltage, although it's easy to do that by multiplying the number by (3.3 / 1023).

This setup is very limited, as without modified/extra circuitry it can't really do voltages outside of 0V to +3.3V, and too high a current could easily fry the chip and or Pi, so you need to be careful what you connect - however it should be suitable for many analog sensors.

  • The linked project is certainly a good example to start with. – Ghanima Nov 21 '15 at 18:26
  • 1
    You mean too high (or low) a voltage? – immibis Nov 21 '15 at 21:33

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.