SparkFun-DMX to LED-Shield mit ESP32-Thing-Plus-C

Hallo.
Dies ist mein erster Beitrag. Feedback willkommen :grinning:

Ich hab ein Problem beim Empfangen/Verarbeiten eines DMX-Signals mit der genannter Hardware.
Mit meinem jetzigen Sketch, welcher auf das Input-example des SparkFunDMX-Library basiert.

/*
  Reads DMX data from channel 1
  
  By: Dryw Wade
  SparkFun Electronics
  Date: 10/3/2023
  License: GNU. See license file for more information but you can
  basically do whatever you want with this code.
  This example runs two servos and a number of LED's off of 5 DMX channels
  
  Feel like supporting open source hardware?
  Buy a board from SparkFun! https://www.sparkfun.com/products/15110
  
  Hardware Connections:
  Connect a Thing Plus board to the SparkFun DMX Shield, and connect a DMX XLR-3
  cable between the shield and another device that inputs DMX data. You can use
  a second board and shield running Example 1!
*/

// Inlcude DMX library
#include <SparkFunDMX.h>
// Inlcude FastLED library
#include <FastLED.h>

// Create DMX object
SparkFunDMX dmx;

// Create serial port to be used for DMX interface. Exact implementation depends
// on platform, this example is for the ESP32
HardwareSerial dmxSerial(1);

// Enable pin for DMX shield (Free pin on Thing Plus or Feather pinout)
uint8_t enPin = 4;

// Number of DMX channels, can be up to 512
//ex uint16_t numChannels = 3;
//Channel Definitions
//#define TOTAL_CHANNELS 3
uint16_t TOTAL_CHANNELS = 3;

#define HUE_CHANNEL 1
//#define SATURATION_CHANNEL 2
//#define VALUE_CHANNEL 3

//Fixture Hardware Definitions
// How many leds in your strip? Uncomment the corresponding line
#define NUM_LEDS 20 //1 Inch

// The LuMini rings need two data pins connected
#define DATA_PIN 19
#define CLOCK_PIN 18

// Define the array of leds
CRGB ring[NUM_LEDS];


void setup()
{
    Serial.begin(115200);
    Serial.println("initialzed...");

    // Begin DMX serial port
    dmxSerial.begin(DMX_BAUD, DMX_FORMAT);

    // Begin DMX driver
    dmx.begin(dmxSerial, enPin, TOTAL_CHANNELS);

    // Set communicaiton direction, which can be changed on the fly as needed
    dmx.setComDir(DMX_READ_DIR);

    Serial.println("DMX initialized!");

  // Begin LED driver
  LEDS.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR>(ring, NUM_LEDS);
  LEDS.setBrightness(32); //LEDs dimmed for testing purposes
}


void loop()
{

  dmx.update();
  
    // Wait until dmx-data has been received
    while(dmx.dataAvailable() == false)
    {
        // Must call update() to actually check for received data
        dmx.update();
    }

    // Data has been received, read out channels
    uint8_t hue = dmx.readByte(HUE_CHANNEL);
  //uint8_t saturation = dmx.readByte(SATURATION_CHANNEL);
  //uint8_t value = dmx.readByte(VALUE_CHANNEL);

    if(hue > 0 ){    //without this if-condition most readings are = 0 resulting in wrong hue on LED-ring
    Serial.print("DMX: read value from hue channel: ");
    Serial.println(hue);

  for (int led = 0; led < NUM_LEDS; led++)
  {
    //ring[led] = CHSV(hue, saturation, value);
    ring[led] = CHSV(hue, 255, 255); //saturation and value set to 255 just for testing
  }
  FastLED.show();

   }

}

Ein eingehendes Signal ĂŒber DMX Kanal 1 (Ă€ndernde Werte 0-255) kommt an, aber die meiste Zeit wird der Wert als 0 interpretiert. Siehe Serial:

