News:

SMF - Just Installed!

Main Menu

RGB stomp switch led

Started by Blookeynose, January 03, 2023, 07:23:13 AM

Previous topic - Next topic

Blookeynose

I recently got my hands on this project and had an idea but am struggling to figure out whether it's possible. I want to add led rings to the footswitches however I thought it would be cool if the led color could match the pedals color on screen. I found these ws2812B rings on Amazon https://a.co/d/hIDGDw3.

From the research I've done, I'm pretty certain I can grab 5v power and ground from the barrel jack and also give reference ground using the open GPIO header on the pi-stomp board. My issue is with which GPIO header to attach the D0 pin from the lights to. All tutorials I've found use GPIO 18 which is PWM0 but I noticed GPIO 13 is open which is PWM1.

If this will work electrically I have more faith in myself to figure out the code end of things.

Thanks for any help!

Randall (Admin)

Yes, it is possible to use WS28xx addressable LED's with pi-Stomp.  In fact, I just added support code for that recently and it will do exactly what you suggested, the color of an assigned footswitch would match the plugin category color.  Change to a pedalboard with different footswitch assignments and the color changes too, cool right?

To power WS28xx LED's, you'll almost for sure need 5v.  That's not available on the header, but if you avoided putting a C5 in place (as the instructions suggested), the round pad of C5 is +5v.

As you discovered, you'll also need a GPIO pin with PWM.  GPIO13 (pin33) is the one free GPIO on pi-stomp that has PWM support.  Fortunately, you only need just that one GPIO to control a whole string of WS28xx LED's.

The software support hasn't been merged to mainline yet.  To use the staging branch, stop and move aside your current pi-stomp install:
ps-stop
cd ~
mv pi-stomp pi-stomp0
git clone -b v2.1.1-staging https://github.com/TreeFallSound/pi-stomp.git

Edit ~/pi-stomp/pistomp/default_config.yml and replace “gpio_output" with ‘ledstrip_position” and give it the number of the pixel in your ledstrip (0 for the first, 1 for the second, etc.)

ps-restart


doug

Hi,

This sounds like an awesome addition - I'd be keen to add some spare ws2812 that I have to my pedal build.

Please can you let us know the timeline for integrating this and the next release?

Regards,
Doug

Randall (Admin)

Cannot say exactly.   Some bug fixes and minor features like this in the queue, so probably by April.  I'll try to remember to post back on this tread about it.

bigbluecoconut

Hi, did you include it in the new build?
I wanted to use some ws2812 to light up my buttons, but
when i change the config file its stuck on the pistomp loading screen.

micahvdm

Can you paste what your default_config.yml contents for us to check?

bigbluecoconut

Thats my config:

 

hardware:
  # Hardware version (1.0 for original pi-Stomp, 2.0 for pi-Stomp Core)
  version: 2.0

  # midi definition
  #  channel: midi channel used for midi messages
  midi:
    channel: 14

  # footswitches definition
  #   bypass: relay(s) to toggle (LEFT, RIGHT or LEFT_RIGHT)
  #   color: color to use for enable status halo on LCD
  #   debounce_input: debounce chip pin to which switch is connected
  #   disable: disable the switch
  #   gpio_input: gpio pin if not using debounce
  #   gpio_output: gpio pin used to drive indicator (LED, etc.)
  #   id: integer identifier
  #   midi_CC: msg to send (0 - 127 or None)
  #
  footswitches:
  - id: 0
    debounce_input: 0
    ledstrip_position: 0
    bypass: LEFT
    preset: UP
  - id: 1
    debounce_input: 1
    ledstrip_position: 1
    midi_CC: 62
    color: lime
  - id: 2
    debounce_input: 2
    ledstrip_position: 2
    midi_CC: 63
    color: blue

  # analog control definition
  #   adc_input: adc chip pin to which control is connected
  #   disable: disable the control
  #   midi_CC: msg to send (0 - 127 or None)
  #   threshold: minimum value change to trigger a midi msg (16 default, 1024 full scale)
  #   type: control type (KNOB, EXPRESSION)
  #
  #analog_controllers:
  #- adc_input: 0
  #  midi_CC: 70
  #  type: KNOB
  #- adc_input: 1
  #  midi_CC: 71
  #  type: KNOB
  #- adc_input: 7
  #  midi_CC: 77
  #  type: EXPRESSION

