SC on a microcomputer with sensors

Dear lists,

I want to ask the best devices for my current project before I buy some products:

  • Primary Machine: MacBook Pro.
  • Secondary Machines: Multiple Microcomputers Such as Bela, Raspberry Pi. There should be at least eight secondary machines. The maximum number of secondary machines is open.
  • All machines should be connected via one or more network devices by using Ethernet cable and Wi-Fi. The primary machine should be able to send OSC to each secondary machine and vice versa; The primary machine should receive OSC from each secondary machine and vice versa.
  • Each secondary machine should have at least mono-channel analogue audio output (more robust than 2 Watt. The louder output, the better result!)
  • Each of the secondary devices should attach at least one distance sensor, and the values from the sensor should be read in SuperCollider (or puredata).
  • Each secondary device measures the distance between the sensor connected to itself and a visitor (or some visitors) in an exhibition space. The measured values should be read in real-time within SuperCollider (or puredata locally) on each device. SuperCollider or puredata will use the values from the sensor to locally control the sound, and some values should be able to send to the primary machine. The SuperCollider, puredata or Max should be able to control each SuperCollider (or puredata) on secondary machines to produce sound using the received values from the distances between each sensor on each secondary machine and visitors.

If you suggest one from Bela or Raspberry Pi or something else for my current project, I would like to know the following thing:

  • Recommended product lists of proximity sensors that work without issues when using it with Bela or Raspberry Pi.

I could set up the same feature with a computer, an audio interface, and many Arduino boards. However, the USB cable lengths among the laptop and Arduino boards could be very long as well as the lengths of the wires from an Arduino board to a sensor could be relatively long. Thus, I am thinking about using RP or Bela to reduce time in installing devices.

I really appreciate any help you can provide. Sharing your own experience will help me very much!

Best regards,

Perhaps consider wifi shields on the Arduinos, etc? I’ve done this a number of times and it is very effective and easy to set up a simple server.


Arduino with WiFi is a possibility.
However, I think WiFi is not reliable on stage or in an exhibition hall.

I have this-regarded several experiences:

  1. I sent some messages using OSC over WiFi in my recent project.
    The messages are from MIDI messages as follows:
    – note-on velocity MIDI pitch number
    – note-off velocity MIDI pitch number
    Regretfully, some messages were often not delivered from the sender to the receiver in an exhibition hall, even though it worked perfectly at my home.
    I could resolve the problem by connecting the two computers using an Ethernet cable.

  2. I made an automatic page-turning score (from png files) using SuperCollider on five laptops.
    They had wirelessly to run; regretfully, page-turning moments were often and irregularly not delivered.
    If I remember correctly, I resolved the problem by sending the actual page number multiple times per second to other computers.

Using WiFi for the project in my question might be reliable to measure the distance between a sensor and a human because the value is frequently sent to the main computer. I will consider it.

Yes I’ve had similar issues - without a better way to describe it, the OSC messages would sporadically get “clogged” for 30-60 seconds, and then all arrive at once.

Teensy can send MIDI messages, and you can attach it to a raspberry pi, or your laptop. I’m not sure about what sensors you would use, but this project looks like it might help:

What was your wifi setup? I have frequently sent OSC over wifi using an old & fairly cheap TP-Link wireless router connected to main computer by Ethernet, set up as a private network so audience can’t get on. It has been reliable from ~60-80 feet away, across 200-300 audience members, even from behind some curtains. (I’m not an expert at all just some anecdotal success)

I’ve used ESP8266 controllers (programmed with Arduino environment) which have WiFi built-in and I’ve run them for hours at a time, with data rate of 100-200Hz. Occasionally I’d get data dropouts (counted in ms, not seconds), so I wouldn’t depend on a single message to do something, but in general this worked reasonably well for continuous data. Note: I’ve tested this over hours, not days.

Setting up your own WiFi network is the key. To minimize the packet loss I had my router connected over WiFi to my computer, and sensors connected over WiFi to the router. I also would scan the environment for the wifi channels with least networks on them. Channels 1, 6, and 11 are the non-overlapping ones, and thus possibly the cleanest (if there’s no other network on them).

I know this doesn’t meet the original criteria of “process sensor data and make sound on the device” but I thought I’d pitch in on the networking aspect of it. YMMV but I wanted to share my experiences.

We had a similar setup with a dozen Pi 3B wired up through ethernet, even sending audio via ethernet in addition to OSC. This worked basically fine, but the Pi 3B is really at the lower limit for this kind of stuff; prepare for some frustration with freezes and such, especially during development. The Pi 4 is a lot more capable, I think also the 1 GB RAM of the Pi 3B is a problem, so I think the sweet spot is Pi 4 with at least 2 GB RAM, perhaps go for 4 GB and you won’t curse in future projects. Beware that the prices are quite up at the moment, and many large distributors ran out of Pis, seems Element 14 has issues satisfying demand, so may need to look around to find stores that have them in stock.

Cannot really say anything about high power audio output, only that the C-media chip based “USB stick” stereo interfaces at 5 EUR or so are quite capable. I think the Bela only makes sense when you need low latency, so it will depend on whether you need quick feedback’ish or live electronic processing. Otherwise stock Pi is fine, and the big plus is you have a regular linux OS.

Getting distance sensors might be the most difficult part, especially if they need to work at different angles etc. Threshold based motion detection is a lot easier and cheap with PIRs. Analog sensors on the Pi have the disadvantage against Arduino that you need to add an A/D converter as well, and possibly a Logic Level Converter between 3.3V and 5V.

I’ve had similar experiences. UDP over WiFi does drop packets. If it’s your own private network, it will probably drop fewer of them, but there aren’t any guarantees.

It can be good enough for a lot of applications (e.g. streams of data in multiple messages) but there’s no magic bullet to make UDP+WiFi never drop messages.