Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 24 of 24

Thread: Teensy or Arduino?

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    2

    Teensy or Arduino?

    I've spent hours on the Arduino forum asking questions. I haven't gotten anything yet.

    I've looked at the pictures of the Teensy 3.1 & I've seen 2 or 3 labels for the same pin. I assume that the functions of some pins are shared. That's why it's called "teensy"! Is my assumption correct? So, I suppose that the function of the shared pins has to be specified in the "setup" part of the sketch, right?

    Now the main question I have is - Teensy 3.1 or Arduino Due? I haven't had much luck finding information on the 'net comparing the Teensy 3.1 with the Arduino Due. Are shields available for the Teensy or is it too small to have shields?

    It's neat that it can plug directly into a solderless breadboard but I haven't seen any Teensies with headers. Are they available?

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,769
    In both Arduino and Teensy setups, pins can do multiple duty. For example the pins A4 & A5 are the control pins for the only or main i2c bus on both the Teensy 3.x and Arduino Uno (note, other Arduino processors put the i2c bus on different pins, but the pin assignment of the Teensy tends to mirror the Uno). If you don't plan to use i2c, you can use A4 & A5 as two separate analog read pins. If you don't want to use them for analog read, you can use these pins for touch reading. Finally, if you don't want to use the pins for i2c control, analog read, touch reading, you can use them as normal digital input or output pins.

    Most of the places that sell Teensy 3.x, only sell the Teensy without header pins soldered on. The PJRC store will sell Teensy 3.1's with the pins soldered out for $3 more: http://www.pjrc.com/store/teensy31_pins.html

    There are a few shields designed directly for the Teensy, and most of them were done by PJRC, and sold in their store:


    You can get two adapters for Teensy that allow you to use many UNO class shields:


    Note, you need to check the shield to see if it is compatible with 3.3v. You would need to do the same thing for the Due, since it also runs at 3.3v.

    If you want to continue using a breadboard/perfboard, but need to get at the bottom pins, this breakout board might be useful: https://www.tindie.com/products/pico...otyping-area-/

    In terms of Due vs. Teensy, I've never used a Due, so I can't say. During its kickstarter phase, I bought a DigiX, which is a clone of most of the Due, but so far, I haven't even powered it on. http://digistump.com/wiki/digix

    I have made a spreadsheet to cover the various pin differences between the different platforms here that I use to remind myself of the compatibility of each micro-processor: https://docs.google.com/spreadsheet/...WamxfckE#gid=0
    Last edited by MichaelMeissner; 07-01-2014 at 07:15 PM.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Quote Originally Posted by Macnerd View Post
    Now the main question I have is - Teensy 3.1 or Arduino Due?
    Teensy 3.1, of course!

    Seriously though, Due might be a good choice for some types of projects. It really depends on what you're trying to accomplish, which isn't clear to me from your question.

    My opinion is biased, but overall, I believe Teensy 3.1 is much more compatible with the many libraries and sketches published for Arduino. Performace-wise, Due and Teensy 3.1 are pretty similar (even though Due is more than twice the price). Due does have more memory and a lot more pins, so especially if you need a large number of I/O pins, Due might be a good choice.

    So, I suppose that the function of the shared pins has to be specified in the "setup" part of the sketch, right?
    Yes, nearly all the pins have multiple functions. Which function is used depends on the code you write.

    For example, if you use "Serial2.begin(57600);", then pins 9 and 10 are used as RX2 and TX2.

    But if you don't do that, and instead use "pinMode(10, OUTPUT);", then pin 10 becomes an output pin which you control with digitalWrite().

    Or if you intend to use pin 10 for PWM, you'd put "analogWrite(10, number);" in your code, to cause it to go into PWM mode.

    Pin 10 can also be used as a SPI chip select signal. Most libraries that use SPI let you choose which pin you want for chip select. If you wanted to use pin 10 to control a SD card, you use "SD.begin(10);" to tell the SD library to use pin 10. The Ethernet library is the one SPI-based library which requires pin 10, so using Ethernet.begin() implies you've connected pin 10 to a WIZ812 or WIZ820 ethernet adaptor or similar hardware.

    The same is true for the other pins with multiple functions. Which function gets used depends on the code you write. Most libraries and functions will automatically use the pin in the mode your code implies.

    It's also possible to dig into the low-level programming which controls how the pin works. That's a fairly advanced topic, and this message is already pretty long. The basic idea is the pins can do multiple things, and which thing they do is generally configured automatically depending on the code you use.

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,112
    Quote Originally Posted by Macnerd View Post
    Now the main question I have is - Teensy 3.1 or Arduino Due? I haven't had much luck finding information on the 'net comparing the Teensy 3.1 with the Arduino Due.
    On another forum, I mentioned in passing "and some are sort of hanging in there, semi-abandoned in permanent beta but not totally failed yet (Arduino Due)." I was (quite reasonably) asked to back that up. Here is what I wrote (as an owner of one Due, bought the day it was released, and maybe a dozen or more Teensies).

    I was real excited when info on it (Due) first became available and I bought one within minutes of the Arduino shop showing them as a purchaseable item.

    Unfortunately, it was released before it was ready. Its still not, in fact, ready. The MCU is a Cortex M3 with lots of of pins, many of which are not brought out to the Arduino-Mega style external connectors. (Plus the Mega form factor has almost no available sheilds, and sometimes Uno sheilds don't work because SPI and I2C are in different places in the Mega pinout compared to Uno which is what everyone tests with.

    The onboard ADC is only 12bits, and using an external AREF requires desoldering a resistor on the Due board. There is a dual channel DAC, again only 12bits, and due to a bug you could only use one channel. There is CAN bus support on the chip but its not broken out; there is JTAG support but its hidden and you need to solder on a header to use it; there is no JTAG support in the Arduino environment anyway.

    You have to use a special, 1.5.x version of Arduino and this is still in beta.

    Looking at their more recent boards such as Arduino Yn, and the Arduino TRE, they have gone back to an Arduino Uno form factor, voltage levels etc to keep compaatibility with boards and libraries that work (and unfortunately, back to a few kilobytes of RAM and 8-bit processor) while (for the Yn) having a vastly more powerful ARM-based, 512Mbyte Linux computer on the same board running the network and (for the TRE) having a 1-GHz Sitara AM335x running Linux off to the side.

    This seems like a real "tail wagging the dog" approach to me; and it also makes it less likely that they will finish off the Due software and library support. Instead they are regrouping around their most sucessful product, the Uno, and making new two-boards-in-one products that are just the same as Uno for the Arduino half.

    With the price 39 (plus sales tax, so 46.80) and size (102mm x 54mm), I would far rather get a more capable, better supported, smaller and less expensive board that has a wider range of libraries confirmed working. Which is why I switched to Teensy 3.0 (18.95 incl. tax, 35 x 18 mm, Cortex M4 with DSP instructions, I2S and DMA). My Due is sitting in my spares box; if anyone wants to buy it PM me (but I would feel bad for the person that got it, honestly).

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    It is a very interesting decision they've made, using such a small 8 bit AVR chip on Yun and Tre. Many people have expressed their disappointment to me, that these newer products aren't based on more powerful microcontrollers, even though it's a design decision totally outside of my control. I have absolutely no input to Arduino's product decisions. I usually only learn of their decisions when everyone else does, when they announce publicly at Maker Faire.

    Every time this conversation has come up, and believe me, it's come up many, many times... the sentiment I've heard is pretty much exactly what you've said. Many people feel they're abandoning development Arduino Due. I'm not sure if that's really true. Recently I saw an interview with Massimo, I believe it was with Adafruit, or maybe it was at Maker Faire, where someone asked pretty much this question. The answer, of course, was they're continuing to develop for Due.

    Just a few days ago, Cristian merged a 1.5.7 development branch and updated Arduino's release notes, and posted on the Arduino Developers Mail List about an upcoming 1.5.7 release. I haven't looked at every commit, but overall it seems even in the 1.5.7 branch, nearly all the new work is targeting AVR, and Yun's networking features, and improvements in the IDE. The only Due change I could see seems to be supporting Serial.begin(baud, format).

    Then again, often in the past the Arduino Team has done quite a bit of development in private. Then shortly after they begin shipping the hardware, the merge in a private branch and suddenly the github commit history has lots of old entries that weren't visible before. I do pay attention to this stuff.....

    I can tell you I'm most certainly working very hard to develop a lot of great new features on Teensy 3.1. In fact, Teensyduino 1.20 is planned to introduce quite a bit of new "infrastructure" support in the core library, like the new DMAChannel object, which will (hopefully) provide a solid foundation for building a lot of really awesome stuff that really leverages the 32 bit hardware.

  6. #6
    I realize that this is an older thread but I've one related question.

    I've got a project that I'm developing on a Due. I chose the Due because it's fast, more and most of the hardware devices I'm using are 3.3v, it has lots of pins and a Chinese board is cheap. Once my development is done I'm thinking that I might want to move to a teensy (I have an unused 3.0) for a demo version. How difficult is the transition going to be? Can I just hook the pins up, change devices in the Arduino software, build and go? How difficult is it to connect to the teensy's inner pins?

  7. #7
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,769
    Quote Originally Posted by emarsh View Post
    I realize that this is an older thread but I've one related question.

    I've got a project that I'm developing on a Due. I chose the Due because it's fast, more and most of the hardware devices I'm using are 3.3v, it has lots of pins and a Chinese board is cheap. Once my development is done I'm thinking that I might want to move to a teensy (I have an unused 3.0) for a demo version. How difficult is the transition going to be? Can I just hook the pins up, change devices in the Arduino software, build and go? How difficult is it to connect to the teensy's inner pins?
    It probably would have been better to create a new post, rather than bringing up a post from last year.

    Not having programmed the Due, unless you are using Due specific functions or the Arduino style shield layout, it should be fairly easy to transfer from Due to Teensy. It really depends on what you use on the Due.

    In terms of connecting the inner pins, if you are handy with a soldering iron, you can just solder wires to the bottom pads to run the connections out. Or there are several boards that make it easier to bring out the connections (some are finished, and others are pcb designs that you can send out to a pcb house to build boards). And if you aren't good at soldering, there are one or two places you can order an assembled board at an extra cost. I've collected several of these over the years, and ordered some, but I haven't actually done the soldering just yet (note, the 3.0, 3.1, and 3.2 differ in where the reset pad is, so if you don't need the ability to restart the Teensy without you can use any of the designs -- note, 3.1/3.2 have more functionality of the underneath pins than the 3.0 did):


    Note, I've had 1 or 2 failures with the Teensy 3.0 where the programming button came out. The Teensy 3.2's button is much, much better attached. If your button has separated, you can make a button by connecting the program pin to ground on the 3.0/3.1/3.2/LC.

    On the 3.0, the reset pin is on the back pins (reset just restarts the processor, program tells it to send out a request to accept new programming). On the 3.1 it is in a solder pad underneath the Teensy, and the pin on the back became another analog input, and the only analog output pin. On the 3.2, it is also in a solder pad, but in a slightly different location. The other 14 pads underneath are in same location between the 3.0, 3.1, and 3.2. The 4 inner through hole pins and 5 through hole pins on the back are in the same location. Between the 3.0 and 3.1, 6 of the underneath pads gained the ability to be analog inputs, 2 pads gained PWM capability, and a second i2c bus was added.

    The 3.1/3.2 pins are mostly 5v tolerant (except for the analog input pins/pads that do not have digital input/outpus, and some of the special pins). The 3.0 is NOT 5v tolerant.

    IIRC, the Due numbers its serial devices differently than the Teensy (Due has 0/1 being Serial0 while Teensy has 0/1 being Serial1). On the Due, Serial1/Serial2/Serial3 are on separate pins, while on the Teensy Serial2/Serial3 overlap with digital pins.

    Note, the Teensy only has 3 serial UARTs while the Due has 4. Teensy 3.0 has no DAC outputs, 3.1/3.2 has 1 DAC output, while the Due has 2. The CAN bus on 3.1/3.2 (3.0 does not have a CAN bus) overlaps with core digital pins on the Teensy and it doesn't on the Due.
    Last edited by MichaelMeissner; 11-29-2015 at 02:56 AM.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Quote Originally Posted by emarsh View Post
    How difficult is the transition going to be?
    Teensy 3.x has very good compatibility with most sketches and libraries written for normal Arduino Uno, perhaps even better than Due. If you're doing "normal" Arduino stuff, the transition is pretty easy.

    Of course, if you're using Due-only libraries or directly accessing Due's hardware registers, those will tie you to Due's chip. The same is true on Teensy... if you use libraries like OctoWS2811 or SmartMatrix or the Teensy Audio library, there's nothing equivalent on Due.

    Speed-wise, Teensy 3.2 and Due are pretty similar.

  9. #9
    The fast TFT library provided a decision point. I ordered two of the 320x240 LCDs and a Teensy 3.2. My project is using the razor-9dof-ahrs library which performs a lot of floating point calculations (sine,cos, etc). It would be really nice if somewhere down the road you could build a Teensy with an FPU.

    https://github.com/ptrbrtz/razor-9dof-ahrs/

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Yes, a Teensy with FPU is coming next year.

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Quote Originally Posted by PaulStoffregen View Post
    Yes, a Teensy with FPU is coming next year.
    Single precision floating point, as common in ARM Cortex, right?
    I wonder if the FPU in the BCM chips in the RPi has double precision in hardware?
    Diminishing returns for sure, going from single to double precision.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Of course single precision FPU. Eventually as microcontrollers move to 65 or 45 nm silicon we'll see Cortex-M chips with double precision FPUs, but that's at least a couple years out...

  13. #13
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Quote Originally Posted by PaulStoffregen View Post
    Of course single precision FPU. Eventually as microcontrollers move to 65 or 45 nm silicon we'll see Cortex-M chips with double precision FPUs, but that's at least a couple years out...
    ARM VFP9 and VFP10 FPU shave double precision FPU. But these are found only on the big ole Cortex A8 and up

    The ARM VFP10 is a hard macrocell Vector Floating Point (VFP) coprocessor compatible with all of the ARM10E™ family of CPU cores. It supports both single and double precision floating point; giving full IEEE754 compliance with ARM support software, or near IEEE754 compliance with hardware only. The support code has two components, a library of routines which perform unimplemented functions (such as transcendental functions) and some supported functions (such as division) and a set of exception handlers for processing exception conditions.

  14. #14
    Junior Member
    Join Date
    Aug 2016
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    Yes, a Teensy with FPU is coming next year.
    are you working on this ?
    Whitch MCU will use ?

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Quote Originally Posted by testato View Post
    are you working on this ?
    Yes! It's been in beta testing since May. Full release is scheduled for October. All the info is here:

    https://forum.pjrc.com/threads/34808-K66-Beta-Test

  16. #16
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,769
    Quote Originally Posted by testato View Post
    are you working on this ?
    Whitch MCU will use ?
    There will be two processors coming out, one based on the MK64FX512 and the other based on the MK66FX1M0. The later is currently in beta test (there is a thread about it in the announcement forum). Note, these processors only have hardware single precision floating point. Double precision floating point will still need to be emulated.

  17. #17
    Junior Member
    Join Date
    Aug 2016
    Posts
    3
    but if i use a double in my code the FPU will completely bypassed ?
    So on a code whit double there is no execution difference from a Teensy3.2 to 3.5 ?

  18. #18
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,769
    Other that processor speed improvements due to cycle speed, you probably will not see any performance if you use double. You will see a big performance gain using float.

    Note, if you use the math library functions, you would want to use the float variant that usually has a 'f' suffix (i.e. use sinf instead of sin).

    You should also get in the habit of using a 'f' suffix on constants (though on Teensy, they use an option to make floating point constants float by default, but it is a good habit to fully decorate your constants so that the compiler does not perform the calculation in double due to standard promotion rules).

  19. #19
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Correct, the FPU in these chips only supports 32 bit single precision.

    Quote Originally Posted by testato View Post
    So on a code whit double there is no execution difference from a Teensy3.2 to 3.5 ?
    Yes, double is handled by the same library routines, but the clock speed is higher on the new boards.

  20. #20
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,279
    Even on Teensy 3.2, you should really avoid double if you can. Floating point has a somewhat undeserved reputation for terribly slow performance. Sure, it is much slower than integer math, and especially 16 bit integers if the code is highly optimized to take advantage of the DSP extensions. But 32 bit float on ARM isn't nearly as slow as many people believe. The barrel shifter and well thought-out instructions in the ARM core make fairly quick work of emulating 32 bit float, because the entire mantissa fits into a single hardware register with bits to spare.

  21. #21
    Junior Member
    Join Date
    Aug 2016
    Posts
    3
    Thanks for the clarifications.
    May you post a benchmark on the new 3.5/3.6 teensy whit a simple millis time mesaurement for math whit:
    Int 8-16-32-64
    Float
    Double
    All whit FPU on and FPU off

    I think it is a good real examples for understand the real improvement of the new teensy
    The same code executed also on an ArduinoUno for a baseline.

  22. #22
    Senior Member
    Join Date
    Jan 2013
    Posts
    184
    Quote Originally Posted by testato View Post
    Thanks for the clarifications.
    May you post a benchmark on the new 3.5/3.6 teensy whit a simple millis time mesaurement for math whit:
    Int 8-16-32-64
    Float
    Double
    All whit FPU on and FPU off

    I think it is a good real examples for understand the real improvement of the new teensy
    The same code executed also on an ArduinoUno for a baseline.
    See this post. I know it's a lot to search for but there might be additional posts in that thread talking about what you are asking about.

  23. #23
    Junior Member
    Join Date
    Jun 2020
    Posts
    1
    Hello, I'm new here. Someone can tell me does Teensy have starter kits? I just find Arduino Kits. Can u tell me where I can find Teensy's?

  24. #24
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,962
    PJRC doesn't offer any sort of Complete multifunction starter kit beyond:

    pjrc.com/store/tutorial_kit.html :: parts needed to complete the web page tutorial steps

    Or if looking to use the Audio board and Teensy purchased separately:
    pjrc.com/store/audio_tutorial_diy_parts.html

    There other offerings for some necessary parts following those links perhaps or :: https://www.pjrc.com/store/

    In general if one of the linked kits were purchased and the included 8 bit Arduino/Clone board were set aside ( if included ) - a properly chosen Teensy with enough pins could be substituted as it supports the same Arduino environment, just using a more powerful 32 bit microcontroller - and perhaps limited to 3.3V operation where the kit may have parts expecting 5V function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •