Teensy boards, for the uninitiated

In another thread (Adding Ethernet…), the Teensy boards were mentioned. For newcomers to the platform, here are a few tips to prime the pump:

  1. The links in the main Teensy 4.1 page really are an excellent starting point: https://www.pjrc.com/store/teensy41.html (Naturally, there are similar pages for the 4.0, 3.6, 3.5, …)

  2. To work with the board, install the latest version of the Arduino IDE**, then install https://www.pjrc.com/teensy/td_download.html to use the Teensy-specific libraries and the glass-smooth flasher. You may have to select the Tools/Boards/TeensyDuino/4.1 menu option. After that, compiling and flashing your “Hello World” is a one-click process over USB, without touching the target hardware. It’s very similar to Nucleo/Disco board (with on-board ST-Link), with even less fuss.

3.** Yeah, I hate the Arduino IDE too and use VS20xx & Resharper C++ for as much of the coding as possible. If I used the Arduino platform more overall, I’d probably create the necessary scripting to compile and flash the Teensy from VS. Reportedly, it’s not all that difficult.

  1. The virtual serial, HID device and binary block exchange (64KB @ 1kHz) are all seamlessly handled by the Teensy libraries. The first and third ones work really well. (I haven’t tried using one as part of a HID device). I’m guessing that you (especially the OP of "Adding Ethernet…) will find the serial support to be of particular interest.

  2. https://forum.pjrc.com/ looks really old-school, but there are something like 1/4 million posts and the quality of information provided is generally quite high.

  3. The PJRC website doesn’t look very modern either, but it does contain lots of useful info, for a wide variety of applications. Notably, it’s also maintained by hand and the entire thing is available as a ZIP file. Not sure what one would do with that, but it’s interesting and demonstrates PJRC’s truly open-source approach.

  4. https://www.pjrc.com/teensy/td_libs_Ethernet.html (OP’s question). The photos show dev boards for pre-4.1 Teensys, but the API is the same, for all intents and purposes. As with its pure-Arduino roots, it’s a bit biased toward TCP, but it does support UDP.

  5. If your application requires precise timing, counting, audio or any of many other things best handled by hardware peripherals, you’ll find tuned libraries at https://github.com/PaulStoffregen .

What tips do you have regarding these boards? Have you used them for prototypes, test fixtures and/or projects?

3 Likes

I’ve used Teensy for hobby projects since many years back. It’s a really good platform and Paul Stoffregen (and Robin) are doing an amazing job with it. If you want to do fast LED animation or realtime Audio, this is a fantastic place to start! I don’t have hard numbers for it, but I have seen Paul’s name on countless bug fixes for the Arduino platform. He truly is a nice guy and the forum on PJRC is very friendly (just remember remember to post code).

Recently I’ve started using Teensy as part of customer projects and it’s really easy to spin up a board using this as the platform. If anyone want to get started making custom boards based on Teensy, I have verified Kicad files available for download for Teensy 3.2 and Teensy 3.6.

3 Likes

the teensy is a great platform. i built an audio mixer with one as a tech demo for a client. paul is a super nice person and very knowledgeable. wish i remembered to use it more :slight_smile:

they sell the preloaded chips too.

I’ll find out tomorrow if we’re going to use one for an ethernet project (UDP converter). Will post findings here if we do!

I use a Teensy 4.1 in my grblHAL breakout board. With grblHAL software, it forms a powerful motion controller for CNC machines like routers, mills, lathes, laser cutters and so on.

It is a great platform with lots of connectivity and outstanding performance. Costs less than the original Arduino Uno with dramatically higher performance. With it, my board can drive a stepper motor pulse rate in excess of 400 kHz. Most professional motion controllers don’t go above 200 kHz.

I have customers that use my board to build all sorts of interesting machines. One is in the custom lighting business and uses it in a machine that laser etches light diffusion rods. He tells me it it is significantly faster than his previous machine based on an ARM M4.

1 Like

Well my Teensy has arrived, but work has been busy (even though I’m supposed to be on vacation) so I’ve not had a chance to have a proper play yet. I was shocked when I opened it up - I expected a much larger board for some reason. It brought back memories of seeing a Gumstix board for the first time in the early 2000s. As for my project, I’ve got a crude version up and running on a STM32 with Wiz850io so I’m busy designing a PCB around that. The Teensy deserves a far more fiendish project :slight_smile:

And, I couldn’t resist ordering one of Phil’s breakout boards. 2022 may finally be the year of the CNC Plasma Cutter!

Thanks for the order! It will probably ship on Boxing Day.

You might be interested in the torch height controller work that Terje Io is doing for grblHAL. Also, I have a design for an isolated ADC daughter card to support that. Am considering productizing it - if not will place into open source. Contact me via email once I send the “thanks” message. Relatively easy to build for someone with a little soldering skill. The chip shortage not withstanding…

1 Like

Glad your project is going well.
Your Gumstix comment reminded me of an event earlier this year: I stumbled upon my 25+ year old BASIC Stamp. Even though I know I’m not “supposed” to be impressed, I can’t help but be somewhat, given the horsepower provided by the stamp versus the Teensy 4.0 - or even a Trinket M0 - all with essentially identical footprints.

1 Like

Teensy schematics - that’s pretty cool. When I first (mis)read your comment, I thought you were just referring to the footprints.

I considered it building a similar schematic into test fixtures a few times. Although the 0.1" headers are breadboard friendly, the pins/pads are chunky and can be kind of a drag for layout.

However, the things that have held me back were (a) why introduce a new variable. There’s a nonzero chance that I would make a mistake transcribing Paul’s schematic. With your verified schematic, that barrier drops away. And (b) 1 definite plus of using the Teensy as a daughter board is that you essentially get six layers for free. The layout - especially on the 4.x boards is really quite tight and clean - almost certainly better than I would achieve in the amount of time I’d like to dedicate to the task. However, with a known-good starting point (the verified schematic), it might be a fun subtask in a future project.

Somewhat ironically, the next one on deck is an audio processing personal project where I’d like to use the SGTL5000. And, the only place I’m aware of to obtain two of those ICs: PJRC’s audio adapter - a board specifically designed to solder onto the production Teensy 4.x (there’s also a 3.x model). …!?.. I haven’t decided whether to depopulate the chip from the audio adapters or mount the entire audio adapter board, using its 0.1" headers, though it’ll probably be the latter, since I’d like to do additional signal processing after the SGTL5000 - not output directly to the line-level 3.5mm jack. All TBD.

Anyway, thanks for sharing those schematics.

1 Like

Np. Regarding the SGTL5000 on the audio adapter - why not solder headers to the adapter and then just use Jumper wires initially? Also - if you hurry, you can probably get 5 of the SGTL5000XNAA3R2’s from Mouser https://www2.mouser.com/ProductDetail/NXP-Semiconductors/SGTL5000XNAA3R2?qs=sGAEpiMZZMsVgcksf1EMUp%2F8sqqLS3owFKngqcpiWOo%3D :smiley:

I have a few of the basic stamp homework boards, and I think they’re great for lots of projects. They were surprisingly adept when they came out, and they’re still plenty powerful for projects. The BASIC instruction set has several useful functions for controlling hardware, and they are still great little breadboarding modules!

Great find on the Mouser stock. I must have missed 'em there. Fixed that problem by snatching them up. Thanks.

As for my motivations for using the IC rather than the board: aesthetics are a part of it, but really my main goal is to keep it the whole assembly electrically quiet. Fewer “antennas” feels like less noise.

That said, I don’t think I’ve ever done an audio project, aside from my goofing around with ham radio. So, I’m a novice hoping to minimize noob mistakes.

My specific goal is pretty niche - even by embedded standards. I’m trying to design a system that will improve my sleep (fairly bad insomnia) by finely controlling the lighting levels, color temperatures, as well as the volume and tonality of generated ambient sounds. I don’t want to turn it up to 11 - ever. I want the whole apparatus to slowly and smoothly taper off about 1 to 0 (black/silence).

From my experience with precision color measurement and spectroscopy, where light is really easy and dark is really hard, I have a feeling that loud is fairly easy and quiet will be fairly difficult.

I have Philips Hue smart bulbs/lamps and decent audio gear, but both taper off in quantum steps that are large enough to catch my eye and/or ear - thus returning me to undesired wakefulness. The dream is to create a purpose-built that does these few, specific things better.

My experiments so far suggest that if the device works, these technique/s may be very effective. Fingers crossed.

Thanks again.

3 Likes

Sounds like a really cool project!

You may know this already, but we preceive sound amplitude logarithmically, so to get a smooth, or maybe ‘linear’ loudness controll, you may consider decrasing the signal amplitude logarithmically.

Good luck,
Pete

First post here… I’ve used the Teensy in various forms quite a bit, but never for audio. I have, however implemented a slew of various audio DACs and codec interfaces to other Arm Cortex Mx MCUs over the years. I’m not sure what the Teensy audio library exposes or provides for customizing the audio and control interfaces, but it can be a lot of work. With most stereo DACs and codecs, the audio interface is I2S and the control interface, if there is one, is either I2C or SPI. All of these protocols, along with the Master Clock, have various options and both sides have to agree on literally everything or else you either get no audio, or awful sounds. I don’t think I’ve ever gotten it right without a scope on both interfaces, along with a way to play, record and analyze A440 sine waves.

It can certainly be a fun and educational project, if that’s what you’re looking for. I’m happy to try and answer questions along the way. If you want to just get up and running playing audio, however, I might suggest the Teensy audio board and library, a WAV Trigger or even a Raspberry Pi with a HiFiBerry HAT.

Just my 2 cents.

I used a Teensy 4.1 to convert my old Firewire audio interface to USB. I had to modify the teensy libraries to support 48k 24bit audio, but it worked well - on windows. On Mac I was having the occasional buffering issues, from memory something to do with the isosynchronous adaptive delay being implemented strangely on osx.

odd coincidence robert the audio project i mentioned a few comments ago for a client was because i wasn’t able to use the existing trigger as is and the firmware costs where too high, small world though :slight_smile: