Raspi 4 + "Arduino Uno" + WS2812B

  • Moin,


    ich habe laut dieser Anleitung:
    https://hyperion-project.org/t…-ws2801-ws2812b-apa102.8/


    Mein Ambilight aufgebaut, benutze dazu jedoch das Raspberry Pi 4 wo ich das Problem vermute.
    Eingerichtet ist alles, der Raspi erkennt den Grabber wie auch das "Arduino". "Arduino" startet auch mit Hyperion und alle LED's leuchten bei der Startsequenz auf, das wars aber dann auch schon. Über Hyperion kann ich das Bild vom Grabber abrufen. Wenn ich die LED Streifen mit FastLED über das "Arduino" ansteuer funktionieren sie Problemlos.


    Hardware die ich nutze:
    Raspberry Pi 4
    BTF-LIGHTING WS2812B 5M 60 LEDs
    Easyday EasyCap USB 2.0 UTV007 RCA AV S-Video CVBS
    Musou HDMI auf 3RCA Composite …V Converter Adapter 1080P
    BTF-LIGHTING DC5V 20A 100W

    ELEGOO UNO R3 Mikrocontroller …uino Entwicklungsumgebung




    Hier einmal der LOG: Vielleicht habe ich auch nur etwas falsch eingestellt.


    [H]
    SSH Traffic:
    ssh connected
    ssh out: /storage/.config/autostart.sh > /dev/null 2>&1 &
    ssh out: cat /storage/logfiles/hyperion.log
    ssh in: Hyperion Ambilight Deamon (835)
    ssh in: Version : V1.03.5 (GitHub-66bef6b/fb413cd-1566231780
    ssh in: Build Time: Aug 25 2019 10:39:29
    ssh in: INFO: Selected configuration file: /storage/.config/hyperion.config.json
    ssh in: HYPERION INFO: ColorTransform 'default' => [0; 307]
    ssh in: HYPERION INFO: ColorCorrection 'default' => [0; 307]
    ssh in: HYPERION INFO: ColorAdjustment 'default' => [0; 307]
    ssh in: LEDDEVICE INFO: configuration:
    ssh in: {
    ssh in: "colorOrder" : "grb",
    ssh in: "name" : "MyPi",
    ssh in: "output" : "/dev/ttyACM0",
    ssh in: "rate" : 460800,
    ssh in: "type" : "adalight"
    ssh in: }
    ssh in: Opening UART: /dev/ttyACM0
    ssh in: INFO: Creating linear smoothing
    ssh in: HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
    ssh in: EFFECTENGINE INFO: 27 effects loaded from directory /storage/hyperion/effects
    ssh in: EFFECTENGINE INFO: Initializing Python interpreter
    ssh in: INFO: Hyperion started and initialised
    ssh in: INFO: Boot sequence 'Rainbow swirl fast' EFFECTENGINE INFO: run effect Rainbow swirl fast on channel 0
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: started
    ssh in: INFO: Kodi checker created and started
    ssh in: INFO: Json server created and started on port 19444
    ssh in: INFO: Proto server created and started on port 19445
    ssh in: DISPMANXGRABBER INFO: Display opened with resolution: 4x1053523228
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: INFO: Frame grabber created and started
    ssh in: V4L2GRABBER INFO: width=720 height=576
    ssh in: V4L2GRABBER INFO: pixel format=YUYV
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: V4L2GRABBER INFO: signal threshold set to: {0,0,0}
    ssh in: V4L2GRABBER INFO: started
    ssh in: INFO: V4L2 grabber created and started
    ssh in: KODICHECK ERROR: Kodi Connection error (0)
    ssh in: DISPMANXGRABBER ERROR: Snapshot failed: -1
    ssh in: BORDER SWITCH REQUIRED!!
    ssh in: CURRENT BORDER TYPE: unknown=0 hor.size=6 vert.size=0
    ssh in: DISPMANXGRABBER ERROR: Snapshot failed: -1
    ssh in: DISPMANXGRABBER ERROR: Snapshot failed: -1



    [/H]


    Auf dem Arduino läuft folgendes:


    [H]
    #include "FastLED.h"


    // How many leds in your strip?
    #define NUM_LEDS 308


    // 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 6
    //#define CLOCK_PIN 13


    #define COLOR_ORDER RGB


    // 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, RGB>(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));
    delay(500);
    LEDS.showColor(CRGB(0, 255, 0));
    delay(500);
    LEDS.showColor(CRGB(0, 0, 255));
    delay(500);
    LEDS.showColor(CRGB(0, 0, 0));

    Serial.begin(serialRate);
    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()) ;;
    hi=Serial.read();
    while (!Serial.available()) ;;
    lo=Serial.read();
    while (!Serial.available()) ;;
    chk=Serial.read();


    // if checksum does not match go back to wait
    if (chk != (hi ^ lo ^ 0x55))
    {
    i=0;
    goto waitLoop;
    }


    memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
    // read the transmission data and set LED values
    for (uint8_t i = 0; i < NUM_LEDS; i++) {
    byte r, g, b;
    while(!Serial.available());
    r = Serial.read();
    while(!Serial.available());
    g = Serial.read();
    while(!Serial.available());
    b = Serial.read();
    leds.r = r;
    leds.g = g;
    leds.b = b;
    }
    // shows new values
    FastLED.show();
    }

    [/H]

  • Hm, so wie es klingt scheint an sich alles zu funktionieren, nur das capturen des Bildes nicht und entsprechend steht auch eine solche Meldung am Ende des Logs. Ob es aber nur an der fehlenden Einstellung des Typs des Rahmens liegt? Zumindest steht da, dass diese Einstellung zwingend erforderlich ist.

  • Aktuell sieht der Log wie folgt aus:


    Die letzten Zeilen


    ssh in: INFO: V4L2 grabber created and started
    ssh in: BORDER SWITCH REQUIRED!!
    ssh in: CURRENT BORDER TYPE: unknown=0 hor.size=2 vert.size=3
    ssh in: V4L2GRABBER INFO: stopped


    Rainbow swirl, Fehlanzeige. Arduino macht aber seine Sequenz, Screenshot konnte ich auch abrufen aber die letzten Zeilen machen mich stutzig bzw. was ist damit genau gemeint?


    SSH Traffic:
    ssh connected
    ssh out: killall hyperiond 2>/dev/null ; /storage/hyperion/bin/hyperion-v4l2.sh --device /dev/video0 --video-standard PAL --input 0 --width -1 --height -1 --crop-left 20 --crop-right 20 --crop-top 10 --crop-bottom 10 --size-decimator 1 --frame-decimator 2 --red-threshold 0.0 --green-threshold 0.0 --blue-threshold 0.0 --screenshot
    ssh in: hyperion-v4l2:
    ssh in: version : V1.03.5 (GitHub-66bef6b/fb413cd-1566231780
    ssh in: build time: Aug 25 2019 10:39:29
    ssh in: V4L2GRABBER INFO: width=720 height=576
    ssh in: V4L2GRABBER INFO: pixel format=YUYV
    ssh in: V4L2GRABBER INFO: signal threshold set to: {0,0,0}
    ssh in: V4L2GRABBER INFO: started
    ssh in: V4L2GRABBER INFO: stopped
    sftp getFile(./screenshot.png, java.awt.Image)
    ssh out: /storage/.config/autostart.sh > /dev/null 2>&1 &
    ssh out: cat /storage/logfiles/hyperion.log
    ssh in: Hyperion Ambilight Deamon (1151)
    ssh in: Version : V1.03.5 (GitHub-66bef6b/fb413cd-1566231780
    ssh in: Build Time: Aug 25 2019 10:39:29
    ssh in: INFO: Selected configuration file: /storage/.config/hyperion.config.json
    ssh in: HYPERION INFO: ColorTransform 'default' => [0; 307]
    ssh in: HYPERION INFO: ColorCorrection 'default' => [0; 307]
    ssh in: HYPERION INFO: ColorAdjustment 'default' => [0; 307]
    ssh in: LEDDEVICE INFO: configuration:
    ssh in: {
    ssh in: "colorOrder" : "grb",
    ssh in: "name" : "MyPi",
    ssh in: "output" : "/dev/ttyACM0",
    ssh in: "rate" : 460800,
    ssh in: "type" : "adalight"
    ssh in: }
    ssh in: Opening UART: /dev/ttyACM0
    ssh in: INFO: Creating linear smoothing
    ssh in: HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
    ssh in: EFFECTENGINE INFO: 27 effects loaded from directory /storage/hyperion/effects
    ssh in: EFFECTENGINE INFO: Initializing Python interpreter
    ssh in: INFO: Hyperion started and initialised
    ssh in: INFO: Boot sequence 'Rainbow swirl fast' EFFECTENGINE INFO: run effect Rainbow swirl fast on channel 0
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: started
    ssh in: INFO: Json server created and started on port 19444
    ssh in: INFO: Proto server created and started on port 19445
    ssh in: DISPMANXGRABBER INFO: Display opened with resolution: 720x480
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: INFO: Frame grabber created and started
    ssh in: V4L2GRABBER INFO: width=720 height=576
    ssh in: V4L2GRABBER INFO: pixel format=YUYV
    ssh in: BLACKBORDER INFO: threshold set to 0.15 (39)
    ssh in: BLACKBORDER INFO: mode:default
    ssh in: V4L2GRABBER INFO: signal threshold set to: {0,0,0}
    ssh in: V4L2GRABBER INFO: started
    ssh in: INFO: V4L2 grabber created and started
    ssh in: BORDER SWITCH REQUIRED!!
    ssh in: CURRENT BORDER TYPE: unknown=0 hor.size=2 vert.size=3
    ssh in: V4L2GRABBER INFO: stopped

  • ssh in: BORDER SWITCH REQUIRED!!
    ssh in: CURRENT BORDER TYPE: unknown=0 hor.size=2 vert.size=3


    Das sieht mir nach dem Problem aus, aber keine Ahnung was man da machen kann? Gibt es dafür keine Variable?

  • Also ich habe das Arduino mal abgesteckt und den Code von dieser Seite auf meinem Raspberry versucht


    https://hyperion-project.org/wiki/3-Wire-PWM


    Ich sehe den Regenbogen beim Starten, jedoch flackern die LED verdammt stark. Die Kombi mit dem Arduino will irgendwie nicht laufen. Liegt nicht am Pi da ich es mit einem 3 wie auch 4 versucht habe. Irgend eine Einstellung passt da nicht.


    Bleibe aber dran und sollte sich was tun melde ich mich.

  • Kurze Rückmeldung. SSH Farbrad funktioniert mittlerweile auch, alles Leuchtet wunderbar. Problem ist jetzt nur das die LED nicht richtig zum Bild leuchten und leicht flackern/blinken. Ich denke das es evtl. eine Einstellungssache ist?! Ansonsten bin ich schon zufrieden damit, außer das es mir so vorkommt das es auf der rechten Seite nicht so doll leuchtet wie links/oben/unten. Habe zwei Videos hinzugefügt.


    Funktioniert hat es am Ende nur mit einem Raspberry Pi 3 den ich zu Hand hatte mit Buster Lite (der Pi 4 wollte nicht) über den GPIO 18. Werde da dran noch ein Pegelwandler setzen um aus den 3,3 V die 5 V für die Datenleitung hinzubekommen.


    Das ist meine aktuelle Einstellung hyperion.config.json:



    hypercon log


    Video Test 1


    Video Test 2

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!