ToZero - Use Raspberry Pi HATs with a Teensy!
The ToZero is a Raspberry Pi Zero form-factor adapter board for the Arduino-compatible Teensy microcontroller, opening up a whole world of Pi HATs. There are two versions of the ToZero board, the 3x supporting the Teensy 3 family (3.2/.5.6 & LC), and the 4x supporting the Teensy 4 family (4.0 & 4.1).
Features
- 40-pin GPIO header matching many Raspberry Pi functions (e.g. Serial, I2C, SPI, PWM, I2S)
- Headers for Teensy-only functions (e.g. ADCs, DACs, CAN Bus, S/PDIF)
- Headers for secondary I2C and SPI channels that match the Pimoroni breakout garden pinout
- A power multiplexer with secondary USB / Screw Terminal 5V power input
- A dedicated 600mA 3.3V regulator for Pi HATs that supports the Teensy 4's on/off feature
- 3V Real-time Clock (RTC) battery connector
Getting Started
To get started with your new ToZero follow the Teensy installation guide, taking you through the steps of installing the Arduino IDE and the Teensyduino add-on for your operating system of choice. Once installed, head to the ToZeroAdapters library on Github and download the latest version. This library contains the pin remapping that lets you reference Teensy pins by their GPIO number, making porting of Raspberry Pi code easier. It also includes a number of example sketches for driving Raspberry Pi HATs (this will be expanded upon over time).
Details
Power Multiplexer
Some Raspberry Pi HATs draw more than the 500mA that regular USB supports (Unicorn HAT HD for example), leading to issues when programming the Teensy via a PC due to the Teensy 3's onboard fuse. To address this, the power multiplexer was added. Simply connect a secondary 5V power source to either the ToZero's onboard USB port or screw terminals, and the multiplexer will seamlessly use that power rather than your PCs!
To use this feature the connection on the Teensy between VIN and VUSB will need to be cut (see your board pinout for its location), and a pin soldered to VUSB.
If you wish to use the Teensy in a breadboard in the future, this step can be avoided; however, note that the secondary USB / Screw Terminal input cannot be used at the same time as the Teensy USB for programming.
Note: The multiplexer on the alpha boards has an issue with seamless switchover, meaning it can only switch from Teensy power to Secondary power, not Secondary power to Teensy power. This will be fixed in future board revisions.
Extra Headers
Each ToZero board includes two extra header locations for exposing additional pins of the Teensy. In the case of the 4.1, all of these come from the edge pins. For the 3.2, 3.5, 3.6, and 4.0 however, up to ten of these pins come from the underside pads. To use these a 2x5 SMT header needs to be soldered as shown in the image below.
Adding this header can be tricky to do (especially with the 4.0!) and makes insertion and removal of the Teensy from the ToZero a lot more fragile, so only do this if you are in need of those extra pin functions and are competent at soldering. It is recommended to use a long 0.1" socket (such as those bundled with the ToZero) to align the SMT header when soldering its first pin.
RTC Battery
A 2-pin Molex Picoblade connector is used for the ToZero's RTC clock function. This is the same connector as found on many CR2032 CMOS batteries used by many computer motherboards and can easily be found on ebay and other online marketplaces. Just be sure it is in fact Molex (as there are JST versions), and that the polarity is correct.
Note: The Teensy LC does not have a real-time clock, and the Teensy 3.2 needs a secondary clock crystal soldered to it to use the feature.
On/Off (4x Only)
The Teensy 4.0 and 4.1 have an on/off feature that allows them to be shut down and restarted by connecting a pin to ground for a few seconds (more info here). To make this easier to use, the ToZero breaks out a ground pin next to the on/off pin, allowing two pin power buttons (as you would find in a computer) to be used. On the ToZero 3x these pins are replaced with analog ground and an ADC capable pin.
Note: The shutdown feature only cuts power to the 3.3V line, not the 5V, so some HATs may not respond to this feature.
Pin Remapping
Depending on which Teensy is used, and whether the underside 2x5 header is soldered or not (to keep the Teensy breadboard compatible for example), some pins on the ToZero's GPIO header may not be connected. This could cause problems for certain Pi HATs, either preventing them from working or completely disabling certain features.
By default the pins in question are: GPIO_0 (ID_SD), GPIO_1 (ID_SC), GPIO_5, GPIO_6, GPIO_7 (CE1), and GPIO_26. If any of the last four are needed by a particular HAT then solder jumpers on the undersides of both ToZero models can be used to remap other board function to them.
Note: It is recommended that you visit pinout.xyz to look up the pinout of the Pi HATs you plan to use, and check them against the pinout diagram for your Teensy and ToZero below before installing any HAT.
ToZero 3x Pinouts
Here are the pinout diagrams for the four Teensy boards that the ToZero 3x supports. Pins with an outlined box around them match the pin functions of the Raspberry Pi, and pins with diagonal stripes over them are ones that need inner or underside pads of the Teensy soldering.
Pin remappings:
- Pin 5 can be swapped from GPIO_27 to GPIO_26
- Pin 15 can be swapped from GPIO_16 to GPIO_7 (CE1)
- GPIO_5 can be swapped from Pin 24 (only on Teensy 3.2/.5/.6) to Pin 3 (CAN TX)
- GPIO_6 can be swapped from Pin 25 (only on Teensy 3.2/.5/.6) to Pin 4 (CAN RX)
Teensy LC
Teensy 3.2
Teensy 3.5
Teensy 3.6
ToZero 4x Pinouts
Here are the pinout diagrams for the two Teensy boards that the ToZero 4x supports. Pins with an outlined box around them match the pin functions of the Raspberry Pi, and pins with diagonal stripes over them are ones that need inner or underside pads of the Teensy soldering.
Pin remappings:
- Pin 5 can be swapped from GPIO_27 to GPIO_26
- Pin 9 can be swapped from GPIO_16 to GPIO_7 (CE1)
- GPIO_5 can be swapped from Pin 36 (only on Teensy 4.1) to Pin 15 (S/PDIF IN)
- GPIO_6 can be swapped from Pin 37 (only on Teensy 4.1) to Pin 14 (S/PDIF OUT)
- (Teensy 4.0 only!) GPIO_14 (UART_TX) can be joined to the Pimoroni SPI breakout header to access MISO1
- (Teensy 4.0 only!) GPIO_15 (UART_RX) can be joined to the Pimoroni SPI breakout header to access CS1
Teensy 4.0
Teensy 4.1