Two Teensy 3.6 to work together

Lestra

Member
Hi everybody, I am so excited to be here for the first time but be aware I am total newbie!

I want to build Midi Xylophone and my questions to you guys is:

  1. Is it possible to connect/merge two Teensy 3.6 to work together? It is because I need 48 analog inputs in total.
  2. If two Teensy works together does it slow down? Significantly?

Thanks in advance.
 
I'm not sure if that's the best solution because even with so many analog inputs, each Teensy might (and only with hand-optimized code) read 2 analog inputs at a time. Using more will force you to write code to cycle through the different inputs and to look if the level of one of them has changed. This will slow everything down ways more than a hi-speed SPI communication between two Teensys. I'd rather go for external multi channel ADCs and use just one single Teensy to collect data from all these and generate the sound.
 
Theremingenieur thank you so much for response. As a musical instrument xylophone must be able to play 4 notes (with 4 mallets) at the same time.

Please tell me is "external multi channel ADC" some sort of analog inputs extended "device"? And could you please point me to good one? Thanks.
 
First, to answer your question, yes there are several ways to use more than 1 board. All of those ways involve trade-offs, so which would work depends heavily on the details of what you're actually doing.

With piezos, there are 2 basic approaches to capturing the height of the peak that occurs when the sense a mechanical shock. The way that is simple hardware-wise requires quite a lot more work on the software. You need to sample the waveform at a consistently high speed, so you don't "miss" the moment when the voltage is at or very close to the peak. Teensy's ADC is very fast relative to the speed of those waveforms, but if you try to time-mux is between 20-some signals, you're spreading things pretty thin. You also have some processing of the data to do, especially so you don't mistake aftershocks and small discontinuities in the waveform rise to the peak as false readings. You can find example code in File > Examples > Teensy > USB_MIDI > Piezo_Drum.

The other way involves building much more analog hardware, but then is greatly reduces the need for speed and post-processing in software. This involves a sample and hold circuit which tracks the highest peak. Your code can read it at a leisurely pace, where the only timing that's really important is resetting the circuit quickly after reading, so you don't "miss" a new peak. About 26 years ago I built an 8 channel MIDI drum machine using this technique. Here's some info:

https://www.pjrc.com/tech/midi-drums/sch-ana1.html

Teensy's ADC is so much faster than that ancient chip, which admittedly wasn't all that fast even in 1991. Back then the fast sampling approach really wasn't feasible. Today, it is. Still, if you prefer the idea of analog circuits and simpler software, this would be the way to go.

Regarding using 2 boards, if you go that route, I'd suggest serial communication for this particular project. Assuming you don't send too much data too quickly, which really can't happen if your code is properly waiting for aftershocks before watching again, with serial you can just use Serial1.write() and the data goes quickly into the transmit buffer. Then your code can keep working on monitoring the inputs. Likewise on the other board, it's probably busy reading inputs. After each scan, you can use Serial1.available() to see whether the other side has sent data, which is sitting in the receive buffer. Presumably you'd send MIDI or trigger the audio library or do whatever else you're going to actually do with the data, both from the measurements and whatever you got with Serial1.read() from the other board. The buffering and 1-way data flow will make this project easier, if you build it around multiple boards.
 
PaulStoffregen thank you so much for your time and effort.

I find that one of the best electronic xylophone (MalletKAT) use FSR instead of piezo. Please tell me your opinion, which sensor is better for this job?
 
I have used piezos and FSR for drum triggers. Piezos are very cheap, sensitive, but act somewhat like a microphone so they are prone to mis-triggers from adjacent drum pads. That can be handled, to some extent in more complex software to analyse the signals and decide which pad is giving the strongest trigger signal.
FSRs are more expensive- 5+ dollars in my experience. But they only respond to a pressure on the face of the FSR itself. So mis-triggers are not an issue. I don't believe they respond as quickly, and you do have to be able to direct the drum stick hit from the (larger) pad to the small FSR surface, and the force has to be perpendicular to the FSR face, for the "velocity" to be represented properly.
So, there are plus/minus's to both devices.
 
This is exacty what i built, it can be done with one teensy 3.5, some multiplexers and a sheet of velostat
 
Remcoh thank you so much for response. Any chance to show any image/video/instruction or code please? Could you share your experience?
 
This is exacty what i built, it can be done with one teensy 3.5, some multiplexers and a sheet of velostat

I know it's almost 8 months since you posted this, but do you have any pictures or video walkthroughs that you could possibly post? I'm really looking at building my own mallet controller as I would love to build my own how I want it, but need to see how I should get everything designed and started.
 
Back
Top