FantomXR Posted November 5, 2019 Report Share Posted November 5, 2019 Hey people, Maybe you can guide me in the right direction. In my projects I use buttons with integrated LEDs. But I want to get away from the standard HC595. Mainly because it takes a lot of PCB space and it has a lot traces due to the SPI protocol. Is there another style to control those LEDs? I also work a lot with WS2812. This is great because there is only one single data line from one to the next. Thanks, Chris Quote Link to comment Share on other sites More sharing options...
latigid on Posted November 5, 2019 Report Share Posted November 5, 2019 I think you need to define your parameters. How many LEDs? How many spare I/O or GPIO can you use? Does an LED matrix with multiplexing go far enough? Quote Link to comment Share on other sites More sharing options...
Antichambre Posted November 6, 2019 Report Share Posted November 6, 2019 On 05/11/2019 at 10:12 AM, FantomXR said: In my projects I use buttons with integrated LEDs. 13 hours ago, latigid on said: Does an LED matrix with multiplexing go far enough? Yep BLM! Multiplexing will limit the number of 595/165. Quote Link to comment Share on other sites More sharing options...
FantomXR Posted November 25, 2019 Author Report Share Posted November 25, 2019 Alright... I've got a solution that works great for me. I thought I share it with you. I now tried WS2811 driver ICs. They are cheap and only need one data-line which goes from one IC to the next. Each IC can drive three LEDs. Of course you are not really capable to control them individually with standard NG code. So I've added a meta command. Add this to mbng_event.c (row 2968 and following): case MBNG_EVENT_META_TYPE_RGB_LED_SET_SINGLE: return "RgbLedSetSingle"; row 3055 and following: if( strcasecmp(meta_type, "RgbLedSetSingle") == 0 ) return MBNG_EVENT_META_TYPE_RGB_LED_SET_SINGLE; row 3142 and following: case MBNG_EVENT_META_TYPE_RGB_LED_SET_SINGLE: return 3; row 3376 and following: case MBNG_EVENT_META_TYPE_RGB_LED_SET_SINGLE: { u16 led; if( (led=meta_values[0]) ) { led -= 1; WS2812_LED_SetRGB(led, meta_values[1], meta_values[2]); } } break; in mbng_event.h add this line 163 and following: MBNG_EVENT_META_TYPE_RGB_LED_SET_SINGLE, Done! Now you can call the meta RGBLEDSETSINGLE from NG. Here is a quick example. I had no buttons connected to that midibox. So I've worked with receivers and senders: EVENT_RECEIVER id=1 type=cc cc=2 if_equal=127 fwd_id=SENDER:1 EVENT_RECEIVER id=1 type=cc cc=2 if_equal=0 fwd_id=SENDER:2 EVENT_SENDER id=1 type=meta meta=rgbledsetsingle:1:1:255 EVENT_SENDER id=2 type=meta meta=rgbledsetsingle:1:1:0 This switches on the second LED of the first IC on if CC2 with a value of 127 is received. It switches off when 0 is received. So you can control each LED individually without overwriting the other :-) Quote Link to comment Share on other sites More sharing options...
latigid on Posted November 25, 2019 Report Share Posted November 25, 2019 Interesting solution! Do you use the tiny ICs or SOIC ones? Did you use a power supply resistor for each? The bonus with WS2811s is you can get better dimming effects than with SRIO scan (and dimming is practically unusable in a matrix). Quote Link to comment Share on other sites More sharing options...
FantomXR Posted November 25, 2019 Author Report Share Posted November 25, 2019 They are SO8. So easy to solder. I followed the design guideline from the official datasheet. I think it's 100R on the 5V rail. Can post it later. Quote Link to comment Share on other sites More sharing options...
Antichambre Posted November 25, 2019 Report Share Posted November 25, 2019 Can be interesting to see if we can combine/sync this chip with SRIO(HC595) to get matrix with dimming, without to much ghost artefact. Quote Link to comment Share on other sites More sharing options...
latigid on Posted November 25, 2019 Report Share Posted November 25, 2019 Just now, Antichambre said: Can be interesting to see if we can combine/sync this chip with SRIO(HC595) to get matrix with dimming, without to much ghost artefact. Tried it! The LEDs flicker/pulse rather than dimming as the PWM/clock rates are not syncronised... Quote Link to comment Share on other sites More sharing options...
Antichambre Posted November 25, 2019 Report Share Posted November 25, 2019 Just now, latigid on said: Tried it! The LEDs flicker/pulse rather than dimming as the PWM/clock rates are not syncronised... Ah ah! I'm not surprised you did it, thanks ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.