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

52 Replies to “Configuring and Testing your Hardware”

  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

    1. 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.

        1. Good to know! Did you have to modify the lightshowPi code at all to get things working on your bananapi, or just installing that library worked?

          1. I also have a BPI Pro that I want to use with ws2812 strings. Did you get the info to make this work out of the box yet or did the user disappear after they got it working?

          2. Didn’t get a response … you might try posting on the community forums though to see if others out there have got it working.

  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

    1. 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

      1. 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

    1. The software supports PWM dimming which works well for low voltage lights. If you post your request to our Google+ Community page you’ll likely get several responses with more details on hardware configurations, etc…

  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

  13. I just set up my RaspberryPi 3 with LightShow Pi following the “Getting Started” guide. Now, at the step “Configuring and Testing your Hardware”, when I try to run “sudo python py/hardware_controller.py –state=flash” out of the main LightShowPi directory, it says “Need to setup SYNCHRONIZED_LIGHTS_HOME environment variable, see readme” as an error message and none of the LEDs connected to the GPIOs turns on.
    I already visited your community homepage, but I don´t receive an answer there, so I´m asking here.
    Perage

      1. @Todd or anyone, Since the G+ community is gone. Is there an article on this in the Reddit Community. I am not finding one if there is. Thanks.

      2. Hi, I’m having the same issue, and I can’t access the Google Plus forum. I already tried removing spidev, and that didn’t solve the problem. If anyone could please post a possible solution, that would be great, and much appreciated. Thanks

  14. Hi, I installed lightshowpi, but when I try to verify my hardware setup, the LEDs are not flashing. I can turn them on using commands like “gpio write 0 1”, … Can someone help me please?

  15. Hi, when I execute “sudo python py/synchronized_lights.py –file /path/to/music.mp3” ly LEDs don’t flash or anything they just stay turned off.

  16. Has anyone combined this yet with the Google AIY Voice Kit? I would like to combine the two so that I can have the Pi play music based on an initiating action (button press or ‘OK Google Play’) and the name of the song. For example, “OK Google, play ‘A Mad Russian’s Christmas'”. The Voice Hat uses all of the GPIO pins, so direct LED control is out, but that’s not my goal here. I want a voice and button-controlled Christmas jukebox. My programming skills are somewhere between poor and adequate, so any help would be much appreciated!

  17. Hello, I am just installing the software and when I run the below command to test the hardware I get the following response. Any ideas? Thank you all!

    pi@raspberrypi:~/lightshowpi $ sudo python py/hardware_controller.py –state=fade

    Traceback (most recent call last):
    File “py/hardware_controller.py”, line 62, in
    cm = configuration_manager.Configuration()
    File “/home/pi/lightshowpi/py/configuration_manager.py”, line 81, in __init__
    self.load_config()
    File “/home/pi/lightshowpi/py/configuration_manager.py”, line 116, in load_config
    self.config.readfp(open(self.config_dir + ‘defaults.cfg’))
    IOError: [Errno 2] No such file or directory: ‘/home/pi/lightshowpi\r/config/defaults.cfg’

    1. By the way, I meant to say I have not made any changes to the configuration. everything i installed was per the instructions of the website.

  18. i get the following when running the first hardware test. Any help would be appreciated.

    Traceback (most recent call last):
    File “/usr/local/lib/python3.9/dist-packages/numpy/core/__init__.py”, line 24, in
    from . import multiarray
    File “/usr/local/lib/python3.9/dist-packages/numpy/core/multiarray.py”, line 10, in
    from . import overrides
    File “/usr/local/lib/python3.9/dist-packages/numpy/core/overrides.py”, line 8, in
    from numpy.core._multiarray_umath import (
    ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “/usr/local/lib/python3.9/dist-packages/numpy/__init__.py”, line 130, in
    from numpy.__config__ import show as show_config
    File “/usr/local/lib/python3.9/dist-packages/numpy/__config__.py”, line 4, in
    from numpy.core._multiarray_umath import (
    File “/usr/local/lib/python3.9/dist-packages/numpy/core/__init__.py”, line 50, in
    raise ImportError(msg)
    ImportError:

    IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

    Importing the numpy C-extensions failed. This error can happen for
    many reasons, often due to issues with your setup or how NumPy was
    installed.

    We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

    Please note and check the following:

    * The Python version is: Python3.9 from “/usr/bin/python”
    * The NumPy version is: “1.26.2”

    and make sure that they are the versions you expect.
    Please carefully study the documentation linked above for further help.

    Original error was: libopenblas.so.0: cannot open shared object file: No such file or directory

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File “/home/edwin/lightshowpi/py/hardware_controller.py”, line 38, in
    import led_module
    File “/home/edwin/lightshowpi/py/led_module.py”, line 17, in
    import numpy
    File “/usr/local/lib/python3.9/dist-packages/numpy/__init__.py”, line 135, in
    raise ImportError(msg) from e
    ImportError: Error importing numpy: you should not try to import numpy from
    its source directory; please exit the numpy source tree, and relaunch
    your python interpreter from there.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.