home.social

#apa106 — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #apa106, aggregated by home.social.

  1. Forbidden Planet “Krell” Display – MIDI CC Controller – Part 2

    This revisits my Forbidden Planet “Krell” Display – MIDI CC Controller using my Forbidden Planet “Krell” Display PCB with a Waveshare RP2040 to create more of a “all in one” device.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to Arduino, see the Getting Started pages.

    Parts list

    PCB

    This requires a built of the Forbidden Planet “Krell” Display PCB with the following:

    • 2 potentiometers
    • MIDI IN and OUT

    I’ve used potentiometers that are their own knob, as they only poke through the casing by around 5mm or so.

    If it you are able to get longer shaft pots, then that would probably be worthwhile.

    Updated 3D Printed Case

    This requires the following from the Krell Display 3D Printed Case:

    This requires the following options in the OpenSCAD code:

    show_frame = 1;
    show_quadframe = 0;
    show_insert = 1;
    show_support = 0;
    show_quadsupport = 0;
    show_eurorack = 0;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    The frame does not really take into account the PCB at present, but I’ve reached the “good enough I want to do something else” stage, so I’ve just added a couple of small cut-outs (using a hacksaw) for the two MIDI sockets, and am content that the components stick out a bit from the back.

    This cutout has to be 10.5mm from the end, 6mm wide, and 5mm deep.

    At some point I might go back and design a deeper frame that has the cut-outs included and some kind of snap-on back to make it a self-contained box.

    But for now, this is left as an exercise for, well, anyone else 🙂

    Construction

    I’ve used four brass 6mm spacers to screw into the mounting holes in the frame. Then the PCB can be inserted, taking care to squeeze in the 3D printed support around the LEDs and pots, and fixed with 20mm spacers which will also act as “legs”.

    The Code

    I’ve used a Waveshare Zero RP2040 and Circuitpython for this build. This is a combination of some of the test code used for the Forbidden Planet “Krell” Display PCB but with added MIDI.

    The code supports both Serial and USB MIDI.

    I wanted an equivalent of the Arduino map() and constrain() functions and didn’t immediate spot them in Circuitpython so wrote my own:

    def algmap(val, minin, maxin, minout, maxout):
    if (val < minin):
    val = minin
    if (val > maxin):
    val = maxin
    return minout + (((val - minin) * (maxout - minout)) / (maxin - minin))

    This allows me to map the analog read values (0 to 65535) down to MIDI CC values (0 to 127) whilst also allowing for some inaccuracies (I’ve treated anything below 256 as zero for example):

    alg1cc = int(algmap(alg1_in.value,256,65530,0,127))

    I’ve used the Adafruit MIDI library, which I’m still not really a fan of, but I wanted to include MIDI THRU functionality to allow the controller to sit inline with an existing MIDI stream. But it doesn’t seem to work very well.

    I was already only updating the LEDs/MIDI CC if the pot values had changed, to cut down on the number of Neopixel writes required.

    I experimented with changing the scheduling of the analog reads and MIDI but that didn’t seem to help very much. In the end I made sure that all MIDI messages queued up in the system would be read at the same time before going back to checking the pots.

        msg = midiuart.receive()
    while (msg is not None):
    if (not isinstance(msg, MIDIUnknownEvent)):
    midiuart.send(msg)
    msg = midiuart.receive()

    It will do for now. Moving forward, I might try the Winterbloom SmolMIDI library. If that still doesn’t give me some useful performance then I might have to switch over to Arduino C.

    Find it on GitHub here.

    Closing Thoughts

    The MIDI throughput is disappointing, but then I’ve never really gotten on with the Adafruit MIDI library. I use it as USB MIDI on Circuitpython is so easy, so will need to do something about that.

    I’m still deciding on the PCB-sized supports too. The original seemed to have nicer diffusion of the LEDs, but that could have been the difference between 5mm SMT neopixels and these THT APA106s which seem more directional in the first place.

    And I really ought to finish the 3D printed case properly too.

    So this is “that will do” for now, but I ought to come back and finish it off properly at some point.

    Kevin

    #APA106 #circuitpython #ForbiddenPlanet #Krell #midi #midiController #NeoPixel #potentiometer #rp2040 #WaveshareZero

  2. Forbidden Planet “Krell” Display – MIDI CC Controller – Part 2

    This revisits my Forbidden Planet “Krell” Display – MIDI CC Controller using my Forbidden Planet “Krell” Display PCB with a Waveshare RP2040 to create more of a “all in one” device.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to Arduino, see the Getting Started pages.

    Parts list

    PCB

    This requires a built of the Forbidden Planet “Krell” Display PCB with the following:

    • 2 potentiometers
    • MIDI IN and OUT

    I’ve used potentiometers that are their own knob, as they only poke through the casing by around 5mm or so.

    If it you are able to get longer shaft pots, then that would probably be worthwhile.

    Updated 3D Printed Case

    This requires the following from the Krell Display 3D Printed Case:

    This requires the following options in the OpenSCAD code:

    show_frame = 1;
    show_quadframe = 0;
    show_insert = 1;
    show_support = 0;
    show_quadsupport = 0;
    show_eurorack = 0;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    The frame does not really take into account the PCB at present, but I’ve reached the “good enough I want to do something else” stage, so I’ve just added a couple of small cut-outs (using a hacksaw) for the two MIDI sockets, and am content that the components stick out a bit from the back.

    This cutout has to be 10.5mm from the end, 6mm wide, and 5mm deep.

    At some point I might go back and design a deeper frame that has the cut-outs included and some kind of snap-on back to make it a self-contained box.

    But for now, this is left as an exercise for, well, anyone else 🙂

    Construction

    I’ve used four brass 6mm spacers to screw into the mounting holes in the frame. Then the PCB can be inserted, taking care to squeeze in the 3D printed support around the LEDs and pots, and fixed with 20mm spacers which will also act as “legs”.

    The Code

    I’ve used a Waveshare Zero RP2040 and Circuitpython for this build. This is a combination of some of the test code used for the Forbidden Planet “Krell” Display PCB but with added MIDI.

    The code supports both Serial and USB MIDI.

    I wanted an equivalent of the Arduino map() and constrain() functions and didn’t immediate spot them in Circuitpython so wrote my own:

    def algmap(val, minin, maxin, minout, maxout):
    if (val < minin):
    val = minin
    if (val > maxin):
    val = maxin
    return minout + (((val - minin) * (maxout - minout)) / (maxin - minin))

    This allows me to map the analog read values (0 to 65535) down to MIDI CC values (0 to 127) whilst also allowing for some inaccuracies (I’ve treated anything below 256 as zero for example):

    alg1cc = int(algmap(alg1_in.value,256,65530,0,127))

    I’ve used the Adafruit MIDI library, which I’m still not really a fan of, but I wanted to include MIDI THRU functionality to allow the controller to sit inline with an existing MIDI stream. But it doesn’t seem to work very well.

    I was already only updating the LEDs/MIDI CC if the pot values had changed, to cut down on the number of Neopixel writes required.

    I experimented with changing the scheduling of the analog reads and MIDI but that didn’t seem to help very much. In the end I made sure that all MIDI messages queued up in the system would be read at the same time before going back to checking the pots.

        msg = midiuart.receive()
    while (msg is not None):
    if (not isinstance(msg, MIDIUnknownEvent)):
    midiuart.send(msg)
    msg = midiuart.receive()

    It will do for now. Moving forward, I might try the Winterbloom SmolMIDI library. If that still doesn’t give me some useful performance then I might have to switch over to Arduino C.

    Find it on GitHub here.

    Closing Thoughts

    The MIDI throughput is disappointing, but then I’ve never really gotten on with the Adafruit MIDI library. I use it as USB MIDI on Circuitpython is so easy, so will need to do something about that.

    I’m still deciding on the PCB-sized supports too. The original seemed to have nicer diffusion of the LEDs, but that could have been the difference between 5mm SMT neopixels and these THT APA106s which seem more directional in the first place.

    And I really ought to finish the 3D printed case properly too.

    So this is “that will do” for now, but I ought to come back and finish it off properly at some point.

    Kevin

    #APA106 #circuitpython #ForbiddenPlanet #Krell #midi #midiController #NeoPixel #potentiometer #rp2040 #WaveshareZero

  3. Forbidden Planet “Krell” Display – MIDI CC Controller – Part 2

    This revisits my Forbidden Planet “Krell” Display – MIDI CC Controller using my Forbidden Planet “Krell” Display PCB with a Waveshare RP2040 to create more of a “all in one” device.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to Arduino, see the Getting Started pages.

    Parts list

    PCB

    This requires a built of the Forbidden Planet “Krell” Display PCB with the following:

    • 2 potentiometers
    • MIDI IN and OUT

    I’ve used potentiometers that are their own knob, as they only poke through the casing by around 5mm or so.

    If it you are able to get longer shaft pots, then that would probably be worthwhile.

    Updated 3D Printed Case

    This requires the following from the Krell Display 3D Printed Case:

    This requires the following options in the OpenSCAD code:

    show_frame = 1;
    show_quadframe = 0;
    show_insert = 1;
    show_support = 0;
    show_quadsupport = 0;
    show_eurorack = 0;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    The frame does not really take into account the PCB at present, but I’ve reached the “good enough I want to do something else” stage, so I’ve just added a couple of small cut-outs (using a hacksaw) for the two MIDI sockets, and am content that the components stick out a bit from the back.

    This cutout has to be 10.5mm from the end, 6mm wide, and 5mm deep.

    At some point I might go back and design a deeper frame that has the cut-outs included and some kind of snap-on back to make it a self-contained box.

    But for now, this is left as an exercise for, well, anyone else 🙂

    Construction

    I’ve used four brass 6mm spacers to screw into the mounting holes in the frame. Then the PCB can be inserted, taking care to squeeze in the 3D printed support around the LEDs and pots, and fixed with 20mm spacers which will also act as “legs”.

    The Code

    I’ve used a Waveshare Zero RP2040 and Circuitpython for this build. This is a combination of some of the test code used for the Forbidden Planet “Krell” Display PCB but with added MIDI.

    The code supports both Serial and USB MIDI.

    I wanted an equivalent of the Arduino map() and constrain() functions and didn’t immediate spot them in Circuitpython so wrote my own:

    def algmap(val, minin, maxin, minout, maxout):
    if (val < minin):
    val = minin
    if (val > maxin):
    val = maxin
    return minout + (((val - minin) * (maxout - minout)) / (maxin - minin))

    This allows me to map the analog read values (0 to 65535) down to MIDI CC values (0 to 127) whilst also allowing for some inaccuracies (I’ve treated anything below 256 as zero for example):

    alg1cc = int(algmap(alg1_in.value,256,65530,0,127))

    I’ve used the Adafruit MIDI library, which I’m still not really a fan of, but I wanted to include MIDI THRU functionality to allow the controller to sit inline with an existing MIDI stream. But it doesn’t seem to work very well.

    I was already only updating the LEDs/MIDI CC if the pot values had changed, to cut down on the number of Neopixel writes required.

    I experimented with changing the scheduling of the analog reads and MIDI but that didn’t seem to help very much. In the end I made sure that all MIDI messages queued up in the system would be read at the same time before going back to checking the pots.

        msg = midiuart.receive()
    while (msg is not None):
    if (not isinstance(msg, MIDIUnknownEvent)):
    midiuart.send(msg)
    msg = midiuart.receive()

    It will do for now. Moving forward, I might try the Winterbloom SmolMIDI library. If that still doesn’t give me some useful performance then I might have to switch over to Arduino C.

    Find it on GitHub here.

    Closing Thoughts

    The MIDI throughput is disappointing, but then I’ve never really gotten on with the Adafruit MIDI library. I use it as USB MIDI on Circuitpython is so easy, so will need to do something about that.

    I’m still deciding on the PCB-sized supports too. The original seemed to have nicer diffusion of the LEDs, but that could have been the difference between 5mm SMT neopixels and these THT APA106s which seem more directional in the first place.

    And I really ought to finish the 3D printed case properly too.

    So this is “that will do” for now, but I ought to come back and finish it off properly at some point.

    Kevin

    #APA106 #circuitpython #ForbiddenPlanet #Krell #midi #midiController #NeoPixel #potentiometer #rp2040 #WaveshareZero

  4. Forbidden Planet “Krell” Display – MIDI CC Controller – Part 2

    This revisits my Forbidden Planet “Krell” Display – MIDI CC Controller using my Forbidden Planet “Krell” Display PCB with a Waveshare RP2040 to create more of a “all in one” device.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to Arduino, see the Getting Started pages.

    Parts list

    PCB

    This requires a built of the Forbidden Planet “Krell” Display PCB with the following:

    • 2 potentiometers
    • MIDI IN and OUT

    I’ve used potentiometers that are their own knob, as they only poke through the casing by around 5mm or so.

    If it you are able to get longer shaft pots, then that would probably be worthwhile.

    Updated 3D Printed Case

    This requires the following from the Krell Display 3D Printed Case:

    This requires the following options in the OpenSCAD code:

    show_frame = 1;
    show_quadframe = 0;
    show_insert = 1;
    show_support = 0;
    show_quadsupport = 0;
    show_eurorack = 0;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    The frame does not really take into account the PCB at present, but I’ve reached the “good enough I want to do something else” stage, so I’ve just added a couple of small cut-outs (using a hacksaw) for the two MIDI sockets, and am content that the components stick out a bit from the back.

    This cutout has to be 10.5mm from the end, 6mm wide, and 5mm deep.

    At some point I might go back and design a deeper frame that has the cut-outs included and some kind of snap-on back to make it a self-contained box.

    But for now, this is left as an exercise for, well, anyone else 🙂

    Construction

    I’ve used four brass 6mm spacers to screw into the mounting holes in the frame. Then the PCB can be inserted, taking care to squeeze in the 3D printed support around the LEDs and pots, and fixed with 20mm spacers which will also act as “legs”.

    The Code

    I’ve used a Waveshare Zero RP2040 and Circuitpython for this build. This is a combination of some of the test code used for the Forbidden Planet “Krell” Display PCB but with added MIDI.

    The code supports both Serial and USB MIDI.

    I wanted an equivalent of the Arduino map() and constrain() functions and didn’t immediate spot them in Circuitpython so wrote my own:

    def algmap(val, minin, maxin, minout, maxout):
    if (val < minin):
    val = minin
    if (val > maxin):
    val = maxin
    return minout + (((val - minin) * (maxout - minout)) / (maxin - minin))

    This allows me to map the analog read values (0 to 65535) down to MIDI CC values (0 to 127) whilst also allowing for some inaccuracies (I’ve treated anything below 256 as zero for example):

    alg1cc = int(algmap(alg1_in.value,256,65530,0,127))

    I’ve used the Adafruit MIDI library, which I’m still not really a fan of, but I wanted to include MIDI THRU functionality to allow the controller to sit inline with an existing MIDI stream. But it doesn’t seem to work very well.

    I was already only updating the LEDs/MIDI CC if the pot values had changed, to cut down on the number of Neopixel writes required.

    I experimented with changing the scheduling of the analog reads and MIDI but that didn’t seem to help very much. In the end I made sure that all MIDI messages queued up in the system would be read at the same time before going back to checking the pots.

        msg = midiuart.receive()
    while (msg is not None):
    if (not isinstance(msg, MIDIUnknownEvent)):
    midiuart.send(msg)
    msg = midiuart.receive()

    It will do for now. Moving forward, I might try the Winterbloom SmolMIDI library. If that still doesn’t give me some useful performance then I might have to switch over to Arduino C.

    Find it on GitHub here.

    Closing Thoughts

    The MIDI throughput is disappointing, but then I’ve never really gotten on with the Adafruit MIDI library. I use it as USB MIDI on Circuitpython is so easy, so will need to do something about that.

    I’m still deciding on the PCB-sized supports too. The original seemed to have nicer diffusion of the LEDs, but that could have been the difference between 5mm SMT neopixels and these THT APA106s which seem more directional in the first place.

    And I really ought to finish the 3D printed case properly too.

    So this is “that will do” for now, but I ought to come back and finish it off properly at some point.

    Kevin

    #APA106 #circuitpython #ForbiddenPlanet #Krell #midi #midiController #NeoPixel #potentiometer #rp2040 #WaveshareZero

  5. Forbidden Planet “Krell” Display – MIDI CC Controller – Part 2

    This revisits my Forbidden Planet “Krell” Display – MIDI CC Controller using my Forbidden Planet “Krell” Display PCB with a Waveshare RP2040 to create more of a “all in one” device.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to Arduino, see the Getting Started pages.

    Parts list

    PCB

    This requires a built of the Forbidden Planet “Krell” Display PCB with the following:

    • 2 potentiometers
    • MIDI IN and OUT

    I’ve used potentiometers that are their own knob, as they only poke through the casing by around 5mm or so.

    If it you are able to get longer shaft pots, then that would probably be worthwhile.

    Updated 3D Printed Case

    This requires the following from the Krell Display 3D Printed Case:

    This requires the following options in the OpenSCAD code:

    show_frame = 1;
    show_quadframe = 0;
    show_insert = 1;
    show_support = 0;
    show_quadsupport = 0;
    show_eurorack = 0;
    show_eurorack_support = 1;

    alg_pot1 = 1;
    alg_pot2 = 1;
    alg_cv = 0;

    The frame does not really take into account the PCB at present, but I’ve reached the “good enough I want to do something else” stage, so I’ve just added a couple of small cut-outs (using a hacksaw) for the two MIDI sockets, and am content that the components stick out a bit from the back.

    This cutout has to be 10.5mm from the end, 6mm wide, and 5mm deep.

    At some point I might go back and design a deeper frame that has the cut-outs included and some kind of snap-on back to make it a self-contained box.

    But for now, this is left as an exercise for, well, anyone else 🙂

    Construction

    I’ve used four brass 6mm spacers to screw into the mounting holes in the frame. Then the PCB can be inserted, taking care to squeeze in the 3D printed support around the LEDs and pots, and fixed with 20mm spacers which will also act as “legs”.

    The Code

    I’ve used a Waveshare Zero RP2040 and Circuitpython for this build. This is a combination of some of the test code used for the Forbidden Planet “Krell” Display PCB but with added MIDI.

    The code supports both Serial and USB MIDI.

    I wanted an equivalent of the Arduino map() and constrain() functions and didn’t immediate spot them in Circuitpython so wrote my own:

    def algmap(val, minin, maxin, minout, maxout):
    if (val < minin):
    val = minin
    if (val > maxin):
    val = maxin
    return minout + (((val - minin) * (maxout - minout)) / (maxin - minin))

    This allows me to map the analog read values (0 to 65535) down to MIDI CC values (0 to 127) whilst also allowing for some inaccuracies (I’ve treated anything below 256 as zero for example):

    alg1cc = int(algmap(alg1_in.value,256,65530,0,127))

    I’ve used the Adafruit MIDI library, which I’m still not really a fan of, but I wanted to include MIDI THRU functionality to allow the controller to sit inline with an existing MIDI stream. But it doesn’t seem to work very well.

    I was already only updating the LEDs/MIDI CC if the pot values had changed, to cut down on the number of Neopixel writes required.

    I experimented with changing the scheduling of the analog reads and MIDI but that didn’t seem to help very much. In the end I made sure that all MIDI messages queued up in the system would be read at the same time before going back to checking the pots.

        msg = midiuart.receive()
    while (msg is not None):
    if (not isinstance(msg, MIDIUnknownEvent)):
    midiuart.send(msg)
    msg = midiuart.receive()

    It will do for now. Moving forward, I might try the Winterbloom SmolMIDI library. If that still doesn’t give me some useful performance then I might have to switch over to Arduino C.

    Find it on GitHub here.

    Closing Thoughts

    The MIDI throughput is disappointing, but then I’ve never really gotten on with the Adafruit MIDI library. I use it as USB MIDI on Circuitpython is so easy, so will need to do something about that.

    I’m still deciding on the PCB-sized supports too. The original seemed to have nicer diffusion of the LEDs, but that could have been the difference between 5mm SMT neopixels and these THT APA106s which seem more directional in the first place.

    And I really ought to finish the 3D printed case properly too.

    So this is “that will do” for now, but I ought to come back and finish it off properly at some point.

    Kevin

    #APA106 #circuitpython #ForbiddenPlanet #Krell #midi #midiController #NeoPixel #potentiometer #rp2040 #WaveshareZero

  6. Forbidden Planet “Krell” Display PCB Build Guide

    Here are the build notes for my Forbidden Planet “Krell” Display PCB. This post just looks at building the PCB for standalone use.

    Further posts will explore other uses for this PCB:

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers and electronics, see the Getting Started pages.

    Bill of Materials

    • Forbidden Planet “Krell” Display PCB (GitHub link below)
    • Waveshare Zero format board (more here).
    • 10x APA-106 through-hole programmable RGB LEDs pinout: IN-VCC-GND-OUT.
    • 1x 500uF electrolytic capacitor (or thereabouts).
    • 1x 47uF electrolytic capacitor.
    • Optional: 2x 9-way header sockets (full or low-profile – see notes).
    • Pin headers

    For the MIDI circuit:

    • 1x H11L1 optoisolator.
    • 1x 1N4148 or 1N914 signal diode.
    • Resistors: 1×10Ω, 1×33Ω, 1×220Ω, 1×470Ω.
    • 1x 100nF ceramic capacitor.
    • 2x 3.5mm stereo TRS sockets – pcb mount (see photo and PCB for footprint).
    • Optional: 1x 6-way DIP socket.

    For potentiometer circuit:

    • 1 or 2 x 10K pcb-mount potentiometer (see photo and PCB for footprint).
    • 1 or 2x 100nF ceramic capactiors.

    For the CV input:

    • 1x Thonkiconn style mono PCB mount jack socket.
    • Resistors: 1x22K, 1x33K.
    • 2x BAT43 Schottky diodes.

    Build Steps

    This posts describes a standalone module with two potentiometer controls and a MIDI circuit. For a EuroRack-style module with CV inputs refer to: Forbidden Planet “Krell” Display EuroRack Module.

    Taking a typical “low to high” soldering approach, this is the suggested order of assembly:

    • All diodes and resistors.
    • DIP socket (if used) and TRS sockets.
    • Disc capacitors.
    • LEDs on rear of the board.
    • 9-way headers (if used).
    • Additional pin headers (if used).
    • Electrolytic capacitors.
    • Potentiometers on rear of the board.

    Here are some build photos.

    When it comes to adding the LEDs it is critical to get them in the correct pin order. These boards are designed for LEDs with two long and two shorter legs, with the pins in the order:

    • Short: IN
    • Short: VCC
    • Long: GND
    • Long: OUT

    The pins need to be slightly bent to fit in the staggered footprint which means it isn’t possible to push the LEDs flush with the PCB. It is worth taking a little care to get them all to approximately the same height and vertically aligned.

    Hopefully it goes without saying to be careful of rubbing the hot soldering iron tip on any of the existing plastic components.

    As the footprint for the Waveshare Zero is 2.54mm too wide, it is advantageous to use a Waveshare Zero format board to help angle-in the pin headers prior to soldering.

    If using full height headers there will probably be enough flex to do this afterwards. If using low-profile headers then it will be necessary to get the angle correct prior to soldering.

    In the following note how the large capacitor has been bent over to lie flat.

    Also, I didn’t have a 500uF or higher, so used a 470uF in a 10mm diameter package.

    Testing

    I recommend performing the general tests described here: PCBs.

    Here is some test CircuitPython code that will check the functionality of the board with a Waveshare Zero type device. This was used with a Pimoroni Tiny2040 (which has two less pins to the Waveshare Zero devices).

    Analog Input

    This tests the potentiometers:

    import time
    import board
    from analogio import AnalogIn

    analog_in1 = AnalogIn(board.A2)
    analog_in2 = AnalogIn(board.A3)

    while True:
    print(analog_in1.value,"\t",analog_in2.value)
    time.sleep(0.1)

    On turning each of the potentiometers a value between 0 and 65536 should be printed to the serial console. Note: Mine never seems to get below 256…

    LEDs

    This can be used to test the LEDs. Requires the following libraries from the Adafruit Circuitpython Library Bundle:

    • neopixel.mpy
    • adafruit_pioasm.mpy (presumably only required on RP2040 based boards)
    • adafruit_pixelbuf.mpy
    import time
    import board
    import neopixel

    pixel_pin1 = board.GP2
    pixel_pin2 = board.GP3
    num_pixels = 5

    pixels1 = neopixel.NeoPixel(pixel_pin1, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)
    pixels2 = neopixel.NeoPixel(pixel_pin2, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)

    while True:
    for col in [(255,0,0),(0,255,0),(0,0,255),(0,0,0)]:
    for pix in range(5):
    pixels1[pix] = col
    pixels1.show()
    time.sleep(0.5)

    pixels2[pix] = col
    pixels2.show()
    time.sleep(0.5)

    time.sleep(3)

    This will light each LED in turn alternating between the upper and lower sets of LEDs and then leave them off for three seconds.

    MIDI IN and OUT

    This requires the Adafruit MIDI library, which requires the following directory from the Adafruit Circuitpython Library Bundle:

    • adafruit_midi/*
    import board
    import digitalio
    import busio
    import adafruit_midi
    from adafruit_midi.note_off import NoteOff
    from adafruit_midi.note_on import NoteOn

    uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=31250, timeout=0.001)
    midi = adafruit_midi.MIDI(midi_in=uart, midi_out=uart)

    while True:
    msg = midi.receive()
    if (msg is not None):
    if (isinstance(msg, NoteOn)):
    print (msg)
    print ("Note On: \t",msg.note,"\t",msg.velocity)
    midi.send(msg)
    if (isinstance(msg, NoteOff)):
    print ("Note Off:\t",msg.note,"\t",msg.velocity)
    midi.send(msg)

    This will print out any received NoteOn and NoteOff messages (and only those) on the MIDI IN port and send them back out over the MIDI OUT port.

    PCB Errata

    There are the following issues with this PCB:

    •  The aforementioned Waveshare Zero footprint error.

    Enhancements:

    •  It might have been useful to position the Waveshare board so that the USB connector could be presented to the edge of the board and thus left exposed when used with a case.

    Find it on GitHub here.

    Closing Thoughts

    That is the basics of the board covered. Next will be a discussion of the alternative EuroRack supporting configuration and the physical builds for both versions.

    Kevin

    #APA106 #Krell #midi #pcb #waveshare

  7. Forbidden Planet “Krell” Display PCB Build Guide

    Here are the build notes for my Forbidden Planet “Krell” Display PCB. This post just looks at building the PCB for standalone use.

    Further posts will explore other uses for this PCB:

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers and electronics, see the Getting Started pages.

    Bill of Materials

    • Forbidden Planet “Krell” Display PCB (GitHub link below)
    • Waveshare Zero format board (more here).
    • 10x APA-106 through-hole programmable RGB LEDs pinout: IN-VCC-GND-OUT.
    • 1x 500uF electrolytic capacitor (or thereabouts).
    • 1x 47uF electrolytic capacitor.
    • Optional: 2x 9-way header sockets (full or low-profile – see notes).
    • Pin headers

    For the MIDI circuit:

    • 1x H11L1 optoisolator.
    • 1x 1N4148 or 1N914 signal diode.
    • Resistors: 1×10Ω, 1×33Ω, 1×220Ω, 1×470Ω.
    • 1x 100nF ceramic capacitor.
    • 2x 3.5mm stereo TRS sockets – pcb mount (see photo and PCB for footprint).
    • Optional: 1x 6-way DIP socket.

    For potentiometer circuit:

    • 1 or 2 x 10K pcb-mount potentiometer (see photo and PCB for footprint).
    • 1 or 2x 100nF ceramic capactiors.

    For the CV input:

    • 1x Thonkiconn style mono PCB mount jack socket.
    • Resistors: 1x22K, 1x33K.
    • 2x BAT43 Schottky diodes.

    Build Steps

    This posts describes a standalone module with two potentiometer controls and a MIDI circuit. For a EuroRack-style module with CV inputs refer to: Forbidden Planet “Krell” Display EuroRack Module.

    Taking a typical “low to high” soldering approach, this is the suggested order of assembly:

    • All diodes and resistors.
    • DIP socket (if used) and TRS sockets.
    • Disc capacitors.
    • LEDs on rear of the board.
    • 9-way headers (if used).
    • Additional pin headers (if used).
    • Electrolytic capacitors.
    • Potentiometers on rear of the board.

    Here are some build photos.

    When it comes to adding the LEDs it is critical to get them in the correct pin order. These boards are designed for LEDs with two long and two shorter legs, with the pins in the order:

    • Short: IN
    • Short: VCC
    • Long: GND
    • Long: OUT

    The pins need to be slightly bent to fit in the staggered footprint which means it isn’t possible to push the LEDs flush with the PCB. It is worth taking a little care to get them all to approximately the same height and vertically aligned.

    Hopefully it goes without saying to be careful of rubbing the hot soldering iron tip on any of the existing plastic components.

    As the footprint for the Waveshare Zero is 2.54mm too wide, it is advantageous to use a Waveshare Zero format board to help angle-in the pin headers prior to soldering.

    If using full height headers there will probably be enough flex to do this afterwards. If using low-profile headers then it will be necessary to get the angle correct prior to soldering.

    In the following note how the large capacitor has been bent over to lie flat.

    Also, I didn’t have a 500uF or higher, so used a 470uF in a 10mm diameter package.

    Testing

    I recommend performing the general tests described here: PCBs.

    Here is some test CircuitPython code that will check the functionality of the board with a Waveshare Zero type device. This was used with a Pimoroni Tiny2040 (which has two less pins to the Waveshare Zero devices).

    Analog Input

    This tests the potentiometers:

    import time
    import board
    from analogio import AnalogIn

    analog_in1 = AnalogIn(board.A2)
    analog_in2 = AnalogIn(board.A3)

    while True:
    print(analog_in1.value,"\t",analog_in2.value)
    time.sleep(0.1)

    On turning each of the potentiometers a value between 0 and 65536 should be printed to the serial console. Note: Mine never seems to get below 256…

    LEDs

    This can be used to test the LEDs. Requires the following libraries from the Adafruit Circuitpython Library Bundle:

    • neopixel.mpy
    • adafruit_pioasm.mpy (presumably only required on RP2040 based boards)
    • adafruit_pixelbuf.mpy
    import time
    import board
    import neopixel

    pixel_pin1 = board.GP2
    pixel_pin2 = board.GP3
    num_pixels = 5

    pixels1 = neopixel.NeoPixel(pixel_pin1, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)
    pixels2 = neopixel.NeoPixel(pixel_pin2, num_pixels, brightness=0.3, auto_write=False, pixel_order=neopixel.RGB)

    while True:
    for col in [(255,0,0),(0,255,0),(0,0,255),(0,0,0)]:
    for pix in range(5):
    pixels1[pix] = col
    pixels1.show()
    time.sleep(0.5)

    pixels2[pix] = col
    pixels2.show()
    time.sleep(0.5)

    time.sleep(3)

    This will light each LED in turn alternating between the upper and lower sets of LEDs and then leave them off for three seconds.

    MIDI IN and OUT

    This requires the Adafruit MIDI library, which requires the following directory from the Adafruit Circuitpython Library Bundle:

    • adafruit_midi/*
    import board
    import digitalio
    import busio
    import adafruit_midi
    from adafruit_midi.note_off import NoteOff
    from adafruit_midi.note_on import NoteOn

    uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=31250, timeout=0.001)
    midi = adafruit_midi.MIDI(midi_in=uart, midi_out=uart)

    while True:
    msg = midi.receive()
    if (msg is not None):
    if (isinstance(msg, NoteOn)):
    print (msg)
    print ("Note On: \t",msg.note,"\t",msg.velocity)
    midi.send(msg)
    if (isinstance(msg, NoteOff)):
    print ("Note Off:\t",msg.note,"\t",msg.velocity)
    midi.send(msg)

    This will print out any received NoteOn and NoteOff messages (and only those) on the MIDI IN port and send them back out over the MIDI OUT port.

    PCB Errata

    There are the following issues with this PCB:

    •  The aforementioned Waveshare Zero footprint error.

    Enhancements:

    •  It might have been useful to position the Waveshare board so that the USB connector could be presented to the edge of the board and thus left exposed when used with a case.

    Find it on GitHub here.

    Closing Thoughts

    That is the basics of the board covered. Next will be a discussion of the alternative EuroRack supporting configuration and the physical builds for both versions.

    Kevin

    #APA106 #Krell #midi #pcb #waveshare

  8. Forbidden Planet “Krell” Display PCB Design

    This is a PCB to support one of my dual Forbidden Planet “Krell” Displays. Rather than using ready made programmable LED rings, this is using through-hole APA-106 programmable RGB LEDs.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers and electronics, see the Getting Started pages.

    The Circuit

    I want this circuit to support the following:

    I’ve chosen to include a single 5V power jumper for power in, so will consider any EuroRack style powering options as a separate project.

    A standalone instance of this would be fine to be powered using the USB connection of the Waveshare Zero board chosen.

    I’ve included some optional breakout headers for spare GPIO pins.

    I’m using the GPIO of a Waveshare Zero compatible board as follows:

    5V Power IN5VTXMIDI OUTGroundGNDRXMIDI IN3V3 Power OUT3V3GPIOLower LEDsLower Analog INADCGPIOUpper LEDsUpper Analog INADCGPIOADCGPIOADCGPIOGPIOGPIOGPIOGPIO

    The upper analog input I’m anticipating will be an (optional) potentiometer.

    The lower analog input I’m planning to be either an (optional) potentiometer or a (optional) CV input, so I’ve include some (also optional) CV input protection circuitry and a simple resistor divider to scale a 0 to 5V analog CV to a 0 to 3V3 range for use with the ADCs.

    PCB Design

    The size of the PCB is designed to fit inside my Forbidden Planet “Krell” Display.

    The LEDs and potentiometers are on the non-component side of the PCB. I’ve used a staggered LED pin footprint to hopefully make soldering a little easier, but this does mean that the LEDs probably won’t fit flush to the board.

    I’ve overlapped the footprints of the lower potentiometer and a “Thonkiconn” style mono jack, so the board can use one or the other (or neither).

    MIDI circuitry is optional. CV in circuitry is also optional. I’ve attempted to highlight each within a silkscreen box to make it clearer which components relate to which part of the circuit.

    The 2-pin power input header is also designed to be used to connect the board to a secondary power board (to be discussed in a future post).

    There are additional breakout headers for a range of unused signals.

    I’ve also included a breakout header for the additional analog and IO signals that could be used for a single microcontroller to link to a second PCB to support a four-way Krell display. These would have to be patch-wired into the appropriate header signals on the unpopulated microcontroller headers on the secondary PCB.

    Closing Thoughts

    Unfortunately I already know the Waveshare Zero footprint is 2.54mm too wide, as I used the same footprint as my Waveshare Zero MIDI Proto PCB Design.

    Still, I should be able to provide the same workaround here when it comes to building the boards.

    Kevin

    #APA106 #Krell #midi #pcb #WaveshareZero

  9. Forbidden Planet “Krell” Display PCB Design

    This is a PCB to support one of my dual Forbidden Planet “Krell” Displays. Rather than using ready made programmable LED rings, this is using through-hole APA-106 programmable RGB LEDs.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers and electronics, see the Getting Started pages.

    The Circuit

    I want this circuit to support the following:

    I’ve chosen to include a single 5V power jumper for power in, so will consider any EuroRack style powering options as a separate project.

    A standalone instance of this would be fine to be powered using the USB connection of the Waveshare Zero board chosen.

    I’ve included some optional breakout headers for spare GPIO pins.

    I’m using the GPIO of a Waveshare Zero compatible board as follows:

    5V Power IN5VTXMIDI OUTGroundGNDRXMIDI IN3V3 Power OUT3V3GPIOLower LEDsLower Analog INADCGPIOUpper LEDsUpper Analog INADCGPIOADCGPIOADCGPIOGPIOGPIOGPIOGPIO

    The upper analog input I’m anticipating will be an (optional) potentiometer.

    The lower analog input I’m planning to be either an (optional) potentiometer or a (optional) CV input, so I’ve include some (also optional) CV input protection circuitry and a simple resistor divider to scale a 0 to 5V analog CV to a 0 to 3V3 range for use with the ADCs.

    PCB Design

    The size of the PCB is designed to fit inside my Forbidden Planet “Krell” Display.

    The LEDs and potentiometers are on the non-component side of the PCB. I’ve used a staggered LED pin footprint to hopefully make soldering a little easier, but this does mean that the LEDs probably won’t fit flush to the board.

    I’ve overlapped the footprints of the lower potentiometer and a “Thonkiconn” style mono jack, so the board can use one or the other (or neither).

    MIDI circuitry is optional. CV in circuitry is also optional. I’ve attempted to highlight each within a silkscreen box to make it clearer which components relate to which part of the circuit.

    The 2-pin power input header is also designed to be used to connect the board to a secondary power board (to be discussed in a future post).

    There are additional breakout headers for a range of unused signals.

    I’ve also included a breakout header for the additional analog and IO signals that could be used for a single microcontroller to link to a second PCB to support a four-way Krell display. These would have to be patch-wired into the appropriate header signals on the unpopulated microcontroller headers on the secondary PCB.

    Closing Thoughts

    Unfortunately I already know the Waveshare Zero footprint is 2.54mm too wide, as I used the same footprint as my Waveshare Zero MIDI Proto PCB Design.

    Still, I should be able to provide the same workaround here when it comes to building the boards.

    Kevin

    #APA106 #Krell #midi #pcb #WaveshareZero