2

Using this addressable LED strip:

  • WS2801 Led Full Color character string matrix screen point source 12mm 5V
  • WS2801 IC Chip, Addressable Color, need for controller.
  • Identify IC every led light,
  • Red- Positive White- DAT, Green-CLK, Blue- GND
  • The note glue craft processing, waterproof
  • Lamp to Lamp around 3cm-5cm
  • Max current: 0.02A
  • Max power: 0.3w
  • Size: 12mm
  • Working voltage: DC 5V

I am trying to control it using my raspberry pi (running raspbian). Many sites point out that Wheezy does not have hardware SPI installed and I have to do a firmware update, install the beta Wheezy, or install Occidentalis. I don't want to do any of that, and besides I am fairly certain that I have SPI installed for the following reasons:

  1. I managed to download a program and run it which would turn all the lights on. However, this would crash my raspi and I had to physically unplug it. Also, I can no longer recreate this.
  2. My /dev/ folder has the files spidev0.0, spidev0.1 and spidev0.3

Right now the strip is connected like so:

enter image description here

I am using a 5V, 2A power adapter, and only the third light is on, and occasionaly the 28th LED lights up dimly. First I am having problems with SPI, which leads me to believe it might not/no longer be set up correctly. Observe the output of the following commands:

raspi@raspi4 ~ $ ls -l /dev/spi*
crw------- 1 raspi raspi 153, 0 Jan  1  1970 /dev/spidev0.0
crw------- 1 raspi raspi 153, 1 Jan  1  1970 /dev/spidev0.1
-rw-r--r-- 1 raspi raspi    108 Feb 25 18:57 /dev/spidev0.3
raspi@raspi4 ~ $ sudo lsmod
Module                  Size  Used by
bnep                   10582  2 
bluetooth             192720  7 bnep
rfkill                 18298  2 bluetooth
nfsd                  229865  11 
binfmt_misc             6968  1 
snd_bcm2835            16432  0 
snd_pcm                77728  1 snd_bcm2835
snd_page_alloc          5169  1 snd_pcm
snd_seq                53482  0 
snd_seq_device          6462  1 snd_seq
snd_timer              20110  2 snd_pcm,snd_seq
snd                    58744  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
spidev                  5248  0 
leds_gpio               2243  0 
led_class               3570  1 leds_gpio
spi_bcm2708             4841  0 

Which tells me that SPI is installed. However, using this program from this tutorial it tells me that SPI is not set up correctly, observe

raspi@raspi4 ~/downloads/spidev_test $ sudo ./spidev_test #for spidev0.0 or 0.1
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 
raspi@raspi4 ~/downloads/spidev_test $ sudo ./spidev_test #for spidev0.3
can't set spi mode: Inappropriate ioctl for device

Frustrated, I tried banging through some tutorials, but none of the below seem to work either:

  1. Simple SPI on Raspi
  2. Simple Command Line Utility for Raspi
  3. RPI-LPD8806
  4. Pixel Pi
  5. Light Painting With Raspi
  6. Raspberry Pi and the WS2801

Question: Can someone walk me through diagnosing this as either an SPI problem or a program problem.

EDIT:

  • "which program did you manage to run"? RPI-LPD8806, specifically this python script
  • "What libraries have you installed"? Commands issued follow below

  • "How did you compile the SPI test program"? Like so, gcc spidev_test.c -o spidev_test && sudo ./spidev_test

  • "Have you loaded the SPI modules"? "If so how"? Yes, like so gpio load spi. Note that issuing the command sudo modprobe spi_bcm2708 fails with this error "libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/3.6.11+/modules.dep.bin'"

Commands issued:

sudo apt-get install python-dev
git clone https://github.com/doceme/py-spidev.git
cd py-spidev/
sudo python setup.py install

git clone https://github.com/adammhaile/RPi-LPD8806.git
cd RPi-LPD8806
python setup.py install

`sudo apt-get update`
`sudo apt-get install python-dev`
  • You need to ask better questions. You keep telling us something doesn't work, but in most cases don't even tell us what you tried. Most such questions get prompted for more info (or ignored). "I managed to download a program and run it" - which program? What libraries have you installed? How did you compile the SPI test program? Have you loaded the SPI modules? If so how? – Milliways Feb 27 '14 at 4:02
  • @Milliways sorry about that, please see edits – puk Feb 27 '14 at 4:27
  • I have only used SPI with the Gertboard, which does not use the device driver. (It ultimately accesses the hardware via open in wiringPiSPISetup). I executed gpio load spi and compiled spidev_test, which failed on my system, although SPI certainly works. Incidentally you can automatically load the SPI drivers by editing /etc/modprobe.d/raspi-blacklist.conf – Milliways Feb 27 '14 at 6:33
  • @milliways I dont know what gertboard is. I will google it and check SO tomorrow as it is late now. Essentially what I am asking and what my problem is is that I dont know what the problem is (spi broken or not communicating with led strip correctly) – puk Feb 27 '14 at 7:27

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.