Frustration with the MCP3008 ADC

I don’t often vent my spleen on my blog. This time, however, my frustration has boiled over. I’ve been trying to get an analog to digital converter working with my Pi. Now, I should say going into this I’m not feeling my best at the moment, and my patience is more than a little thin.

Over the past few weeks, I’ve had problems with my 7″ LCD screen, with my 16×2 LCD module, my ultrasonic distance sensor… and now it’s the turn of the ADC.

I was trying to do this tutorial:

Overview | Analog Inputs for Raspberry Pi Using the MCP3008 | Adafruit Learning System.

and failed miserably. Analog levels are just not being reported. I get the occasional fluctuation, but it doesn’t seem to be reading the analog-ness of the potentiometer. It’ll go to 100%, then to zero again. No idea what I’m doing wrong.

Still, I persevered and decided to try Jeremy Blythe’s tutorial that is the same as the Adafruit one by instead using the SPI protocol. I figured I’m using the Occidentalis distro, SPI is enabled, and I’m having no luck with the original. Here’s a link to the tutorial:

http://jeremyblythe.blogspot.co.uk/2012/09/raspberry-pi-hardware-spi-analog-inputs.html

Guess what? I failed again. I’m getting 100% volume all the time. I don’t doubt that both tutorials are accurate and correct, just that my lack of knowledge is probably causing my failure.

Perhaps it’s because I’m using a mini potentiometer rather than one of the blue ones, but surely if I press down on the thing it should do the same? It’s so frustrating.

I’m not a stupid person – but I do feel that I’ve reached the end of my expertise with this simple tutorial. I’m all at sea with electronics, it seems, and I haven’t a clue how to get enough knowledge to make myself proficient enough to do what I want to do.

Rant over!

12 comments for “Frustration with the MCP3008 ADC

  1. Tim
    1 December 2012 at 6:39 pm

    What 7″ screen are you using? I’m looking for one.

    • 2 December 2012 at 4:44 pm

      It’s one similar to this:
      eBay 7″ screen
      You can get them cheaper elsewhere, or from Hong Kong/China. They’re basically car rear-view monitors for those reversing cameras you can get.
      Best ones come with a power adapter to use – they’re normally powered from the car’s 12V, so it’s a 12V power supply you need.

  2. Tim
    1 December 2012 at 6:41 pm

    And when you get the ADC working, let me know what to do right!

    • 2 December 2012 at 4:45 pm

      I think the first step for me is to go much simpler than I’ve been doing. I’ve been trying to just add sensors to a breadboard, but I’m thinking now I should get things working in isolation first, and then combine them.

  3. 3 December 2012 at 8:35 am

    Have you got a multimeter handy? It’s worthwhile checking the voltage across your input pin whilst varying the position of your potentiometer.

    If the pot isn’t connected(floating) you’ll tend to find that the input reading on your mcp3008 varies wildly, so it’s usually quite obvious.

    • 3 December 2012 at 9:11 am

      Good call. Thanks for the idea 🙂

  4. Siddharth Sharma
    7 January 2013 at 2:20 pm

    Did it work?? I am also having trouble making it work.

    • 7 January 2013 at 2:56 pm

      Eventually, but I wouldn’t like to try and reproduce it!

      • Nouman
        25 October 2013 at 8:26 am

        How did it work, any tips would be highly regarded.

        Thanks

        • 25 October 2013 at 8:32 am

          Rather than try to go through it… Take a look at http://178.62.14.192/?p=6552 and follow the link to Matt’s blog post in which he uses the MCP3008 successfully.

  5. David Fieni
    16 July 2013 at 3:56 pm

    It sounds like you had the same problem as me. Please let me know what you did. I probed the input into my MCP3008 and it is changing as expected but I just get 100% all the time.

  6. joey
    7 August 2014 at 3:01 am

    i had the same problem as you. My values kept changing till I started fiddling with the wires. I switch breadboards and ran leds through connections to make sure current was going through. When I checked my knob , I had the connections wrong. Also using 3.3v worked, not 5v.

Leave a Reply

Your email address will not be published. Required fields are marked *

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