micahvdm

Try removing the color: option and the ps-restart

bigbluecoconut

Sadly it didnt help, im getting this error:
Sep 04 15:18:05 pistomp systemd[1]: Started MOD-ALA-PI-STOMP.
Sep 04 15:18:06 pistomp python3[2616]: /usr/sbin/alsactl: set_control:1461: Cannot write control '2:0:0:Max Overclock PLL:0' : Device or resource busy
Sep 04 15:18:06 pistomp python3[2616]: /usr/sbin/alsactl: set_control:1461: Cannot write control '2:0:0:Max Overclock DSP:0' : Device or resource busy
Sep 04 15:18:06 pistomp python3[2616]: /usr/sbin/alsactl: set_control:1461: Cannot write control '2:0:0:Max Overclock DAC:0' : Device or resource busy
Sep 04 15:18:07 pistomp python3[2598]: DMA Error: 00000000
Sep 04 15:18:07 pistomp python3[2598]: None False
Sep 04 15:18:07 pistomp python3[2598]: Traceback (most recent call last):
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/modalapistomp.py", line 150, in <module>
Sep 04 15:18:07 pistomp python3[2598]:     main()
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/modalapistomp.py", line 87, in main
Sep 04 15:18:07 pistomp python3[2598]:     hw = factory.create(handler, midiout)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/hardwarefactory.py", line 37, in create
Sep 04 15:18:07 pistomp python3[2598]:     return Pistompcore.Pistompcore(self.cfg, handler, midiout, refresh_callback=handler.update_lcd_fs)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/pistompcore.py", line 81, in __init__
Sep 04 15:18:07 pistomp python3[2598]:     self.reinit(None)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/hardware.py", line 84, in reinit
Sep 04 15:18:07 pistomp python3[2598]:     self.__init_footswitches(self.cfg)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/hardware.py", line 246, in __init_footswitches
Sep 04 15:18:07 pistomp python3[2598]:     fs.clear_pedalboard_info()
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/footswitch.py", line 136, in clear_pedalboard_info
Sep 04 15:18:07 pistomp python3[2598]:     self.set_category(None)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/footswitch.py", line 65, in set_category
Sep 04 15:18:07 pistomp python3[2598]:     self.pixel.set_color_by_category(category, self.enabled)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/ledstrip.py", line 63, in set_color_by_category
Sep 04 15:18:07 pistomp python3[2598]:     self.set_enable(enabled)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/ledstrip.py", line 70, in set_enable
Sep 04 15:18:07 pistomp python3[2598]:     self._render_color_rgb(0, 0, 0)
Sep 04 15:18:07 pistomp python3[2598]:   File "/home/pistomp/pi-stomp/pistomp/ledstrip.py", line 86, in _render_color_rgb
Sep 04 15:18:07 pistomp python3[2598]:     self.strip.show()
Sep 04 15:18:07 pistomp python3[2598]:   File "/usr/local/lib/python3.9/dist-packages/rpi_ws281x/rpi_ws281x.py", line 150, in show
Sep 04 15:18:07 pistomp python3[2598]:     raise RuntimeError('ws2811_render failed with code {0} ({1})'.format(resp, str_resp))
Sep 04 15:18:07 pistomp python3[2598]: RuntimeError: ws2811_render failed with code -10 (DMA error)
Sep 04 15:18:07 pistomp python3[2598]: DMA Error: 00000000

micahvdm

Are you using any customised settings for the pi, like overclocking? Those DMA errors are no good

bigbluecoconut

No, thats a freshly installed pi-stomp on a pi 4.
When using the standard config it works normally without errors.

Randall (Admin)

See this line:
https://github.com/TreeFallSound/pi-stomp/blob/master/pistomp/ledstrip.py#L27

LED_DMA = 12          # DMA channel to use for generating signal (try 10)   # TODO XXX need to figure this out


12 worked for pi3a+, 10 appears to work for pi4.  Please try 10.  That got rid of the DMA errors and the pi-stomp error for me.

As the my TODO comment suggests, we need to figure this out  ;)





bigbluecoconut