Post by reductionist_earth_catalog on Oct 1, 2023 20:20:38 GMT
Hello everyone! I am very excited about the Wonkystuff MB-1 MIDI interface. I have modified some GRAINS firmwares to be MIDI-controlled, but that relies on a USB connection to a raspberry pi running one instance of ttymidi per connected GRAINS module, which has never felt very elegant. I wanted to add a MIDI input patch socket to my GRAINS so I can just patch from a MIDI channel output on MB-1 right into GRAINS.
Here is a video showing what I did. It is ~8 minutes of me fumbling with crummy tools and laughing at how crude the results are, but it worked. To summarize, I soldered a single patch socket to the serial Rx pin on the ATMEGA on the GRAINS PCB (which is the third pin from the bottom right of the microcontroller). I then cut a small hole in the front-panel to accommodate the patch socket, and hot glued the socket in that hole to try to improve the mechanical stability of the hack. I changed my GRAINS firmware to work at a baud rate of 31250, and set the module to respond to any MIDI channel (since I can select a single channel just by patching from the corresponding output of MB-1). I tested it with the MIDI output pin from a Bastl Microgranny, since I don't have my MB-1 yet. I will probably try to clean up my terrible code a bit, then post a link to a GitHub repo.
(EDIT--I shouldn't recommend doing this, unless you are either ok with potentially ruining your GRAINS, or are sufficiently more technically adept than me, such that you are confident it will work. I imagine this of course voids any warranty that may exist for the module)
Post by reductionist_earth_catalog on Oct 3, 2023 16:33:33 GMT
Just an update: over on discord, dizzeesatchel pointed out that there is an unused input socket between the bus signals and the A input. So for my other two grains, I’m probably going to try to solder a jumper wire between that pre-existing input pin and the serial rx pin of the microcontroller.
Not totally sure how I’ll do that yet. I guess the easiest way to solder to the input socket is on the reverse side of the board, but then I’ll have to get the jumper wire to the front of the board somehow…
Post by reductionist_earth_catalog on Oct 4, 2023 14:33:23 GMT
I couldn’t find an obvious way to access the trace leading to the rx pin on the back of the board. I think I might try cutting a small wedge off the top left corner of the PCB above the input sockets (outside, with a mask on so as to avoid breathing in fiberglass), and then running a wire through that wedge to connect the fifth input socket to the rx pin. It looks to me like the top left of the pcb is just the ground plane, so hopefully that doesn’t mess anything up. Will probably have to wait until next week!
Post by reductionist_earth_catalog on Oct 15, 2023 16:36:56 GMT
I was just cutting off the top left corner of the pcb, I would worry that connecting the ground plane to midi input would have some unintended consequences on the module.
I actually connected the 5th input pin to the serial rx pin today using wire. It works. One thing I notice with both the one I hacked today and the one I hacked earlier with the new input socket glued to the front panel is that I get some crackle in the audio whenever a new midi note (or midi cc) is received. You could maybe see it as an additional Lofi texture, but it is definitely noticeable. It is something I don’t hear when I use the usb input. I imagine additional components could be required to limit the crackle, but I’m not sure what those would be.
One possible issue is that you are not opto-isolating your input. MIDI isn't a direct electrical connection from your Digitakt to the Atmel chip. Instead you're expected to run it through an opto-isolator to prevent the sending device (the Digitakt) from affecting the receiving device (the Atmel) with noise or other issues. The circuit diagram can be found on page 2 of the MIDI 1.0 Detailed Specification 4.2 (1995). It's pretty simple to do but you'll need a breadboard. SparkFun has an Optoisolator on a breakout board which should make it easy.
I note that you're having issues when you send pitch bend. Unlike note on/off, which are occasional, pitch bend can send MANY messages very fast (while you're sending it). You may be seeing the problem with pitch bend because it's changing the serial line a lot, creating more noise perhaps?
Update: I think I may have fixed the noise by not sending pitch bend from my digitakt! I wi have to play around with it more as I find time.
Ok, so (knowing that GND and Vcc are on the little 6 pin header location on the GRAINS board) I have been applying some more localised decoupling — a 47μF or 100μF capacitor does the trick: Pitch bend noise is greatly reduced (removed? I can’t hear it, but doesn’t mean it’s entirely gone!) by this addition.
Obviously this is a temporary addition right now, and I’ll see about finding a better place which does not obscure the 6-pin header.
EDIT: Just realised that the picture shows the capacitor in the wrong way round - GND is closest to the camera!
Amazing that you got the noise down! I’ve been meaning to upload my newer grains ino files to GitHub, will try to do that today to test it out! (I also welcome feedback on my terrible code haha)
If you have any similarly-sized capacitors hanging around then it’s worth a try! I went for the 100μF in the end, just used the first one I found (it’s a little on the large side physically; I expect a 10v rated one would be smaller than the 25v-rated one I had)