Gas station without pumps

2015 August 10

PteroDAQ supports Teensy 3.1

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 00:25
Tags: , , , ,

In one day my son and I added support for the Teensy 3.1 board to the PteroDAQ data acquisition system that previously supported the Freedom KL25Z board and the ATMega-based Arduino boards.

We ended up using the Teensyduino development system, but really only for the downloading and for the usb-serial library, since the K20 ARM chip on the Teensy 3.1 is quite similar to the KL25 that we originally based things on.

The Teensy 3.1 is a lot easier to install the software on than the Freedom boards, and runs a little faster (72MHz instead of 48MHz), but has essentially the same ADC.  Actually, it has 2 analog-to-digital converters, but most of the pins can only be read by ADC0, so we’ve not set up ADC1 to read anything but the internal 1.2V Vref (which is conveniently provided as an output on the AREF pin).  We had originally planned to use just ADC0, but the code for reading the Vref signal on ADC0 never worked—I suspect an error in the reference manual, since changing to reading Vref with ADC1 worked fine.

The Freedom boards are cheaper, are easier to unplug the USB cables from, can deliver more power at 3.3V, have RGB LED, and have a lot of neat features missing from the Teensy boards, but the Teensy boards can be configured to plug directly into a bread board (if you give up a lot of the connections and just use 26 pins), and have more RAM (so can run for longer at high sampling rates before the buffer overflows).

I’m going to have to rewrite part of my book to talk about the possibility of using the Teensy 3.1, and I’ll have to decide whether the extra $6–$7 is worth the simpler setup for my Applied Electronics lab course. We’d sacrifice being able to get much power from the board (probably only about 100mA instead of 500mA at 3.3V), but that is a relatively minor loss, since we have bench power supplies at every station.

I’m not sure what I’ll recommend in the book for people trying to learn on their own—I’ll probably have to play with the Teensy a bit to see how useful it is.  I have at least one other program that the students have been using in the lab (the frequency detector for turning a relaxation oscillator into a touch sensor) that I’ll have to port to Arduinos and the Teensy 3.1.

For home hobbyists who aren’t planning to dive deep into embedded-system programming, the Teensyduino IDE is a lot friendlier than the MBED.ORG tools (and I hear that the Kinetis SDK has a very, very large learning curve), so it might be a better board despite the lack of peripherals (no accelerometer, RGB LED, or capacitive touch slider).



  1. I agree, the Teensy v3.1 is a great board. There is as well a lower-cost version (LC) one (, but I have not tried that one myself. The only missing feature on the Teensy is that it does not have a debug/SWD connector, so you cannot debug the board with usual tools. In other words: you are limited to printf() and LED blinking style of debugging. That might not be an issue for simple applications where that kind of debugging might be appropriate (but not very time effective). I have hacked the board to make SWD debugging possible (, and at the university we developed an adapter board so it is not necessary to cut traces (you still need to solder some extra wires). I plan to write an article about this as soon time permits it.

    Comment by Erich Styger — 2015 August 10 @ 00:43 | Reply

    • Perhaps PteroDAQ should support the TeensyLC, but I’m not real excited about only a 12-bit ADC. We supported the Arduinos because of their ubiquity—many people already have them, so it was good to provide a no-cost way to use PteroDAQ—not because the Arduinos are a good choice for data acquisition. Only 8kB of RAM is somewhat limiting also (half the KL25Z). Since the tiny form factor is not a major win in the data-acquisition application, I think that the FRDM-KL25Z (already supported) beats the TeensyLC on everything that matters here.

      I am curious how fast I can sample on the Teensy 3.1 with a modern laptop—I’m currently limited by the speed of Python on my MacBook Pro (and a bad bug in OS 10.6.8 that causes it to lose bytes when the USB buffer isn’t emptied fast enough—that bug seems to be fixed in new OS X systems).

      Comment by gasstationwithoutpumps — 2015 August 10 @ 16:04 | Reply

      • Correction: my son points out that the TeensyLC is a KL26Z, which is almost identical to the KL25Z we’ve been using. It has a 16-bit ADC, though, like the KL25Z the effective number of bits is somewhat less, because of the noise injected into the analog inputs. So we probably should support the TeensyLC—it would be a very easy change to the code (though I’ll have to buy one to do testing with).

        Comment by gasstationwithoutpumps — 2015 August 10 @ 21:30 | Reply

  2. Oh, yes, just wanted to point out about the 16bit ADC. I have not used the KL26Z much, and there is a FRDM board for it too (I have two with which I played with). Additionally it comes with I2S. In general, the KL26Z is the ‘newer’ device after the KL25Z,

    Comment by Erich Styger — 2015 August 10 @ 21:35 | Reply

  3. […] the Teensy 3.1 board to the PteroDAQ data acquisition system only took a day of effort (see PteroDAQ supports Teensy 3.1), and it looks fairly straightforward to extend that support to the Teensy LC, which at $11.65 […]

    Pingback by PteroDAQ will support TeensyLC | Gas station without pumps — 2015 August 11 @ 07:49 | Reply

  4. […] the Teensy 3.1 board to the PteroDAQ data acquisition system only took a day of effort (see PteroDAQ supports Teensy 3.1), extending that support to the Teensy LC, took only a couple of hours, since it just meant adding […]

    Pingback by Teensy LC support for PteroDAQ written but not tested | Gas station without pumps — 2015 August 13 @ 19:29 | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: