Getting Started with the Teensy
Introduction
The Teensy line is a collection of microcontrollers from PJRC based around several different powerful ICs. This basic getting started guide will help you start using the Teensy that's best for your project.
Required Materials
To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary. You will need the appropriate USB cable for the Teensy board with which you are working. The following boards work with the micro-USB cable:
The Teensy++ 2.0 works with the mini-USB cable:
You will also need the appropriate headers for your project. There are several different options available. Below are a few common headers used with the boards.
Tools
You will need a soldering iron, solder, and general soldering accessories. We recommend the beginner Tool Kit for soldering any of the Teensy boards.
Alternatively, if you are planning on doing a lot of intense soldering, you can also use the following wishlist as a guide.
Suggested Reading
If you aren't familiar with the following concepts, we recommend reading these articles first before continuing with this getting started guide.
How to Solder: Through-Hole Soldering
Serial Communication
Installing an Arduino Library
Serial Peripheral Interface (SPI)
Installing Arduino IDE
Suggested Viewing
Check out some of the related videos.
Hardware Overview
Each Teensy board has its own key features which are highlighted here. For individual pinout diagrams and detailed schematic information, please check PJRC's page here. The pin functionality for each version is can be different so make sure to check before switching versions.
For full specifications and detailed comparison chart of the Teensy, check out respective product pages or the Teensy Technical Specifications page.
Teensy 4.1
The Teensy 4.1 builds on the Teensy 4.0. The size is uses the same size and footprint as the Teensy 3.5/3.6. Most technical specifications are the same as the Teensy 4.0 except with a few expanded features. Some of the more notable features include pins for Ethernet port (10 / 100 Mbit DP83825 PHY), host USB port, options to expand memory with two locations to solder SOIC memory chips, and a microSD card socket. This runs off of the NXP iMXRT1062 IC, which is a 32-bit ARM Cortex-M7. It is 3.3V tolerant only on its I/O pins.
Feature | Number Available |
---|---|
PWM | 35 |
Analog In | 18 |
I/O | 55 |
Serial Port | 8 |
I2C Port | 3 |
SPI Port | 8 |
Real Time Clock | 1 |
Flash | 8MB (64K reserved for recovery & EEPROM emulation) |
RAM | 1024K (512K is tightly coupled) |
Teensy 4.0
The Teensy 4.0 is the same size and footprint as the Teensy 3.1/LC but even more powerful with its whopping 600MHz clock speed! The pin functionality is slightly different compared to the other versions. This runs off of the NXP iMXRT1062 IC, which is a 32-bit ARM Cortex-M7. It is 3.3V tolerant only on its I/O pins.
Feature | Number Available |
---|---|
PWM | 31 |
Analog In | 14 |
I/O | 40 |
Serial Port | 7 |
I2C Port | 3 |
SPI Port | 3 |
Real Time Clock | 1 |
Flash | 2048K (64K reserved for recovery & EEPROM emulation) |
RAM | 1024K (512K is tightly coupled) |
Teensy 3.6
The Teensy 3.6 uses a similar pinout as the smaller Teensys. However, the board breaks out more pins and includes a microSD card socket. This runs off of the MK66FX1M0VMD18 IC, which is a 32-bit ARM Cortex-M4. It is 3.3V tolerant only on its I/O pins.
Feature | Number Available |
---|---|
PWM | 22 |
Analog In | 25 |
I/O | 62 |
Serial Port | 6 |
I2C Port | 4 |
SPI Port | 3 |
Real Time Clock | 1 |
Touch Sense pins | 11 |
Flash | 1024K |
RAM | 256K |
Teensy 3.5
The Teensy 3.5 is similar to the 3.6. This runs off of the MK64FX512VMD12 IC, which is a 32-bit ARM Cortex-M4. It is 5V tolerant on its I/O pins.
Feature | Number Available |
---|---|
PWM | 20 |
Analog In | 27 |
I/O | 62 |
Serial Port | 6 |
I2C Port | 3 |
SPI Port | 3 |
Real Time Clock | 1 |
Touch Sense pins | 0 |
Flash | 512K |
RAM | 256K |
Teensy 3.2/3.1
The Teensy 3.2 is the same size and footprint as the Teensy LC but more powerful. This runs off of the MK20DX256 IC, which is a 32 bit ARM Cortex-M4. It is also 5V tolerant on its digital I/O pins and can provide up to 3.3V at 100mA to other devices. The analog pins are 3.3V tolerant only.
Feature | Number Available |
---|---|
PWM | 12 |
Analog In | 21 |
I/O | 34 |
Serial Port | 3 |
I2C Port | 2 |
SPI Port | 1 |
Real Time Clock | 1 |
Touch Sense pins | 12 |
Flash | 256K |
RAM | 64K |
The pushbutton on the 3.1 is a reboot trigger and does not reset the entire system, similar to the pushbutton on the LC. In order to reset the board, you must access the RESET
test point on the bottom of the board.
Teensy ++ 2.0
This Teensy board is the only AVR-based Teensy that SparkFun carries. It runs off of the AT90USB1286, an 8 bit AVR running at 16MHz. It also has the largest footprint of all of the Teensy boards, at 1.375 in2.
Feature | Number Available |
---|---|
PWM | 9 |
Analog In | 8 |
I/O | 46 |
Serial Port | 1 |
I2C Port | 1 |
SPI Port | 1 |
Flash | 128K |
RAM | 8K |
The push button on the end of the Teensy 2.0 ++ is a RESET
button. This is also used during programming the Teensy with Teensyduino, discussed later.
Teensy LC
The Teensy LC is 0.98 in2. It runs off of the 32 bit ARM Cortex-M0+ at 48MHz and runs at 3.3V.
The Digital to Analog converter is on pin A12 of the microcontroller. Pin 17
outputs voltages up to the supplied Vin
voltage, at 8mA.
Pins D5
, D16
, D17
and D21
can source signals up to 20mA. All other pins are limited to 5mA.
Feature | Number Available |
---|---|
PWM | 10 |
Analog In | 13 |
I/O | 27 |
Serial Port | 3 |
I2C Port | 2 |
SPI Port | 2 |
Touch Sense Pins | 11 |
Flash | 62K |
RAM | 8K |
The pushbutton on the LC is not a reset button but instead triggers HalfKay mode. This allows the board to reboot to the newest code or accept new uploaded code.
Soldering Options
When it comes to soldering your Teensy, there are many different options available to you. IF you have not soldered before, make sure to check out the following tutorial!
How to Solder: Through-Hole Soldering
September 19, 2013
Solder Directly Into Your Circuit
We generally recommend against soldering directly between any two boards you want to connect -- if something burns out or is connected incorrectly, you've set yourself up for a lot of annoying rework (and the danger of ripping a pad off of the board).
One benefit of soldering directly to your circuit however is that it gives a very small profile for the project. If you plan on doing this, we recommend testing your circuit design with Alligator clips or Pig-tail cables before hand to verify functionality.
Solder Headers
Most users prefer using male headers on the Teensy and matching female headers on other boards into which the Teensy fits.
If you plan on using this method, you must ensure you solder the headers on straight, otherwise you're going to have a hard time inserting or removing the Teensy from other boards.
We recommend inserting headers into a breadboard and soldering the Teensy on from there.
After you finish soldering the headers along the length of the board, your Teensy may look similar to the image below depending on your project.
Using male headers with the Teensy allows you to solder the headers on nice and straight, preventing crooked header insertion. As you can see from the images above however, if you intend to use the Teensy LC or Teensy 3.1+ on a breadboard, you cannot solder all of the headers.
If you've already soldered together a board that works with the Teensy LC/3.1, you can simply line your headers up in that board to hold them straight while soldering to the Teensy.
Once the headers are lined up straight, it's easy to simply 'plug' the Teensy into the headers and solder everything together.
You can also solder female headers or stackable headers onto the top of the board, allowing other boards to be plugged into the top of the Teensy.
If you do solder your headers on like this, keep in mind it may limit your access to the push button on board, requiring you to break out the reboot/reset signal from the header pin.
What about Those Additional Headers on the LC/3.1+?
Inner Headers
There are a few options to work with these pins. You can:
a) Leave them unconnected (boring!)
b) Solder wires to the pins as you find uses for them
c/d) Solder headers on the top/bottom
If you go for options c or d, there's an easy way to solder connectors on there without driving yourself crazy attempting to solder a lonely pin by itself.
If you are using male headers, you can use pliers to push/pull one of the pins out. This will allow you to use the spacer to hold the pins straight, but will remove the non-compatible pin.
If you are using female headers, this method won't work, but you can still use the pliers to pull out the unnecessary pins.
Once the header strip has been modified, simply line it up with those holes, and solder them.
SMD Headers
Both the 3.1+ and LC Teensy boards have SMD pins on the board bottom that you can solder to. If you know you will need access to these pins, we recommend that you solder the headers onto the top side of your Teensy.
If you already have another Teensy soldered, you can use this as a soldering jig to keep the headers straight, as shown below.
With the headers soldered onto the Teensy this way, the user has access to all of the SMD pads on the bottom of the board. Keep in mind however, this does minimize access to the pushbutton, so balance that with your project needs.
If you need help with soldering to the SMD pads on the bottom of the board, please check out our tutorial here.
You can also check out this video for SMD soldering tips and tricks.
Programming
To start working with the Teensy, all you need to do is plug in your USB cable to your computer and your Teensy board. There are two options for programming the Teensy boards - the Arduino IDE or your favorite C compiler.
Arduino IDE
Teensyduino Add-On Installation
You will need to download the Teensyduino add-on for Arduino. You can find the Teensyduino download from PJRC here.
Please follow their installation instructions for the most up-to-date version of the Teensyduino. You will also need to select which Teensy-compatible libraries you'd like to install at that time. If you aren't sure which libraries you will want, you can always download them and install them later from the curated list.
Programming the Teensy
When you first plug the Teensy in, the appropriate drivers will be installed (if using a Windows machine). Your Teensy should default to the standard Blink
sketch. You should see the LED blinking, as a quick check to make sure your board is functioning.
Open up the Arduino IDE, and select the appropriate Teensy board from the Board
menu. This will provide you with additional options in the Tools
menu.
If you would like to use the Teensy as an HID, MIDI, or user interface device (such as a keyboard or mouse), you can select that option from the USB Type
menu.
The CPU speed can be changed for low-power applications.
The Keyboard Layout
option can be updated to your preferred style.
If this is the first time uploading, click on the Arduino's Verify button. The Teensy Loader Program will open (if it is not already open) and prompt you to push the pushbutton (the BOOT button). You should see this window:
Verify your example code, and upload to the board as usual in the Arduino IDE. The Teensy Loader Program will also open when pressing the upload button as well. In some cases, you will need to hit the on-board BOOT button once the IDE has compiled the code to finish uploading it to your Teensy. You should only need to do this the first time you upload code for the duration that your Teensy is powered.
C Compiler
This is typically a more advanced option. For step-by-step instructions on using a C-compiler for the Teensy, please check out PJRC's directions here. You will still need to download and install the Teensyduino and modify the Arduino files to use the Makefile
for the Teensy boards.
Additional support for other languages is slowly being added. Please check here for more information.
MicroPython
For those that are comfortable with Python language, you can also load MicroPython on the Teensy! Check out the following tutorial for more information on getting started.
How to Load MicroPython on a Microcontroller Board
September 4, 2018
Troubleshooting
Having trouble using your Teensy? Try checking out some of the common troubleshooting tips from PJRC when using your Teensy.
Resources and Going Further
Now that you have a basic understanding of working with the Teensy, it's time to start building projects with one! Make sure to check out the schematic for your particular Teensy when building any new projects.
Need some inspiration for your next project? Check out these additional resources for more information and other project ideas.
Or check out the following tutorials for inspiration.
Teensy Arduino Shield Adapter Hookup Guide
Proto Pedal Example: Programmable Digital Pedal
Choosing an Arduino for Your Project
SparkFun Qwiic Shield for Teensy Hookup Guide
Or check out some of these blog posts for ideas.
If you have any feedback, please visit the comments or contact our technical support team at TechSupport@sparkfun.com.