ZI

Christopher Parrott

Programming | Electronics | 3D Printing | Robotics

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).

Teensy 3.2, 3.5, 4.0, and 4.1 mounted in their respective ToZero adapters

(Teensy 3.2, 3.5, 4.0, and 4.1 mounted in their respective ToZero adapters)

Four ToZero boards with different combinations of headers soldered

(Four ToZero boards with different combinations of headers soldered)

Features

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.

Teensy 3.2 and 4.0 with underside pins soldered

(Teensy 3.2 and 4.0 with underside pins soldered)

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.

Teensy 4.1 with RTC battery and on/off switch connected

(Teensy 4.1 with RTC battery and on/off switch connected)

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:

Teensy LC

Pinout for ToZero 3x with Teensy LC

(Enlarge)


Teensy 3.2

Pinout for ToZero 3x with Teensy 3.2

(Enlarge)


Teensy 3.5

Pinout for ToZero 3x with Teensy 3.5

(Enlarge)


Teensy 3.6

Pinout for ToZero 3x with Teensy 3.6

(Enlarge)


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:

Teensy 4.0

Pinout for ToZero 4x with Teensy 4.0

(Enlarge)


Teensy 4.1

Pinout for ToZero 4x with Teensy 4.1

(Enlarge)