ATtiny85 MIDI IN using SoftwareSerial - Is it possible? I'm trying to read MIDI notes using an ATtiny85 via SoftwareSerial; so far, I've got no success at all.


The ATtiny is using the internal clock, 8Mhz, 5V.
The MIDI keyboard sends clean note on/off messages (tested with a MIDI monitor).
I've tried several test programs, particularly Nick Gammon's, as described here.
I've followed Nick's schematics to build the connector, and I can confirm his program works with an Arduino, but not with the ATtiny.
I calibrated the Tiny with OSCCAL - still no luck.
As far as I can tell, midiSerial.available() is always 0, in every program I've tried.
SoftwareSerial works fine for the purpose of MIDI out.


That's as far as I've got. I'd appreciate any pointers, especially if anyone else could try Nick's code and see if it works.

EDIT

There was an issue with my local version of SoftwareSerial. I had commented out code so that I could use pin change interrupts in my MIDI out program, but those interrupts are essential for MIDI input. Once I uncommented the code, all the programs I tested worked, so it is indeed possible to receive MIDI using an ATtiny.

That said, I've tried four keyboards as inputs and only one has worked so far, a Korg 01/W proX. The same happens when I load the MIDI code directly in the Arduino, so based on the answers below I will try a different optocoupler, and post my results here for the sake of improving on the answer.

Here's the schematics I was talking about:
I have done tests with a normal Arduino with software serial and missed quite a bit of messages, so I would advice to use hardware serial's instead.

For MIDI Out probably it works, but for MIDI In I have bad experiences. Especially when it comes to many messages, like aftertouch/pitch bend etc.

Also, I tried some optocouplers which didn't work well (like 6N137). I now use H11L1 optocouplers (they are white compared to most black ICs) and work perfectly.

You already checked the clean note on/note off ... are you sure it doesn't send active messages?

Below the schematic as I use it.. It does not matter if an STM32 or Arduino is used. Actually I haven't checked if H11L1 are 3.3V or 5V but they seem to work on both.







simulate this circuit &ndash; Schematic created using CircuitLab