0

For a (for now MIDI only) project I was planning to use multiple Arduinos and send messages around.

However, for the latency, I can have max 10ms (to prevent audible delay).

I hoped to use WIFI modules (ESP-01), however, according to a previous question in Question, one remark that due to HTTP overhead the time/latency would be 15 ms. So that means WIFI is not possible.

My requirements:

  • Latency of <= 3 ms (rationale: I need at least 5 ms for processing, and want to keep total latency < 10 ms)
  • Preferably a wireless solution (rationale: I want to add later more Arduinos and want to prevent cabling)
  • Preferably not using a hardware serial (low prio requirement) (rationale: the MIDI box which is a Mega, would preferably need 4 MIDI inputs, using a hardware serial would reduce one, software serial is unacceptable for MIDI).

Situation:

  • Arduinos are very close together, probably within centimeters (upto like 50 centimeters)
  • Messages are short (like 5-10 bytes max)
  • Burst of messages can be possible, but not so likely

Background/message flow:

  • Receiving MIDI input by Arduino 1
  • Sending (filtered/changed) message to Arduino 2
  • Arduino 2 process the manage, takes <= 5 ms
  • Arduino 2 sends message back to Arduino 1
  • Arduino 1 converts it to a MIDI message and sends back

This all needs to be done within <= 10 ms

My thoughts so far:

Wireless solutions:

  • WIFI: HTTP seems to result in 15 ms delays, which is against my requirement.
  • RF: probably overkill since my Arduinos will be very near to each other. Also I would need both a receiver and transmitter in both Arduino's.
  • IR: Due to out-of-sight problems not very convenient.

Wired solutions:

  • I2C: Might be possible, planning to use later also an I2C display possibly but should not be a problem
  • SPI: On Arduino 2, I'm already using an SRAM with SPI which I do not want to stress more (also a time-critical resource). Also an SD card via SPI is used (but this is not a time critical resource).
  • Wire: Not checked yet

Question Is there any wireless (or wired) solution I can use (probably beyond the ones I analyzed)?

115200 baud is what I need for a Serial connection, probably a SPI/I2C (latter preferred) is also acceptable. Or I might have missed other communication possibilities.

  • 2
    NRF24L01+ transceiver, maybe. – Gerben Jun 1 '17 at 15:52
  • 1
    You need a custom solution. I was looking into wireless flash sync signals years ago and everything off the shelf took too long. If you do go with Ethernet (I think you shouldn't) you probably need to understand the difference between UDP and TCP. One is "get it there now no matter what the condition the packet is in" (skype). The other is "keep trying until it is perfect" (bank transactions). – st2000 Jun 1 '17 at 16:05
  • 2
    Also, keep in mind I2C and SPI are for chip to chip communications. Neither were meant to go any distance. The are really to keep the pin counts low on the integrated circuit packages. Which is a good way to keep the MTBF (time between failures) down. – st2000 Jun 1 '17 at 16:08
  • 1
    Yes, Ethernet is way more complex than most people make it out to be. And on top of everything else, it is very possible that no two Ethernet appliances work alike adding to the frustrations. Synchronization over Ethernet is not trivial. I suspect Sonos and Logitech/SqueezBox both use an extensive bag of tricks to synchronize music played at multiple points off an Ethenet network. I would stick to MIDI and investigate if there are wireless MIDI appliances available. After all MIDI was created with music in mind. – st2000 Jun 1 '17 at 16:14
  • 1
    I2C can be used for multiple devices. But normally all are on the same board. For example, you computer mother board may have several I2C temperature sensors all connected to a common I2C bus. – st2000 Jun 1 '17 at 16:16
1

I would either use the ESP8266 as a standalone device and directly program it to work with UDP datagrams or a permanently established TCP socket, or the nRF24L01+.

Of the two I would most likely use the nRF24L01+. It's good enough for 99% of wireless keyboards and mice, so plenty good enough for a few MIDI style messages.

  • Well I might need quite some MIDI messages (like CC messages), but that sounds good ... need to analyze both in more depth (and need to order an nRF24L01+). – Michel Keijzers Jun 1 '17 at 22:55
  • 1
    You'll want at least two nRF24L01 modules :P – Majenko Jun 2 '17 at 0:01
  • I ordered 5 SE8R01's (they seem to be compatible) and 5 adapter plates (for NRF24L01+) ... together < 4 euro. – Michel Keijzers Jun 2 '17 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.