Tutorial: ESP8266/ESP32 Addon (Wifi LED Controller UDP)

Heute ist Stammtischzeit:
Jeden Donnerstag 20:30 Uhr hier im Chat.
Wer Lust hat, kann sich gerne beteiligen. ;)
  • Hey leute verfolge dieses projekt schon lange um mein büro etwas aufzuwerten! Werde es aber eher in einer form von Synchronisierter Beleuchtung verwenden! Pi am Schreibtisch mit ws2801 zur Beleuchtung meiner Wand, esp8266 mit ws2801 im pc Gehäuse xD und einmal einen magic home led controller (basis esp8266) für normale rgb leds hinter meinem billi regal 4x4.

    Hier ist auch das Problem habe es hinbekommen den magic home Controller zu flashen mit dieser hyperion Firmware... Web interface läuft Steuerung per app auch nur weiß ich nicht wie weit ich die pins anpassen muss in der config da er mir nur rot anzeigt alle anderen Farben bleiben aus.

    https://tinkerman.cat/magic-home-led-controller-espurnad/

    Auf der Seite hat jemand das ding auch selbst bespielt mit einer firmware nur werde ich nicht schlau welche gpios ich anders setzen muss vllt hat jemand eine idee?

  • Tutorial: ESP8266/ESP32 Addon (Wifi LED Controller UDP)? Schau mal ob du hier fündig wirst!

  • Gutentag,

    Mein Name ist Wim und ich komme aus Holland, also verzeihung wenn mein Deutsch nicht so gut ist.

    Ich bin neu mit Hyperion und habe eine Frage relatiert an diesem thread.
    Ich habe ein raspberry pi2 als hyperion server, daran mit usb einen arduino uno wifi und daran einen ws2813 ledstrip.

    Ihr koennst schon raten, ich moechte gerne den Arduino uber wifi mit dem Pi verbinden anstatt mit usb kabel.
    Den arduino uno wifi hat auch einESP8266 modul, darum hoffte ich Ihr koennt mir helfen.

    Dies ist mein Sketch den ich in den Arduino geuploaded habe (arduino 1.8.3):
    #include <Adafruit_NeoPixel.h>

    #include "FastLED.h"

    #define ANALOG_MODE_AVERAGE 0
    #define ANALOG_MODE_LAST_LED 1

    /**************************************
    S E T U P

    set following values to your needs
    **************************************/

    #define INITIAL_LED_TEST_ENABLED true
    #define INITIAL_LED_TEST_BRIGHTNESS 32 // 0..255
    #define INITIAL_LED_TEST_TIME_MS 500 // 10..

    // Number of leds in your strip. set to "1" and ANALOG_OUTPUT_ENABLED to "true" to activate analog only
    // As of 26/1/2017:
    // 582 leaves ZERO bytes free and this
    // 410 is ok
    // tested with 500 leds and is fine (despite the warning)
    #define MAX_LEDS 500

    // type of your led controller, possible values, see below
    #define LED_TYPE WS2813

    // 3 wire (pwm): NEOPIXEL BTM1829 TM1812 TM1809 TM1804 TM1803 UCS1903 UCS1903B UCS1904 UCS2903 WS2812 WS2852
    // S2812B SK6812 SK6822 APA106 PL9823 WS2811 WS2813 APA104 WS2811_40 GW6205 GW6205_40 LPD1886 LPD1886_8BIT
    // 4 wire (spi): LPD8806 WS2801 WS2803 SM16716 P9813 APA102 SK9822 DOTSTAR

    // For 3 wire led stripes line Neopixel/Ws2812, 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), both defines DATA_PIN and CLOCK_PIN are needed

    // DATA_PIN, or DATA_PIN, CLOCK_PIN
    #define LED_PINS 6 // 3 wire leds
    //#define LED_PINS 6, 13 // 4 wire leds

    #define COLOR_ORDER RGB // colororder of the stripe, set RGB in hyperion

    #define OFF_TIMEOUT 15000 // ms to switch off after no data was received, set 0 to deactivate

    // analog rgb uni color led stripe - using of hyperion smoothing is recommended
    // ATTENTION this pin config is default for atmega328 based arduinos, others might work to
    // if you have flickering analog leds this might be caused by unsynced pwm signals
    // try other pins is more or less the only thing that helps
    #define ANALOG_OUTPUT_ENABLED false
    #define ANALOG_MODE ANALOG_MODE_LAST_LED // use ANALOG_MODE_AVERAGE or ANALOG_MODE_LAST_LED
    #define ANALOG_GROUND_PIN 8 // additional ground pin to make wiring a bit easier
    #define ANALOG_RED_PIN 9
    #define ANALOG_GREEN_PIN 10
    #define ANALOG_BLUE_PIN 11

    // overall color adjustments
    #define ANALOG_BRIGHTNESS_RED 255 // maximum brightness for analog 0-255
    #define ANALOG_BRIGHTNESS_GREEN 255 // maximum brightness for analog 0-255
    #define ANALOG_BRIGHTNESS_BLUE 255 // maximum brightness for analog 0-255

    #define BRIGHTNESS 255 // maximum brightness 0-255
    #define DITHER_MODE BINARY_DITHER // BINARY_DITHER or DISABLE_DITHER
    #define COLOR_TEMPERATURE CRGB(255,255,255) // RGB value describing the color temperature
    #define COLOR_CORRECTION TypicalLEDStrip // predefined fastled color correction
    //#define COLOR_CORRECTION CRGB(255,255,255) // or RGB value describing the color correction

    // Baudrate, higher rate allows faster refresh rate and more LEDs
    //#define serialRate 460800 // use 115200 for ftdi based boards
    //#define serialRate 115200 // use 115200 for ftdi based boards
    #define serialRate 500000 // use 115200 for ftdi based boards


    /**************************************
    A D A L I G H T C O D E

    no user changes needed
    **************************************/

    // 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;

    unsigned long endTime;

    // Define the array of leds
    CRGB leds[MAX_LEDS];

    // set rgb to analog led stripe
    void showAnalogRGB(const CRGB& led) {
    if (ANALOG_OUTPUT_ENABLED) {
    byte r = map(led.r, 0,255,0,ANALOG_BRIGHTNESS_RED);
    byte g = map(led.g, 0,255,0,ANALOG_BRIGHTNESS_GREEN);
    byte b = map(led.b, 0,255,0,ANALOG_BRIGHTNESS_BLUE);
    analogWrite(ANALOG_RED_PIN , r);
    analogWrite(ANALOG_GREEN_PIN, g);
    analogWrite(ANALOG_BLUE_PIN , b);
    }
    }

    // set color to all leds
    void showColor(const CRGB& led) {
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    LEDS.showColor(led);
    #endif
    showAnalogRGB(led);
    }

    // switch of digital and analog leds
    void switchOff() {
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    memset(leds, 0, MAX_LEDS * sizeof(struct CRGB));
    FastLED.show();
    #endif
    showAnalogRGB(leds[0]);
    }

    // function to check if serial data is available
    // if timeout occured leds switch of, if configured
    bool checkIncommingData() {
    boolean dataAvailable = true;
    while (!Serial.available()) {
    if ( OFF_TIMEOUT > 0 && endTime < millis()) {
    switchOff();
    dataAvailable = false;
    endTime = millis() + OFF_TIMEOUT;
    }
    }

    return dataAvailable;
    }

    // main function that setups and runs the code
    void setup() {
    Serial.begin(serialRate);

    // analog output
    if (ANALOG_OUTPUT_ENABLED) {
    // additional ground pin to make wiring a bit easier
    pinMode(ANALOG_GROUND_PIN, OUTPUT);
    digitalWrite(ANALOG_GROUND_PIN, LOW);
    pinMode(ANALOG_BLUE_PIN , OUTPUT);
    pinMode(ANALOG_RED_PIN , OUTPUT);
    pinMode(ANALOG_GREEN_PIN, OUTPUT);
    }

    int ledCount = MAX_LEDS;
    if (ANALOG_MODE == ANALOG_MODE_LAST_LED) {
    ledCount--;
    }

    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    FastLED.addLeds<LED_TYPE, LED_PINS, COLOR_ORDER>(leds, ledCount);
    #endif

    // color adjustments
    FastLED.setBrightness ( BRIGHTNESS );
    FastLED.setTemperature( COLOR_TEMPERATURE );
    FastLED.setCorrection ( COLOR_CORRECTION );
    FastLED.setDither ( DITHER_MODE );

    // initial RGB flash
    #if INITIAL_LED_TEST_ENABLED == true
    for (int v=0;v<INITIAL_LED_TEST_BRIGHTNESS;v++)
    {
    showColor(CRGB(v,v,v));
    delay(INITIAL_LED_TEST_TIME_MS/2/INITIAL_LED_TEST_BRIGHTNESS);
    }

    for (int v=0;v<INITIAL_LED_TEST_BRIGHTNESS;v++)
    {
    showColor(CRGB(v,v,v));
    delay(INITIAL_LED_TEST_TIME_MS/2/INITIAL_LED_TEST_BRIGHTNESS);
    }
    #endif
    showColor(CRGB(0, 0, 0));

    Serial.print("Ada\n"); // Send "Magic Word" string to host


    boolean transmissionSuccess;
    unsigned long sum_r, sum_g, sum_b;

    // loop() is avoided as even that small bit of function overhead
    // has a measurable impact on this code's overall throughput.
    for(;;) {
    // wait for first byte of Magic Word
    for (i = 0; i < sizeof prefix; ++i) {
    // If next byte is not in Magic Word, the start over
    if (!checkIncommingData() || prefix[i] != Serial.read()) {
    i = 0;
    }
    }

    // Hi, Lo, Checksum
    if (!checkIncommingData()) continue;
    hi = Serial.read();
    if (!checkIncommingData()) continue;
    lo = Serial.read();
    if (!checkIncommingData()) continue;
    chk = Serial.read();

    // if checksum does not match go back to wait
    if (chk != (hi ^ lo ^ 0x55)) continue;

    memset(leds, 0, MAX_LEDS * sizeof(struct CRGB));
    transmissionSuccess = true;
    sum_r = 0;
    sum_g = 0;
    sum_b = 0;

    int num_leds = min ( MAX_LEDS, (hi<<8) + lo + 1 );

    // read the transmission data and set LED values
    for (int idx = 0; idx < num_leds; idx++) {
    byte r, g, b;
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    r = Serial.read();
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    g = Serial.read();
    if (!checkIncommingData()) {
    transmissionSuccess = false;
    break;
    }
    b = Serial.read();
    leds[idx].r = r;
    leds[idx].g = g;
    leds[idx].b = b;
    #if ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_AVERAGE
    sum_r += r;
    sum_g += g;
    sum_b += b;
    #endif
    }

    // shows new values
    if (transmissionSuccess) {
    endTime = millis() + OFF_TIMEOUT;
    #if MAX_LEDS > 1 || ANALOG_OUTPUT_ENABLED == false
    FastLED.show();
    #endif

    #if ANALOG_OUTPUT_ENABLED == true
    #if ANALOG_MODE == ANALOG_MODE_LAST_LED
    showAnalogRGB(leds[MAX_LEDS-1]);
    #else
    showAnalogRGB(CRGB(sum_r/MAX_LEDS, sum_g/MAX_LEDS, sum_b/MAX_LEDS));
    #endif
    #endif
    }
    }
    } // end of setup

    void loop() {
    // Not used. See note in setup() function.
    }


    Und dies ist mein hyperion.config.json:

    // Automatically generated configuration file for Hyperion ambilight daemon
    // Notice: All values are explained with comments at our wiki: wiki.hyperion-project.org (config area)
    // Generated by: HyperCon (The Hyperion deamon configuration file builder)
    // Created with HyperCon V1.03.1 (11.06.2016)

    {
    // DEVICE CONFIGURATION
    "device" :
    {
    "name" : "MyPi",
    "type" : "adalight",
    "output" : "/dev/ttyACM0",
    "rate" : 460800,
    "delayAfterConnect" : 0,
    "colorOrder" : "grb"
    },

    // COLOR CALIBRATION CONFIG
    "color" :
    {
    "channelAdjustment" :
    [
    {
    "id" : "default",
    "leds" : "*",
    "pureRed" :
    {
    "redChannel" : 255,
    "greenChannel" : 0,
    "blueChannel" : 0
    },
    "pureGreen" :
    {
    "redChannel" : 0,
    "greenChannel" : 255,
    "blueChannel" : 0
    },
    "pureBlue" :
    {
    "redChannel" : 0,
    "greenChannel" : 0,
    "blueChannel" : 255
    }
    }
    ],
    "temperature" :
    [
    {
    "id" : "default",
    "leds" : "*",
    "correctionValues" :
    {
    "red" : 255,
    "green" : 255,
    "blue" : 255
    }
    }
    ],
    "transform" :
    [
    {
    "id" : "default",
    "leds" : "*",
    "hsl" :
    {
    "saturationGain" : 1.0000,
    "luminanceGain" : 1.0000,
    "luminanceMinimum" : 0.0000
    },
    "red" :
    {
    "threshold" : 0.0000,
    "gamma" : 2.5000
    },
    "green" :
    {
    "threshold" : 0.0000,
    "gamma" : 2.5000
    },
    "blue" :
    {
    "threshold" : 0.0000,
    "gamma" : 2.5000
    }
    }
    ],
    // SMOOTHING CONFIG
    "smoothing" :
    {
    "type" : "linear",
    "time_ms" : 200,
    "updateFrequency" : 20.0000,
    "updateDelay" : 0
    }
    },

    // NO V4L2 GRABBER CONFIG
    // FRAME GRABBER CONFIG
    "framegrabber" :
    {
    "width" : 64,
    "height" : 64,
    "frequency_Hz" : 10.0,
    "priority" : 890
    },

    // BLACKBORDER CONFIG
    "blackborderdetector" :
    {
    "enable" : true,
    "threshold" : 0.01,
    "unknownFrameCnt" : 600,
    "borderFrameCnt" : 50,
    "maxInconsistentCnt" : 10,
    "blurRemoveCnt" : 1,
    "mode" : "default"
    },

    // BOOTEFFECT CONFIG
    "bootsequence" :
    {
    "color" : [0,0,0],
    "effect" : "Knight rider",
    "duration_ms" : 3000,
    "priority" : 700
    },

    // JSON SERVER CONFIG
    "jsonServer" :
    {
    "port" : 19444
    },

    // PROTO SERVER CONFIG
    "protoServer" :
    {
    "port" : 19445
    },

    // EFFECT PATH
    "effects" :
    {
    "paths" :
    [
    "/storage/hyperion/effects",
    "/usr/share/hyperion/effects"
    ]
    },

    // NO KODI CHECK CONFIG
    // NO BOBLIGHT SERVER CONFIG
    // NO JSON/PROTO FORWARD CONFIG

    // LED CONFIGURATION
    "leds" :
    [
    {
    ........
    }
    ],

    "endOfJson" : "endOfJson"
    }


    Koennt Ihr mir vielleicht sagen wass ich tun muss um dass zu machen?

    Freundlichem Gruess,

    Wim
    Automatisch zusammengefügt:

    Verzeihung, diesen Text ist nur weil ich mich nicht gut abonnniert habe auf diesem Thread.

    Einmal editiert, zuletzt von Wim (19. Juli 2017 um 20:29)

  • Hallo zusammen,

    ich habe aktuell das Problem, dass mein Deckenfluter (Apa102 LEDs) nicht mehr so richtig will. Die LEDs werden schon angesteuert aber flackern dabei immer.

    Ich vermute nun das der Node MCU die Fehlerquelle ist. Ersatz ist da, aber ich habe die alte Sofware zum aufspielen nicht mehr.

    Gibt es evtl. eine neue Software für den Node MCU? Scilor hatte da ja noch viel geplant. :thumbs1:

    Danke

    Gruß Kollektiv

    EDIT:

    Okay, ich habe gerade hier gelesen, dass es nicht weiterentwickelt wird. Oder gibt es neue Infos? Es ist schon etwas her wo ich hier aktiv war.

    https://hyperion-project.org/threads/ambili….224/#post-1635

    Einmal editiert, zuletzt von Kollektiv02 (26. September 2017 um 19:26)


  • Hy, Ich bin leider zu nicht mehr viel gekommen, neuer Job, neue Wohnung Openhab etc.

    Wegen dem Flackern.
    Prüfe mal die Spannungsquelle. Flackert es bei niedrigerer Helligkeit nicht? -> Spannungsquelle tauschen
    Ansonsten mal die anderen Kabelverbindungen prüfen. Ground richtig dran? Kabel ggbfs. einmal austauschen.
    Ggbfs. ist der Node aber auch hin.

    Letzter Stand ist im Git. Ich weiß nicht wann du deinen Node eingerichtet hattest.

  • Danke für deine Antwort. Kein Problem, dass du nicht weiter zu etwas gekommen bist. Viel Erfolg im neuen Job. :)

    Es flackert bei jeder Helligkeit. Ein anderes Netzteil hatte ich auch getestet. Ich werde mal ein anderen Node MCU testen. Da über ein Raspberry PI ein einzelner LED APA 102 Stripe nicht flackert, aber mit den Node MCU schon.

    Ich hatte meine Node MCU vor ca. 1 Jahr und 2 Monaten eingerichtet.

  • Danke für deine Antwort. Kein Problem, dass du nicht weiter zu etwas gekommen bist. Viel Erfolg im neuen Job. :)

    Es flackert bei jeder Helligkeit. Ein anderes Netzteil hatte ich auch getestet. Ich werde mal ein anderen Node MCU testen. Da über ein Raspberry PI ein einzelner LED APA 102 Stripe nicht flackert, aber mit den Node MCU schon.

    Ich hatte meine Node MCU vor ca. 1 Jahr und 2 Monaten eingerichtet.

    Leider bekomme ich keine Mails mehr bei neuen Antworten :(

    Ich habe mal eine Runderneuerung gemacht:

    • multi-client JSON server
    • more complete JSON serverinfo
    • NeoPixelBus library for clockless strips
    • WebOTA

    https://github.com/adn77/ESP8266_…er/tree/develop

    Ich hoffe auf SciLors "Segen" ;)

    Danke für die Ideen. Leider kann ich das so nicht übernehmen.

    Beispielsweise darf die ConfigStatic.h nicht eingecheckt werden, sonst passiert es ganz schnell, dass dort die eigenen Einstellungen landen. Außerdem sind dort dann ggbfs. Dinge drin die ein Enduser nicht interessieren oder das ganze System unsicher machen.

    Die Compiler Ifs würde ich dort ganz rausnehmen, da es eine Konfiguration sein soll. Auskommentieren ist da sinnvoller, bzw. tuhen die Einstellungen im Zweifel auch nicht weh.

    Mit meiner alten OTA-Funktion war es möglich über die Arduino IDE zu Updaten. Deine WebOTA macht etwas anderes. Diese würde ich auch nur aktivieren, wenn HTTPS genutzt wird. Sonst ist schnell der Fall, dass jemand sich dazwischen hängt und Malware einschleußt.

    Das "min" Makro hatte ich eingebaut um den Code lesbarer zu gestallten. Der Inline IF gefällt mir überhaupt nicht. Die vorausberechneten Werte beim Farbrad hatten Performancegründe. Ggbfs. die Berechnung als Kommentar dahinter.

    Der Rest sieht super aus, ggbfs. muss ich noch ein paar Kleinigkeiten an meinen Codestil anpassen und Auslagern.

    Was mir noch auffält, ist dass der ESP8266 ziemlich in die Knie geht, wenn er von Hyperion "beschossen" wird und der WebServer ziemlich lahmt.

    Mir fehlt leider einfach die Zeit :(

  • Hallo liebe Forum Gemeinde,

    Könnte mit jemand Schritt für Schritt erklären wie ich meine 6803 Led Streifen mit dem NodeMcu und ESP8266_Hyperion_LED-Controller

    zu laufen bekomme?

    Mein Funkcontroller für die LED Streifen hat sein Dienst leider quittiert.

    Ich habe nicht viel Erfahrung, aber ein wenig technisches Verständnis.

    Hyperion habe ich auf meinem Pi3 bereits installiert und bei dem ESP8266_Hyperion_LED-Controller Sketch weis ich nicht weiter.

    Danke für jede Hilfe!

  • Ein paar mehr Informationen bräuchten wir schon...

  • Hallo allseits,

    habe -mit relativ wenig Erfahrung- versucht, dasTutorial nachzuvollziehen.

    Bei der Prüfung des Sketch bekomme ich nun eine Fehlermeldung:

    ... \Sketches\libraries\Arduino-logging/Logging.h:12:22: fatal error: pgmspace.h: No such file or directory

    #include <pgmspace.h>

    Nun bin ich mit meinem Latein am Ende.

    Kann jemand helfen?

    Was ist zu tun?

    Danke!

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!