When talking MIDI and Arduino, everybody uses the 6N138 opto-isolator, and for good reason. It has a fairly high gain!
Imagine you’re struck by inspiration and you can’t find a 6N138 in your toolbox. Oh no! but you find another opto-isolator and a NPN transistor. You could still make it work!
That high gain is needed because:
Usually a 470Ω resistor connected to +5V is used to overcome Arduino’s 1kΩ resistors to the USB-to-Serial chip (held at 5V or 0V), so that pin 0 (RX) reads a digital HIGH.
The MIDI interface needs to sink around 20mA of that resistance to achieve a voltage low enough that Arduino takes as a digital LOW
The problem with “normal” opto-isolators is that their gain, or more datasheet-technical, “Current Transfer Ratio (CTR)” which is usually below 100%. E.g. if an opto has a CTR of 20% it means if you input 15mA you’ll allow around 3mA to pass on the ouput (the case of 6N136 and 4N25). The 6N138, on the other hand, has a CTR of ~2000%, and 15mA would let up to 300mA through! see the difference?
This is gonna be a short article of a method I’m using to debug my Arduino UNO program that implements MIDI-in serially (digital pin 0 “RX”).
If you’re reading this you probably had the same problem I had: You want to transfer debug info trough USB at the same time you receive MIDI messages and you find out the Serial Monitor in Arduino software doesn’t support MIDI baud rates (32150 bauds). I read somewhere that it has to do with Java not allowing this speed.
NOTE: THIS ARTICLE IS UNDER SUPERVISION, THERE IS AN ERROR I CANNOT DETECT IN THE CIRCUIT
Welcome to acidotunismo.com!
This is the first article I post, I hope many will follow. Basically it’s a site about DIY (do it yourself). It’s a sort of open log of some of my projects for anyone that could be interested. It’s in english and spanish.
What does it do
This circuit is a mod/hack to Korg’s Kaossilator (v1) to extract clean rythm pulses (BPM) from it and be able to control other home-made devices and synchronize them. Specially practical for the “tapping” BPM control and sync’ing with the automatic drums (P.90-P.99).
The circuit is electrically autonomous, feeding from the Kaossilator itself, generating 0 to 6V pulses approx.
It’s not exclusive to the Kaossilator, it can also be used to extract pulses from any LED integrated to a device.