-1
\$\begingroup\$

I am using a MCP3008 ADC connected to the Raspberry Pi SPI pins.

  • MOSI → MOSI,
  • MISO → MISO,
  • CE0 → ~(CS),
  • CLK → SPI_SCLK

Input voltage to MCP3008 is 3.3V from the RPi. Vref also 3.3. GNDs all connected to ground rail on breadboard. Analog inputs 1-7 are wired directly to GND (should be 0's). Channel 0 is connected directly to 3.3V to obtain a full 1023 reading.

When observing the output of the ADC on the RPi, I am seeing lots of noisy data across all channels and Channel 0 is not 1023 but random values between 0-1023. It appears the ADC is not correctly translating the 3.3V on channel 0 to a solid 1023 and it is also getting values for the grounded channels 1-7.

Does anyone have any suggestions? I am using all brand new out of the box parts to eliminate the possibility of damaged connections. Also, I have metered all inputs and outputs on the ADC to RPi and all check out as working except the Dout pin on the ADC (MISO). The MISO pin from the ADC reads approximately 1.6V when it should output 3.3V since Ch.0 is connected to 3.3V.

\$\endgroup\$
  • \$\begingroup\$ In your question, you said "MOSI -> MOSI, MISO -> MISO" but there are no pins on the ADC labelled that according to the datasheet; I assume you mean Dout -> MISO, and Din <- MOSI. \$\endgroup\$ – tcrosley Dec 18 '14 at 0:23
  • \$\begingroup\$ What software are you using to read the values from the ADC? \$\endgroup\$ – Dave Tweed Dec 18 '14 at 0:28
  • \$\begingroup\$ Python script to read the ADC values \$\endgroup\$ – presish Dec 18 '14 at 0:29
  • \$\begingroup\$ Yes, I would have guessed that. Can you be a little more specific? For example, are you following the Adafruit tutorial? \$\endgroup\$ – Dave Tweed Dec 18 '14 at 0:41
  • \$\begingroup\$ Oh sorry about that. Yes I am using Adafruit's method of implementing the ADC. The spidev library not bit-banging the SPI connection. \$\endgroup\$ – presish Dec 18 '14 at 1:03
1
\$\begingroup\$
  • Multimeter check voltages of all inputs and outputs from RPi and ADC are what they should be = still "0" as the readings
  • Reprogrammed ADC using Python using Adafruit's library as well as bit-banging = still "0's"
  • Created replica circuit with all new out of the box components = still "0's"
  • Replaced wires on circuit used for SPI communication = SOLUTION!!!

I had to go through a few wires before I found working connections. THAT'S WHAT I GET BUYING WIRES FROM FOREIGN COUNTRIES (china)!!

\$\endgroup\$

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.