1

I've been messing with raspberry pi, and I am learning about interfacing it with analog devices. I am using the MCP3008 for that and following this tutorial here. I wired it up like the pictures below: enter image description here enter image description here

I did all of the required things to set up spi devices such as: 1) enable spi in raspi-config 2) uncommented dtparam=spi=on in config.txt. 3) ls /dev/sp* says /dev/spidev0.0 and /dev/spidev0.1

Everything to me seems correct, but the output from a potentiometer is still 0 no matter what i do with it. can anyone spot the problem?

14
  • Hi @Aubrey Champagne, Welcome and nice to meet you. Ah, let me see. (1) You setup looks correct. (2) For newbies, I usually suggest to do SPI "loop back" test first, to make sure SPI software and hardware (hardware wiring correct, no poor electrical connect, broker jumper wires (sometime bent too often and broken inside and not visible outside).
    – tlfong01
    Commented Dec 30, 2019 at 4:01
  • If you have a multi-meter, you can try "open, short" tests, ie, all point to point connection are shorted (very low resistance, approaching zero), and neighbour points are open, ie not "stuck" together, therefore very very high resistance, approaching 10Mega ohm.
    – tlfong01
    Commented Dec 30, 2019 at 4:01
  • You can google for "UART", "serial", "SPI" loop back test to get a rough idea what is meant by loop back, and the setup (For SPI, MOSI (output) connected/shorted to MSIO (input). then send something out to MSOI, and read back from MISO. If send characters are echoed, loopback to input, then basic steup is OK. WARNING, usually basic out to input short test does NOT check CS pin operation, so not 100% proof.
    – tlfong01
    Commented Dec 30, 2019 at 4:05
  • For spi loopback tests in Rpi python 3.5x and 3.7x, you can search this forum using key words "SPI", "loopback". If you add the search word "tlfong01" you might find a couple of my answers with loopback python test programs, colourful waveforms illustrating the CLK, MOIS, MISO, CSn waveforms. You don't need to understand the details of the programs. My programs are "plug and play/run" no library is required. Though you need to "uncomment" to select slight variation of loopback, say one, two, or three characters, or control characters such a <control x> etc. Happy testing, cheers!
    – tlfong01
    Commented Dec 30, 2019 at 4:12
  • Connect 3V3 to channel 0. Do you get a reading? Drop the speed to 100 kbps and use piscope to check the signals.
    – joan
    Commented Dec 30, 2019 at 9:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.