Skip to content

Timing problems with Library 1.0.1 #2

Description

@Jo-Achim

Hello,

after my experiments a BOOSTER_CMD_DELAY 500 doesn't work fine in my environment!
I need a minimum of 660 (instead of 500)!

Test with the following Arduino-Sketch and the original DDBooster-library, Version 1.0.1, ...

// Digi-Dot-Booster - Timing issue.
// ===================================
// Problem: without additional µs-delays some commands like "booster.clearAll()", "booster.setAll()", ... 
//          are not working as expected.
//          If the multiplier (see 'booster_Delay' below) is less enough, round about 50% of an 60 LEDs-Stripe 
//          has the same colour - instead of 100%.
//          The 'middle' LED and / or the first LED in the Stripe has a (another) wrong colour or lights up after 
//          'booster.clearAll()'.
//
// 
// Test conditions:
// ----------------
// Arduino-IDE: 1.8.2
// Arduino MiniPro with 16 MHz crystal.
// LED-Stripe, 60 LEDs with WS2812B-controller.
// Digi-Dot-Booster, library 1.0.1,
//   connected like http://www.led-genial.de/mediafiles//Sonstiges/digi-dot-booster_ENG.pdf page 3 and option 2.
//


#include <DDBooster.h>                          // Library 1.0.1

  DDBooster booster;
  const byte DDBsCS_Pin = 10;                   // Digi-Dot-Booster CS               
  const byte DDBsReset_Pin = 4;                 // Arduino-Reset-Output
  const byte LEDs_count = 59;                   // Stripe of 60 LEDs.

//  Vary with different multipliers. In most cases a multiplier = 3 is needed as minimum => 60 * 3 = 180 µs delay:
  const int booster_Delay = LEDs_count * 0;     // <- multiplier
//  Test too: restart the sketch multiple times with the same multiplier. Possible: the multiplier may need to be increased.


void setup() {
  booster.configurePins(DDBsCS_Pin, DDBsReset_Pin);
  booster.reset();                              // Digi-Dot-Booster reset
  booster.init(LEDs_count);                     //   and init
  ClearAllLEDs();                               // LEDs off
}


void loop() {
  SetLEDs(0, 0, 40);                            // Colour: white
  SetLEDs(0, 240, 40);                          // Colour: red 
  SetLEDs(60, 255, 40);                         // Colour: yellow 
  SetLEDs(120, 240, 40);                        // Colour: green 
  SetLEDs(240, 240, 40);                        // Colour: blue 
  ClearAllLEDs();                               // LEDs off
}


void SetLEDs(int H, int S, int V) {             // Set all LEDs to the same colour...
  booster.setHSV(H, S, V);                      // Colours
  booster.setAll();                             // all LEDs
  delayMicroseconds(booster_Delay);             // needed! Otherwise not all LEDs are set to the correct colour
  booster.show();
  delay(1000);
}


void ClearAllLEDs() {                           // switch off all LEDs...
  booster.clearAll();                           // all LEDs must be off
  delayMicroseconds(booster_Delay);             // needed! (Restart the sketch, some LEDs continue to light up when on before)
  booster.show();
  delay(2000);
}

I think, there are two possible solutions (for "DDBooster.cpp"):

  1. Solution:
    Change "#define BOOSTER_CMD_DELAY 500" to an experimented minimum of 660, like:
    #define BOOSTER_CMD_DELAY 660
    Finished.

  2. better Solution:
    Change "#define BOOSTER_CMD_DELAY 500" to a basic value of 20, like:
    #define BOOSTER_CMD_DELAY 20
    and add
    #define BOOSTER_CMD_DELAY_PER_LED 11
    than change in "void DDBooster::sendData(uint8_t *buffer, uint8_t length)" the line from
    "delayMicroseconds(BOOSTER_CMD_DELAY);"
    to
    delayMicroseconds(BOOSTER_CMD_DELAY + ((_lastIndex + 1) * BOOSTER_CMD_DELAY_PER_LED));
    Finished.

Both solutions were tested with the sketch above and a 60 LED-Stripe (WS2812B) with 2 to 60 LEDs; see "LEDs_count".
For the security of solution 1, "BOOSTER_CMD_DELAY 750" might be more useful.
In Solution 2, the values may be: "BOOSTER_CMD_DELAY 25" and "BOOSTER_CMD_DELAY_PER_LED 15".

Best regards, Joachim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions