1

enter image description here

enter image description here

CH5 is connected to my AO from my moisture sensor.

pi@raspberrypi:~ $ ls -l /dev/spi*
crw-rw---- 1 root spi 153, 0 Jun 18 12:13 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Jun 18 12:13 /dev/spidev0.1

Check if spidev is available

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
sha256_generic          9839  1
hmac                    3211  1
drbg                   12876  1
ctr                     4101  1
ccm                     9008  1
arc4                    2076  2
rt2800usb              18877  0
rt2800lib              82155  1 rt2800usb
rt2x00usb              12680  1 rt2800usb
rt2x00lib              48998  3 rt2x00usb,rt2800lib,rt2800usb
mac80211              608549  3 rt2x00lib,rt2x00usb,rt2800lib
cfg80211              499234  2 mac80211,rt2x00lib
crc_ccitt               1732  1 rt2800lib
rfkill                 21397  2 cfg80211
snd_bcm2835            23163  0
snd_pcm                95441  1 snd_bcm2835
snd_timer              22396  1 snd_pcm
snd                    68368  3 snd_bcm2835,snd_timer,snd_pcm
spi_bcm2835             8032  0
bcm2835_gpiomem         3823  0
bcm2835_wdt             4133  0
uio_pdrv_genirq         3718  0
uio                    10230  1 uio_pdrv_genirq
w1_therm                4475  0
w1_gpio                 4534  0
wire                   31801  2 w1_gpio,w1_therm
cn                      5860  1 wire
i2c_dev                 6578  0
fuse                   89800  1
ipv6                  367607  24

I guess I can check here if spi is enanabled.

And this is the python code I'm trying to run

pi@raspberrypi:~ $ sudo python
Python 2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mcp3008
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mcp3008

Or in a python file

from time import sleep
import mcp3008

while True:
    m = mcp3008.readadc(5)
    print "Moisture level: {:>5} ".format(m)
    sleep(.5)

which yields

pi@raspberrypi:~/Documents/GPIOProjects $ sudo python mcptest.py
Traceback (most recent call last):
  File "mcptest.py", line 2, in <module>
    import mcp3008
ImportError: No module named mcp3008

It did work yesterday and I got some readings. I then went on to write some python scrip to output on my HD44780 LCD. I may have rebooted during this, however since then I wasn't able to talk to the MCP3008.

My raspi-blacklist.confi looks like this

blacklist i2c-bcm2708

Version

pi@raspberrypi:~/Documents/GPIOProjects $ uname -a
Linux raspberrypi 4.4.13+ #894 Mon Jun 13 12:43:26 BST 2016 armv6l GNU/Linux

OS Version

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~ $

I did activate SPI & SPI Kernel in Advanced Options

  • What OS are you using? – Milliways Jun 18 '16 at 11:49
  • @Milliways Raspbian – idkfa Jun 18 '16 at 11:50
  • I repeat What OS are you using - specifically which version? – Milliways Jun 18 '16 at 11:51
  • @Milliways I added the information if that is the correct command. I'm new to RPi – idkfa Jun 18 '16 at 11:54
  • 1
    The error message gives you the error. There is no module called mcp3008. Presumably you created or downloaded this module and put it into your local directory. You will need to do that again. – joan Jun 18 '16 at 13:54

Your Answer

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

Browse other questions tagged or ask your own question.