1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + OpenELEC Hyperion + WS2812B + Pi 3 + Arduino R3

Discussion in 'Software Support' started by Anthony, 13 February 2019 at 22:03.

  1. Anthony

    Anthony New Member

    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue
    Hello, I have read through all the help topics and seem to still be hitting a brick wall. I have followed the redit post here (
    https://amp.reddit.com/r/raspberry_pi/comments/6892nf/diy_ambilight_tv_guide_ws2812neopixels/) When I power everything on, it flashes the RGB sequence that the Arduino is programmed for. I am waiting for the light strip to then do the rainbow swirl from Hyperion and it just stays off. If I try to search for available servers in the Hyperion app, I find my pi, but nothing changes on the LEDs no matter what I click on the app or inside the Hyperion config java program.. Please can someone help shed some light on what I am doing wrong?

    I am using the following hardware
    LED WS2812B
    Arduino R3
    Pi 3 B
    Video grabber with UTC007
    HDMI Splitter

    all connections should be 100% correct,
    video source > splitter > hdmi2av > video grabber > to raspberry pi.

    raspberry pi > Arduino

    Arduino pin 5 is to 240ohm resistor then to LED Din and Arduino GND to LED GND

    All power run to 5V 10A power supply. Everything appears operational, I just think I'm missing something in the code.

    Hyperion.Config.Json is uploaded OpenElec 7.0.1.img to raspberry pi

    below is my sketch
    #include "FastLED.h"
    // How many leds in your strip?
    #define NUM_LEDS 240
    // For led chips like Neopixels, which have a data line, ground, and power, you just
    // need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
    // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
    #define DATA_PIN 5
    //#define CLOCK_PIN 4
    #define COLOR_ORDER GRB
    // Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
    uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
    // Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
    #define serialRate 500000
    // Define the array of leds
    CRGB leds[NUM_LEDS];
    void setup() {
      // Uncomment/edit one of the following lines for your leds arrangement.
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
      FastLED.addLeds<WS2812B, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
      // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // initial RGB flash
      LEDS.showColor(CRGB(255, 0, 0));
      LEDS.showColor(CRGB(0, 255, 0));
      LEDS.showColor(CRGB(0, 0, 255));
      LEDS.showColor(CRGB(0, 0, 0));
      Serial.print("Ada\n"); // Send "Magic Word" string to host
    void loop() {
      // wait for first byte of Magic Word
      for(i = 0; i < sizeof prefix; ++i) {
      waitLoop: while (!Serial.available()) ;;
      // Check next byte in Magic Word
      if(prefix == Serial.read()) continue;
      // otherwise, start over
      i = 0;
      goto waitLoop;
      // Hi, Lo, Checksum
      while (!Serial.available()) ;;
      while (!Serial.available()) ;;
      while (!Serial.available()) ;;
      // if checksum does not match go back to wait
      if (chk != (hi ^ lo ^ 0x55))
      goto waitLoop;
      memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
      // read the transmission data and set LED values
      for (int i = 0; i < NUM_LEDS; i++) {
      byte r, g, b;
      g = Serial.read();
      r = Serial.read();
      b = Serial.read();
      leds.r = r;
      leds.g = g;
      leds.b = b;
      // shows new values
    Any help would be greatly appreciated. If you need me to run any tests, please let me know what code I need to use to run this. I understand how to use Putty, but I don't know any of the commands by heart.

    Attached Files:

    Last edited by a moderator: 14 February 2019 at 13:23
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    "delayAfterConnect" : 10,
    instead of
    "delayAfterConnect" : 0,

    and delete the framegrabber part if you want to use only the usb grabber

    "framegrabber" :
    "width" : 96,
    "height" : 54,
    "frequency_Hz" : 10.0,
    "priority" : 890
  3. Anthony

    Anthony New Member

    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue
    Thank you @TPmodding in the end I went back to the beginning. Flashed the pi and arduino. I used rasbian Jessie lite on the pi, installed Hyperion and python then used the sketch above and all works perfectly now. No openelec or XBMC / Kodi. Now, when the framegrabber doesn’t see video, I get the multicoloured columns with a no signal box. I’m using EasyCap with 007 chipset. Is it possible to just go to a black screen when no signal is present? I’m having to turn off the LEDs with Hyperion app. Would be nice to tell my google home “OK Google, start Hyperion.” ...anyone? Thanks in advance for any help.
  4. TPmodding

    TPmodding Administrator Staff Member Administrator

    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266