Skip to content

WS2812b Mini V3 - Unusual timing... #2132

Closed

Description

@TPPTim

Hey together,

in my project I am using WS2812b mini V3 LEDs. I spent a lot of time trying to find out why the LEDs would not light up. After taking measurements and reading the datasheets, I discovered that the WS2812B Mini V3 LED has unusual timing for T1L.

Image

I was unable to find an LED type included in FastLED that shares the same timings. Defining FASTLED_WS2812_T3, FASTLED_WS2812_T2 or FASTLED_WS2812_T1 only changes the high time.

Can someone help me get this LED type to work with FastLED?

Thank you! <3

Activity

  1. zackees commented on Nov 5, 2025

    @zackees
    Member

    Try this:

        T1 = 220,
        T2 = 360,
        T3 = 580,
        RESET = 280us
    

    That chip you have is very long in the reset time.

    So after FastLED.show()
    delay(1); // 1000us is plenty for the reset

  2. zackees commented on Nov 5, 2025

    @zackees
    Member

    I just added this led timing to fastled. Download latest from this repo and declare your led strip like so:

    FastLED.addLeds<WS2812BMiniV3, DATA_PIN, GRB>(leds, NUM_LEDS);

    Also fyi, this is identical to the new WS2812B-V5 chipset

  3. added a commit that references this issue on Nov 5, 2025
  4. TPPTim commented on Nov 5, 2025

    @TPPTim
    Author

    Hey @zackees,
    Thank you so much for this incredibly fast fix! I used the latest version and selected the 'WS2812BMiniV3' option.
    However, after compiling, the LED is still dark. I measured the signal using an oscilloscope.
    The T1L is 560ns for me. Unfortunately, this is still too short a time, but it is really close to the lower border.

    Could you tell me which line I need to change, or could you possibly increase the value again?

    Thank you!

  5. zackees commented on Nov 5, 2025

    @zackees
    Member

    Sounds like F_CPU is set wrong. This is what FastLED uses to calculate the number of ticks -> nanoseconds in it's tight timing.

    What device are you using?

  6. TPPTim commented on Nov 5, 2025

    @TPPTim
    Author

    Hey,
    I am using an Arduino Nano v3 with Arduino bootloader in Visual Studio Code PlatformIO.

    Is there something I have to change?

    Regards
    Tim

  7. zackees commented on Nov 5, 2025

    @zackees
    Member

    I think you're at 8mhz clock rate and the device thinks it's at 16mhz.

    YOu are hitting at 560ns right?

    220 x 2 = 440n + 1 extra cycle at a 120 ns, bringing you to 560ns.

    Try this
    https://chatgpt.com/s/t_690be0cc860881919f9a3b5d7cbf9a2a

  8. TPPTim commented on Nov 6, 2025

    @TPPTim
    Author

    Thank you very much for your suggestions. It must be something else.
    I am running the serial connection at 115200 baud for my code, and it is working fine. I also printed the test code that you mentioned from ChatGPT, and it gave me F_CPU = 16000000 @ 115200 baud.
    If there were an issue with the F_CPU, all the pulses would be half as slow, but they aren't.

    These are the measurements timings I took:
    Image

    This is the measurement:
    Image

    I have also some DS18B20 temperatur sensors connected and some DHT22 humidity and temperatur sensors and the communication is working well.

    This is very strange for me...

  9. TPPTim commented on Nov 7, 2025

    @TPPTim
    Author

    @zackees, can you propably change the value in the code a little, that the timing will get increased by 100ns for T1L?

    Best Regards

  10. reopened this on Nov 9, 2025
  11. zackees commented on Nov 9, 2025

    @zackees
    Member

    I added macros for the timing. Can you please test this out.

    #define FASTLED_WS2812B_V5_T1 220  // status quo today
    #define FASTLED_WS2812B_V5_T2 360
    #define FASTLED_WS2812B_V5_T3 580
    #include "FastLED.h"

    I'm looking into your picture

  12. TPPTim commented on Nov 9, 2025

    @TPPTim
    Author

    Hey,
    Thank you very much for investigating further!
    I downloaded your latest code changes and implemented them in my project. However, after compiling and flashing, the LED is still off. I got the following timings:

    T0H = 264 ns
    T0L = 950 ns
    T1H = 616 ns.
    T1L = 568 ns.

    It's close, but still too slow.

    I will be travelling for one week. After that, I will change your values to see how it works. I will come back to this topic.

    Could you explain how T1, T2 and T3 work? How do you calculate the expected timings?

    Thank you.
    Tim

  13. zackees commented on Nov 10, 2025

    @zackees
    Member

    i didn't mean to close the bug

  14. zackees commented on Nov 10, 2025

    @zackees
    Member

    Briefly speaking, these datasheet timings are asymettric. However all LED chipsets use symmetric timings where no matter what the bit is, (0 or 1) we end at the same time. Because of this symmetry it can be described in a more compact form called three phase symmetric timings which is what T1, T2, T3 represent.

      Protocol Timing:
      At T=0        : Line goes HIGH (start of bit)
      At T=T1       : Line goes LOW (for '0' bit)
      At T=T1+T2    : Line goes LOW (for '1' bit)
      At T=T1+T2+T3 : Cycle complete (ready for next bit)
    

    Here's a calculator:

    led_timing_conversions.py

    Here's an AI writeup describing this in more detail

    LED Chipset Timing Formats: Datasheet vs 3-Phase
    
      Overview
    
      FastLED uses two different timing representations for addressable LED
      chipsets (like WS2812B, SK6812, APA102, etc.):
    
      1. Datasheet Format (T0H, T0L, T1H, T1L) - Standard LED manufacturer
      specification
      2. 3-Phase Format (T1, T2, T3) - FastLED's internal representation for
      efficient bit-banging
    
      Datasheet Format (T0H, T0L, T1H, T1L)
    
      This is how LED manufacturers specify timing in their datasheets. Each bit
       transmission consists of a HIGH pulse followed by a LOW pulse.
    
      Timing Parameters:
      - T0H: Time HIGH when sending a '0' bit (nanoseconds)
      - T0L: Time LOW when sending a '0' bit (nanoseconds)
      - T1H: Time HIGH when sending a '1' bit (nanoseconds)
      - T1L: Time LOW when sending a '1' bit (nanoseconds)
    
      Waveforms:
      '0' bit:  ___________
               |     T0H    |       T0L
               HIGH─────────LOW──────────
    
      '1' bit:  _____________________
               |        T1H         | T1L
               HIGH────────────────LOW──
    
      Example (WS2812B):
      - T0H = 400ns (short high pulse for '0')
      - T0L = 850ns (long low pulse for '0')
      - T1H = 850ns (long high pulse for '1')
      - T1L = 400ns (short low pulse for '1')
      - Total cycle: 1250ns (both '0' and '1' bits)
    
      3-Phase Format (T1, T2, T3)
    
      FastLED's optimized representation reduces redundancy by recognizing that
      both bits start HIGH and the difference is just when the line drops LOW.
    
      Timing Parameters:
      - T1: High time for '0' bit (shortest high pulse)
      - T2: Additional high time for '1' bit (extension beyond T1)
      - T3: Low tail duration (low time after '1' bit drops)
    
      Protocol Timing:
      At T=0        : Line goes HIGH (start of bit)
      At T=T1       : Line goes LOW (for '0' bit)
      At T=T1+T2    : Line goes LOW (for '1' bit)
      At T=T1+T2+T3 : Cycle complete (ready for next bit)
    
      Waveforms:
      '0' bit:  _____
               | T1  |    T2    |  T3
               HIGH──LOW─────────────────
    
      '1' bit:  ______________
               |  T1  |  T2   |  T3
               HIGH──────────LOW─────────
    
      Same Example (WS2812B in 3-Phase):
      - T1 = 400ns (high time for '0')
      - T2 = 450ns (additional high time for '1': 850ns - 400ns)
      - T3 = 400ns (tail time after '1' drops)
      - Total cycle: 1250ns
    
      Conversion Algorithm
    
      Datasheet → 3-Phase
    
      duration = max(T0H + T0L, T1H + T1L)
      T1 = T0H              # High time for '0' bit
      T2 = T1H - T0H        # Additional time for '1' bit
      T3 = duration - T1H   # Tail time after '1' bit drops
    
      Key insight: T1 is the transition point that distinguishes '0' from '1'.
    
      3-Phase → Datasheet
    
      This conversion is underdetermined (3 inputs → 4 outputs). The code
      assumes symmetric cycle times:
    
      duration = T1 + T2 + T3
      T0H = T1
      T1H = T1 + T2
      T0L = duration - T0H  # Assumes T0H+T0L = duration
      T1L = duration - T1H  # Assumes T1H+T1L = duration
    
      Why 3-Phase Format?
    
      Advantages:
      1. Reduces redundancy - Both bits start HIGH, only transition timing
      differs
      2. Simpler state machine - Three distinct phases instead of four separate
      timings
      3. Better CPU efficiency - Easier to implement in bit-banging code
      4. More intuitive - Directly maps to hardware timer comparisons
    
      Used in: src/fl/chipsets/led_timing.h for FastLED's internal chipset
      definitions
    
      Practical Example
    
      WS2812B V5 Override (from recent work):
      // Datasheet: T0H=300ns, T0L=790ns, T1H=790ns, T1L=300ns
      // Converts to:
      T1 = 300   // '0' bit high time
      T2 = 490   // Additional '1' bit high time (790-300)
      T3 = 300   // Tail low time
    
      This format allows hardware implementations (RMT, PIO, SPI) to efficiently
       generate the correct waveforms with minimal CPU overhead.
    
    
  15. zackees commented on Nov 10, 2025

    @zackees
    Member

    Should be fixed now, final timings are:

    T1=225, T2=355, T3=645

    T0H: 225ns (high time for '0' bit)
    T0L: 1000ns (low time for '0' bit)
    T1H: 580ns (high time for '1' bit)
    T1L: 645ns (low time for '1' bit)

  16. TPPTim commented on Nov 10, 2025

    @TPPTim
    Author

    Thank you!
    I will come back here after my vacation.

    Best regards

  17. TPPTim commented on Nov 19, 2025

    @TPPTim
    Author

    Hello @zackees,

    now I tested your changes and measured again, because the LED is still off.

    Here you can see T0H:
    Image

    Here you can see T0L (close to the T0L max time [1µs]):
    Image

    Here you can see T1H:
    Image

    Here you can see T1L:
    Image

    This is the whole signal:
    Image

    I send it for testing every 50ms:
    Image

    Everything should be correct now. I don´t understand what is wrong.
    For this reason I ordered another WS2812B-mini-V3 from LCSC. The last I bought from aliexpress. Probably they send different LED type, I don´t know. When I received the LEDs I test again and come back.

    Or did I missed something important in the pictures?

    Regards
    Tim

  18. zackees commented on Nov 20, 2025

    @zackees
    Member

    We have an over/under clocking feature where you can try to bend the signal wave into tighter compliance, worth giving it a shot:

    #define FASTLED_OVERCLOCK 1.2  // 20% overclock
    #define FASTLED_OVERCLOCK 0.9  // 10% underclock
    #include "FastLED.h"
  19. TPPTim commented on Dec 5, 2025

    @TPPTim
    Author

    Hello Zackees,

    The new LEDs have arrived from LCSC, and I have soldered them to my test board.
    It wasn't necessary to use the overclock feature. The LED is working now! That means that the LEDs I had before were not original Mini-V3s and that the software timing was not correct.

    So finally, I can thank you very much for your support and for helping me with the code!

    Regards, Tim

  20. zackees commented on Dec 7, 2025

    @zackees
    Member

    That's great to hear! Glad everything works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions