Configuring and Testing your Hardware

These instructions assume you have installed LightShow Pi, and have setup your hardware for controlling lights. Now it’s time to test out your hardware out with LightShow Pi and get your lights blinking!

Default Hardware Configuration

The default hardware configuration for LightShow Pi assumes you are using the first 8 GPIO ports (GPIO0 – GPIO7) to control 8 channels of lights. There are several other user contributed configurations provided to support commonly used hardware configurations in the lightshowpi/config/contrib directory of the install.

Verifying Your Hardware Configuration

You can verify your hardware setup and configuration are setup properly by blinking each channel one at a time using the following command from the main LightShow Pi directory (/home/pi/lightshowpi if you’ve followed the default install steps):

sudo python py/hardware_controller.py --state=flash

You can also fade each channel in and out using software PWM using the following command:

sudo python py/hardware_controller.py --state=fade

Press <CTRL>-C in the same terminal window to stop the blinking / fading lights test.

Note that software PWM fading will not work with all hardware configurations and all lights (it works best with either direct powered LEDs, or SSR controlled incandescent lights). The default configuration has each channel using software PWM fading. You can override this default behavior with the pin_modes configuration option (search for pin_modes in lightshowpi/config/defaults.cfg for more details).

Hardware Controller

The hardware controller provides other useful tools for testing your hardware and software configuration, see the command line help for more details:

sudo python py/hardware_controller.py -h

31 Comments

  1. Hello,

    I used BananaPi Pro to install lightsshowpi. The installation went okay without any errors but, the test failed with the error below.

    Unable to determine hardware version. I see: Hardware : sun7i
    ,
    – expecting BCM2708 or BCM2709. Please report this to projects@drogon.net

    Anything needs to be changed in the script.

    regards,
    Sanjay

    • Hi Sanjay. LightshowPi uses wiring pi for controlling GPIO, and the error you are getting is coming from the wiring pi code. I’ve not worked with / used a BananaPi – but a quick google search shows some ported libraries of wiring pi for BananaPi that you might try:

      https://github.com/LeMaker/WiringBP

      That said – I didn’t see a port to python for WiringBP, so it may not be a perfectly easy port to move to WiringBP.

      You could also try to contact the author of WiringPi and see if he has recommendations, or the author of WiringBP. Hope this helps!

  2. I seen that Wiringpi is installed during the setup of lightshowpi in the same directory. This could be a Raspberry Pi specific installation. But, I have installed WiringpiBP from the lemaker site and it works with GPIO. Seems I need to change something in the script to use the Bananapi wiringpi code.

    Which file to be modified.

    BTW I also have a RaspberryPi rev A (256 MB) version which I ordered by mistake. Then purchased BananaPi from a china site before RPi-2 was available. I couln’t wait 🙁

    Let me try RPi today with lightshow.

  3. I tried Raspberry Pi rev.A

    The test for flash and fade works. I am unable to play the sample music file. the following error comes after about a minutes.

    root@osmc:/home/osmc/lightshowpi# sudo python py/synchronized_lights.py –file=/home/os
    mc/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3
    ALSA lib confmisc.c:768:(parse_card) cannot find card ‘0’
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned erro
    r: No such file or directory
    ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No
    such file or directory
    ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No
    such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
    Traceback (most recent call last):
    File “py/synchronized_lights.py”, line 465, in
    play_song()
    File “py/synchronized_lights.py”, line 364, in play_song
    output = aa.PCM(aa.PCM_PLAYBACK, aa.PCM_NORMAL)
    alsaaudio.ALSAAudioError: No such file or directory
    root@osmc:/home/osmc/lightshowpi#

  4. I am using a Raspberry Pi 2. I followed the instructions up to verifying the hardware configuration.

    When I run either command, the USB ports and the ethernet port power off and I can not exit out of the code. Could it be the power adapter that I am using?

  5. I just setup my pi2 and its work good so for I just want to add some songs . The sounds are MP3 how to make a play list of 10 songs and put it on a loop . And will I be able to control it from my iPhone . Please give some ideas . Thanks for your time.

  6. Every time i type in :

    sudo python py/hardware_controller.py –state=flash

    It always displays: command not found.

    I have downloaded lightshow pi, but when I went to install it I saw a few “Failed” words throughout the installation. It said stuff like “Failed to fetch…” I don’t know if this is the reason for the configuration to not work.

  7. Hi Guys,

    Hoping you can help.

    When I run the “sudo python py/hardware_controller.py –state=flash” command my relays click and their corresponding lights come on, but when it goes through the cycle of flashing my relay’s / lights don’t flash at all.

    I have tried all the different combo’s for the GPIO connectors in case I had those wrong.

    Can anyone help at all? or head me down the right track 🙂

    My set up is:
    Raspberry Pi Model B Rev 1.
    2x 4 Mechanical Relay’s
    Skill Level: beginner to average

    • Hayden – could you post your inquiry to the community page – you’ll get much quicker support there by a large audience:

      https://plus.google.com/communities/101789596301454731630

      I’d have to have more details on the actual relay model and how you’ve wired things. One thing you might try is changing the active_low_mode = yes in your config overrides. (as most mechanical relays I’ve seen are active low)

  8. I’m doing this for a school project and it the schools wifi has blocked me from reaching the google+ community page for help.

    I’m having an issue when running: sudo py/synchronized_lights.py
    I get an import error that says no module named alsaaudio. However, I installed and ran the drivers for alsa but still get the same issue

      • Turns out I did not actually. My mistake for not paying attention to the logs and rushing ahead. The site brailleweb is blocked by my school and am in the process of getting it unblocked. Sorry for the rookie mistake!

  9. when trying to run this i get the following error message.
    Error:root devices not defined or not in JSON format.
    expeting property name line1 column2(char1)
    i still get the music playing but no lightshow also i have wired it up as suggested but does each individual led have to be wired up to the 3.3v supply on breadboard as well as wired to a gpio pin

  10. Hi,

    I am new to using a Raspberry Pi for Christmas light control and am wondering if it is possible to do fading with a string of low voltage LED fairy lights. Most of what I have seen on this site show straight switching on/off using a relay. Any help would be much appreciated.

    Thanks

  11. Hey,
    can u please make a guide how to stream music from Android device ( with AirAudio vor sth else ) to LightShowPi?

    Thanks!

  12. What would cause only my first 3 relays to flash when I run this?

    sudo python py/hardware_controller.py –state=flash

Leave a Reply

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