Can an ATTINY85 be used to send midi messages?

I have built several midi controllers using standard Arduino hardware, and they have worked quite well. But instead of building more complex controllers, I would now like to build some very simple, single function, midi controllers (midi volume control pedal, expression pedal, etc.) that use the simplest and least expensive hardware possible. Is an ATTTINY85 and existing Arduino language support capable of the task? In particular, it is unclear if the ATTINY85 can support the serial communication needed for midi. Advice will be greatly appreciated.

Check the ATTiny85 datasheet at atmel.com and see if the features you use now are also supported.
I think you'll find the '85 is from the same family of 8-bit AVR and may just have less IO and memory, but similar core features: serial port, timers.

I took your advice, and found the following:

AVR documents state that the ATTINY85 has a Universal Serial Interface (USI) on the chip. Bullet points of features of the USI are:

• Two-wire Synchronous Data Transfer (Master or Slave)
• Three-wire Synchronous Data Transfer (Master or Slave)
• Data Received Interrupt
• Wakeup from Idle Mode
• Wake-up from All Sleep Modes In Two-wire Mode
• Two-wire Start Condition Detector with Interrupt Capability

This sounds encouraging, but there are many types of serial communication, and my knowledge of the nuts and bolts of UARTS, communication timing, buffering, etc. is not currently sufficient to determine if the USI can be configured in a way that is compatible with midi. I suppose that the first question that I asked should have been whether the standard Arduino language serial communication commands would work if a sketch is downloaded to the ATTINY85. From what I have read, most Arduino language statements will execute on the ATTINY85, but not all.

For my purposes, I really only need to set Baud rate, i.e.

Serial.begin(31250);

And then a series of Serial.write statements such as

Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);

So what I want to do could hardly be simpler in one sense, and memory and number of IO pins is not an issue. But there is a lot that I do not understand or know as relates to serial communication, and I still can't gauge how hard it will be to implement MIDI compatible communications using the ATTINY85 hardware and the Arduino language as it might function (or not) when running on the ATTINY85. Any more thoughts?

How tolerant are other MIDI devices of slightly-off baud rates?

My intuition tells me that this should be possible, or at least be close to the edge of being possible. It probably won't be the ideal solution, but it might work. I suspect it will be more of a hack than a very stable solution, but would be fun to try.

Here's a good place to start: http://itp.nyu.edu/physcomp/Labs/MIDIOutput

If the ATTiny85 doesn't work out, don't forget to check out the ATTiny2313. It costs almost the same, but comes in a bigger DIP package.

I think that midi can tolerate something like +/-6% of the specified 31250.

Thanks for the link h4t. If it is likely that the ATTINY85 would be an unstable hack, I think that I will look for another solution. Too bad about that, as the 8 pin dip configuration was really attractive, and the ATTINY85 can operate with almost no supporting components.

So it's plain old serial at an annoying baud rate?

I can think of several choices...

  • Use a different tiny processor (like the ATtiny2313).
  • Use NewSoftSerial. Other folks on the forum have had success with NewSoftSerial on the ATtiny85. I believe someone (you) would have to update the timing table to include 31250 baud.
  • Use an SPI or I2C to serial chip.
  • Use the USI subsystem. Atmel has examples for using it as a serial port. I suspect you can find ready-to-use source code on the internet.
  • Agree to follow-up on the forum and I will try to add support for 31250 baud to Tiny Debug Serial in the Tiny Core.
1 Like