Custom Teensy PCB

Status
Not open for further replies.

c1223

Member
I'd like some feedback if possible on a project that will need to appear to a computer as a USB MIDI device. At the moment I've prototyped this using a Teensy 3.2 which works wonderfully. I want to move the whole design to a custom PCB which is fine - I've done them before. However I'm not entirely sure of the feasibility of this or whether there is an easier way?

Essentially there will be 5 push buttons that trigger MIDI commands and 5 WS2812B LEDs relating to the buttons. That is it.

1) Is it possible to do a custom layout with a 2-layer board? Bearing in mind the board will be 10cm x 6cm, so there is plenty of room on it.

2) From what I have read so far, it seems like you can't just take the components from the current design and put them in a new layout for a custom PCB?

3) Can anyone point me toward any datasheets that I should get reading? I think I need in particular a datasheet for the bootloader chip and CPU probably?

Cheers
 
Ah I managed to miss the pin information on that page!

Is there a BOM for the Teensy 3.2 available?

Thanks
 
The next question I have is whether it's possible for the Teensy to appear to two computers at once as USB MIDI devices? I've started poking around the USB Midi library to have a look, but haven't got so far yet.

Is there a way to output USB MIDI to one computer via the USB Serial port and then also to another computer via the UART pins? The messages would be identical.
 
whether it's possible for the Teensy to appear to two computers at once as USB MIDI devices?

USB is designed for a single host to communicate with many devices.

For background on the meaning of USB terms like "host" and "device", take a look at chapter 4 of the USB 2.0 spec.

https://www.pjrc.com/teensy/beta/usb20.pdf

This is a huge PDF, but chapter 4 is short and easy to read. For any sort of custom USB development, these key concepts are essential info.
 
Is it not possible to have the Teensy appear as two devices? Or would I run into problems if the voltage between V+/GND on the two computers was different?

So presumably my only option is to have it as I have done my prototype, and have all the buttons connected to two Teensys, via Schottky diodes, which in turn connect to two separate computers?
 
Problem is you can't have a single Teensy being a USB device on two computers on the same time on the same port. USB specifically assumes only one host, and skipping multiple hosts is why USB is even possible on a micro controller. If you want peer to peer you'd look to ethernet.

You can certainly send the midi out the onboard serial port and if you can find a device that'll parse serial midi at 3.3V into USB midi then good to go. I have a similar case where I need two USB serial ports and use a USB-> serial adaptor to be my interface to PC code under test while normal serial port is where the debug happens. Of course USB-serial adaptors are easy to get, no idea on midi.

That said a Teensy LC could very easily become an adaptor running alongside your existing project, dumping serial data out it's USB port. I suspect far easier to put together something like that where second device is just a dumb repeater than two devices getting button presses that maybe one would miss or otherwise have sync issues.

While doing this electronically is always awesome, is this a case where doing a computer-computer link the share the midi might actually be easier?

Also yes any situation where you have two computers connected via one or more Teensyies you have a very real problem with grounding and slightly different 5V supplies making life exciting, Have blown up stuff myself that way. Check with a multimeter before connecting two mains powered devices together, even if the + to - voltages are the same. One may have 100V on the red wire and 95 on the black.
 
If the code requirements are modest then I would consider doing this project with two LC's. They are less expensive than a 3.2 and sound like they could do this project w/o issues.

One LC would be acting as the master (doing the DAQ for the buttons) and then send data serially to the slave LC.

For safety, I would connect the two teensy's to each other using a dual opto-isolator, so they can each float at their respective voltages without hurting each other. Naturally, this means two ground planes as well, with a 0.3" moat between the two ground planes.

The EasyTransfer library makes sending data between Teensy's very easy.

Last but not least, I would consider shipping your first revision with fully assembled LC's, shake out the bugs, and only then venture into designing a custom Teensy board. Yes, there are improvement opportunities (the mechanical strength of the USB connectors comes to mind) but they are minor compared to the hair-pulling potential of designing a 'custom Teensy' and discovering that something was overlooked, causing another delay, and so on.

Over on Tindie, you can see some pretty innovative ways that users have managed to mount teensy's PCB to an underlying PCB that allow the resultant sandwich to be quite flat.
 
Thanks for the replies!

The reason behind the two separate connections to two computers is failover. The buttons trigger a program via MIDI control, and this program needs to be triggered on both PCs at the same time (or as close as possible). If one PC goes down, the second one still needs to be functional. Therefore it isn't possible to do a computer-computer link to share MIDI.

From research I've done regarding using an FTDI chip, the latency (16ms) introduced seems to be a problem. You can seem to reduce that down to 1ms, but I'm not entirely sure whether it'll be work. It might be something I try to prototype and look into.

The first prototype I did had two Teensyies attached to the PCB. The grounds were tied together and the buttons connected to the individual Teensyies via Schottky diodes. It all worked perfectly, and as you suggest Constantin, the bugs have been shaken out (e.g. I'm going to add electrical debouncing). This is what I have:

KmC3orH.png


rw36IIs.png


Given the board size, I want to try get a custom (or two) Teensy on to it as there should be plenty of space. What I want to avoid is height (i.e. having to stack a Teensy onto the PCB with header pins etc...)
 
So presumably my only option is to have it as I have done my prototype, and have all the buttons connected to two Teensys, via Schottky diodes, which in turn connect to two separate computers?

Yes, that is the best way to get the failover capability you want.

You should probably use 2 diodes to combine their power, so the Teensy gets power when either USB is working, but neither can feed power back into the other.

From research I've done regarding using an FTDI chip, the latency (16ms) introduced seems to be a problem. You can seem to reduce that down to 1ms, but I'm not entirely sure whether it'll be work. It might be something I try to prototype and look into.

Yes, use Serial.send_now() after you've completed writing a set of data which you would like delivered to the PC with minimal latency.
 
Hypothetically, with a shared ground, if the USB power on one of the computers had 100V on the V+ and 95V on the ground, I'd run into problems? Is there a way to combat that without optoisolating between the two different supplies?
 
Can confirm it's a problem since I had to buy a new TV. Was a 5V wall wart powered Raspberry Pi that (among other things) monitoring TV on/off state via it's USB power - TV was properly grounded, the phone charger wasn't so the two '-ve' were far enough apart for smoke. Quick check now got 10V AC between my desktop PC USB port and the USB charge port built into the adjacent power strip which is daft since the power strip has an earthed internal chasis.

In most cases Just getting reasonably solid ground wire between the units before power up (and making sure it's not switched through the off switch) will get them to the same potential and things will work, maybe with one not running quite as efficiently as it should because it's 'negative' is feeding power to the gnd but normally talking mA or less. Problems arise if a power supply is poorly designed or otherwise leaky and if you blow one of them up then you probably needed to replace it anyway.

Simple check is to put meter between the two BEFORE plugging them together and seeing what you get (both DC and AC)
 
If this was my project, I'd opto-isolate due to the damage potential. Why risk a expensive computer or two in case something goes sideways between their power supplies as described above?

If timing is critical, opto the outputs from the buttons themselves and run the same program, completely independently, on both LC's. One of the two Teensy's (presumably the master) would power the DAQ portion, including the VCC of the optos.

LTV-844 has worked great for me and is AC tolerant. I've used it on the input side (isolating an HVAC system AC signal) as well as on the output side (using it to control the fan speed of my humidifier). DIP form factor makes smoke-inducing mistakes easy to remedy.

If you move the teensy's to the edge then mounting them via reflow paste directly to the underlying PCB becomes possible while retaining use of the USB connector. Obviously not a concern should you do DIY.
 
Last edited:
Status
Not open for further replies.
Back
Top