Der Wert soll im genannten Sketch die Farbe(=hue) eines LED-Rings verÀndern. Dies gelingt nur annÀhernd, wenn ich behelfmÀssig ein if(hue!=0) -Bedingung stelle. Siehe Serial:

Leider leidet dabei die Reaktionsgeschwindigkeit der FarbÀnderung: vermutlich weil halt nach wie vor die meisten Werte als 0 gelesen werden.

Sieht jemensch, wo die Ursache liegen könnte?
Vielen Dank!

about

Libraries:
SparkfunDMX v2.0.1
https://github.com/sparkfun/SparkFunDMX
FastLED v3.6.0
https://github.com/FastLED/FastLED

SparkFun-DMX to LED-Shield
https://learn.sparkfun.com/tutorials/sparkfun-esp32-dmx-to-led-shield/all

Sparkfun Thing Plus ESP32 Wroom USB-C
https://learn.sparkfun.com/tutorials/esp32-thing-plus-usb-c-hookup-guide?_gl=154k98a_gaMjExODgzMDY1Ni4xNzA2MDI2NDUz_ga_T369JS7J9N*MTcwOTg5NTQ1Mi4xNS4xLjE3MDk4OTU1NDQuMzcuMC4w&_ga=2.268942390.611241178.1709895454-2118830656.1706026453

Das hier ist das unverÀnderte DMX-Input Sketch der Library.

Hier passiert mir dasselbe:
Die meisten Lesungen = 0.

/*
  Reads DMX data from channel 1
  
  By: Dryw Wade
  SparkFun Electronics
  Date: 10/3/2023
  License: GNU. See license file for more information but you can
  basically do whatever you want with this code.
  This example runs two servos and a number of LED's off of 5 DMX channels
  
  Feel like supporting open source hardware?
  Buy a board from SparkFun! https://www.sparkfun.com/products/15110
  
  Hardware Connections:
  Connect a Thing Plus board to the SparkFun DMX Shield, and connect a DMX XLR-3
  cable between the shield and another device that inputs DMX data. You can use
  a second board and shield running Example 1!
*/

// Inlcude DMX library
#include <SparkFunDMX.h>

// Create DMX object
SparkFunDMX dmx;

// Create serial port to be used for DMX interface. Exact implementation depends
// on platform, this example is for the ESP32
HardwareSerial dmxSerial(2);

// Enable pin for DMX shield (Free pin on Thing Plus or Feather pinout)
uint8_t enPin = 4;

// Number of DMX channels, can be up tp 512
uint16_t numChannels = 1;

void setup()
{
    Serial.begin(115200);
    Serial.println("SparkFun DMX Example 2 - Input");

    // Begin DMX serial port
    dmxSerial.begin(DMX_BAUD, DMX_FORMAT);

    // Begin DMX driver
    dmx.begin(dmxSerial, enPin, numChannels);

    // Set communicaiton direction, which can be changed on the fly as needed
    dmx.setComDir(DMX_READ_DIR);

    Serial.println("DMX initialized!");
}

void loop()
{
    // Wait until data has been received
    while(dmx.dataAvailable() == false)
    {
        // Must called update() to actually check for received data
        dmx.update();
    }

    // Data has been received, read out channel 1
    uint8_t data = dmx.readByte(1);
    
    Serial.print("DMX: read value from channel 1: ");
    Serial.println(data);
}

Es gibt eine Github Diskussion, wo offenbar dasselbe Problem besteht.
Dort wird meines Wissens eine Lösung gefunden durch Anpassungen der Library, welche in aktueller Library Version implementiert wurden.
Siehe:https://github.com//sparkfun/SparkFunDmx/issues/10

Trotzdem klappt bei meinem Setup noch nicht. hmmm:
Falls jemand eine andere Herangehensweise empfehlen kann, möglichst mit der gleichen Hardware zum Steuern von APA102 LEDs, bin ich auch froh um Hinweise.

Danke!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.