element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Light Up Your Life
  • Challenges & Projects
  • Design Challenges
  • Light Up Your Life
  • More
  • Cancel
Light Up Your Life
Forum Misaz’s WL-ICLED experiments: Combining LEDs of multiple types
  • News
  • Forum
  • Projects
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join Light Up Your Life to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 50 subscribers
  • Views 19 views
  • Users 0 members are here
  • 48-bit led data
  • design challenge
  • 24-bit led data
  • led
  • rgb
  • timing
Related

Misaz’s WL-ICLED experiments: Combining LEDs of multiple types

misaz
misaz 8 hours ago

Hello. I welcome you to forum post describing my next experiment with Würth Elektronik WL-ICLEDs. In this forum post I will look at opportunity to combine 24-bit and 48-bit LEDs on single chain. It can be quite useful if you work on project which has several types of LED like some LED matrix and diagnostic LEDs. In such project it makes sense to make LED matrix from more advanced 48-bit LEDs (Würth number 1312121320437) while diagnostics RGB LEDs can be just simple classic 24-bit LEDs (Würth number 1315050930002). Normally you would need to control two buses, but if you read datasheets carefully, you notice that timing of the signal is almost the same. Just amount of data transferred per LED and data encoding differs. For classic LEDs (like 1315050930002), the timing requirements for signalling are:

Data signal timing of 1315050930002 LEDs

For 48-bit LEDs like 1312121320437, signalling requirements are:

Data signal timing of 1312121320437 LEDs

They use different unit, so it may look confusing at the first look, but actually times are very similar. Actually, it is not possible to find any single value, which satisfies all minimum and maximum when implementing using SPI peripheral. But class 24-bit LEDs are much more tolerant. I stick to following typical values for 48-bit LEDs and slightly violate 24-bit signalling because they are more tolerant. In practice, it works.

I experimentally tested it by simple “snake”. It works. Let’s see:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

On video above, I have two PCBs with different LEDs. Left one is PCB with 48-bit LEDs. Right, one is PCB with 24-bit LEDs. On my PCB for 48-bit LEDs I exposed DOUT signal from last LED. This I interconnected on breadboard to DIN of next PCB. It does not need to be in this order necessarily, but on my older PCB for classic LED I did not expose DOUT from last LED. You can also switch between types of LED as many times as you want. You will just need write them in firmware properly.

Little bit more complicated it is on firmware side. But since I make my own library, it is manageable. If you remember my second forum post Testing BI pin, I designed my library in a way that I have following functions:

void LEDS_Init();
void LEDS_SetLed24(size_t index, uint8_t r, uint8_t g, uint8_t b);
void LEDS_SetLed48(size_t index, uint8_t rI, uint16_t rPWM, uint8_t gI, uint16_t gPWM, uint8_t bI, uint16_t bPWM);
void LEDS_Transmit(); 

Important part is to properly maintain indexing and take in account that every 48-bit takes 2 slots in internal buffer. Firmware for moving green on video look as follows:

int main(void) {
    cy_rslt_t result;

    result = cybsp_init();
    CY_ASSERT(result == CY_RSLT_SUCCESS);

    __enable_irq();
    cyhal_system_delay_ms(100);
    LEDS_Init();

    int led = 0;
    while (1) {
        int iGain = 1;
        LEDS_SetLed48(0, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed48(2, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed48(4, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed48(6, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed48(8, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed48(10, iGain, 0, iGain, 0, iGain, 0);
        LEDS_SetLed24(12, 0, 0, 0);
        LEDS_SetLed24(13, 0, 0, 0);
        LEDS_SetLed24(14, 0, 0, 0);
        LEDS_SetLed24(15, 0, 0, 0);

        if (led < 6) {
            LEDS_SetLed48(led * 2, iGain, 0, iGain, 255, iGain, 0);
        } else {
            LEDS_SetLed24(led + 6, 0, 15, 0);
        }

        LEDS_Transmit();
        cyhal_system_delay_ms(100);

        led++;
        if (led >= 10) {
            led = 0;
        }
    }
}

At the beginning there is some system initialization. Led variable is counter holding index to active LED. But it is physical index, it does not worry about underlaying LED type. In every iteration of infinite loop, I reset all LEDs to zero. First, I reset 48-bit LEDs first because they are first in chain. I need to increment index by two for every LED because 48-bit LEDs occupies 2 slots. Then I reset 24-bit LEDs. In this case index increment by one. After turning all off, I enable one depending on counter value. If the value is less than 6, I enable some of first 48-bit LEDs. Again, I need to index them with taking into account that they occupy two slots, so physical led index is actually multiplied twice. In case of later 24-bit LEDs, I need to index them with offset. They start at position 12, but because there is additional 6 “unwanted” entries before that, 12 – 6 is 6 and this is offset which I add to led index counter passed to LEDS_SetLed24. Finally, after buffer is setup, I send the new data to strip suing LEDS_Transmit() and then there is just some delay for defining speed of animation and incrementation of physical led counter.

Note that it works even 2 LEDs in 48-bit part of chain are missing. How is that possible I descibred in previous forum post: Testing BI pin

Conclusion

That’s it. Outcome is that combining different types of LED on single bus is possible and works. It was not that hard, because I already prepared library with keeping this use case in mind. Next time I will look to final piece I need before I move to making final project.

  • Sign in to reply
  • Cancel
  • obones
    obones 22 minutes ago

    Nice work there.
    Would you care to share the reasoning that led you to write your own library instead of using, say FastLED or NeoPixel library?
    Is it because they do not support your development environment?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube