MIDISID Monday: When the Pico's 30 GPIO aren't enough
Get link
Facebook
X
Pinterest
Email
Other Apps
This is the first of a weekly roundup of progress and problems with this project. (An introduction is here if you need it.) Two decent steps forward this week are arpeggios and GPIOs.
More GPIOs!
Being short on Pico GPIO pins felt wrong but I have been struggling. First of all, of the theoretical ~30 on the RP2040, 'only' 26 are easily available to the user. This project already uses quite a few for SID addressing and data. We want to be able to add more SIDs in future and each SID requires a chip select. There just aren't enough available for the push-switch rotary encoders that I'd like for this project.
Playing with so many settings using a single knob with push switch is fiddly and would spoil what could be a useful and usable module. Ideally, I'd love four knobs - to play with A/D/S/R at the same time, or filter/PWM etc.
Picos are cheap, and the idea of using another to manage the inputs and the display did cross my mind! Perhaps the answer lies in the MCP23017 'Port Expander'. It hooks up to the I2C and so won't use additional pins. (the OLED display is already hooked up to the I2C, but has a different address to this chap.) So for no additional pins used on the Pico, you gain 16 GPIO pins, configurable for input or output. (They have 3 address pins, so you can stack up to 8 of these, for 128 extra GPIOs!)
I've mounted the 4 rotary encoders and OLED onto a piece of plastic to help keep them under control while I'm working. All encoders, their push buttons and the screen will all work off just two i2c pins.
I've spent too much time getting the port expander working. Of course there are libraries but these tend to be for circuit python etc. I'm using C and the closest I could find was one for Raspberry Pi. I couldn't just drop it in but it was a good reference.
I then had trouble getting interrupts to work. Sometimes it takes longer to understand someone else's code / library and use it properly than it does to understand the data sheet for the chip and write your own code.
Eventually I got the interrupt working but for some reason I don't understand, my program hangs if I try to use i2c from within said interrupt. (The chip only gives you a signal that something's changed. As a minimum you have to get the state of all its pins.) For now I've fallen back on simply polling the MCP's pins. I have a reasonably tight loop (a benefit of using a multi-core microcontroller). It feels very good, more responsive than when I had one encoder connected to the Pico's own GPIOs and was using an interrupt. It's working well, here's a demo:
With those problems solved, it's full steam ahead on getting all four encoders hooked up and more work on the menu system.
Arpeggiator!
On the musical front, arpeggiation is an important part of the SID's distinctive sound. When you have just three voices on one SID in a Commodore 64, you need to use tricks like this to make the sound fuller and richer. I've written that feature into the MIDISID code this week.
In 'general MIDI' mode it'll allow multiple notes on the same channel to be played. (in this mode one channel is mapped to one voice, so without arpeggiation, notes would be dropped.)
To use arpeggiation as an effect, all you have to do is write 2, 3 or 4 simultaneous notes in the same midi channel. Here's a demo:
That's it for this week, thanks for your interest. I'll tweet fun titbits at various times but stick to the routine of posting full weekly roundups here.
At Liverpool earlier this year, Andy Piper was demonstrating his brachiograph, or lolly-stick drawing robot arm. Ever since I first had my ZX81 I've been mildly curious about robotics but have never taken the plunge. More recently I've been looking at various plotter projects, even bookmarked a few. Seeing this one in real life and seeing how cheap and easy it was to build (and my boyfriend chucking some servos in my direction) finally tipped me over the edge. This project turned out to be, as billed, the perfect gateway into robotics. It really is very simple to build and there are tutorials online, including from Andy himself . Thanks for all this Andy! Lots of hotglueing ensued. So far this has all been very robust. To make the wiring neater, I made this little distribution board. First I screwed the Pi Zero down and found that I couldn't plug anything into it, so had to cut a little plinth for it. I'm not going to pretend that installing the software went without...
I'd like to announce the new and improved e-ther 2. This information is available in video form here . If you're not familiar with e-ther, then it's a small theremin-like instrument with MIDI and audio out . At first glance the differences aren't obvious and indeed the big changes to the hardware are internal. However, I hope you'll find the list of new features as exciting as I do. Hardware-wise, I've put the microcontroller and DAC onto the main board. Although this increases costs (for me, not for you), there are some big advantages. Besides looking more professional, the audio module is no longer a 'buy separately' optional extra. It's incorporated and the audio jack is just there if you want it. The audio module used to fit below the board but with the audio capability now built-in, the profile is more compact. Most of the new features are down to firmware which means that a large proportion of what I'm calling 'e-ther 2' will be...
The default configuration for MIDISID looks fine and is functional. I have fitted wooden cheeks to my own, which gives it a look and tilts the top forward, making it a little easier to use when you're sitting back from it. MIDISID was designed from the start with 'bring your own box' in mind. It's a modular design, the top and bottom parts are easily separated and connect with a 4-way jst-sh cable. In my head I saw it being used in a sloping-top case. Paul of Bad Dog Designs has come up with a different solution. It achieves the same goal - tipping the controls and screen forward. It's a 3D print in two parts. It takes zero effort to fit - MIDISID just drops in. I don't know whether he has made the design files public but please contact him if you're interested. Update Nov '23 The current version of MIDISID is now larger, has a tilted front and custom side supports: Owners are still being creative with enclosures. Here's a beautiful one from @k...
Comments
Post a Comment