Do you have a Teensy 3.0 and want to hook it up to the internet? Don’t really feel like breadboarding your own Ethernet interface? Then why don’t you use one of your Arduino Ethernet shields lying around the place to provide the Teensy with Ethernet capabilities? Here we show how to do just that.
So I ordered and received my Teensy 3.0 the other day. However, since I’m a Internet kinda of guy, a microcontroller is only useful to me when I can connect it to a network. The Teensy store sells some adapters to connect a WIZ812MJ Ethernet Module to your Teensy, but they’re meant for older Teensy 2.0 models. Also, I didn’t have one of those WIZ812MJ modules lying around.
Luckily our labs are stacked with Arduino boards, and we did have some spare Arduino Ethernet Rev3 shields. Both the WIZ812MJ Ethernet Module and the Arduino Ethernet shield use the Wiznet W5100 embedded TCP/IP chip, so it’s perfectely possible to use the Arduino Ethernet shield to bring the wonderous world of the Internet to the Teensy 3.0! As an extra, the Arduino Ethernet shield provides a micro-SD slot which you can also use with the Teensy. Both the Wiznet chip and the SD slot work on the same SPI bus, limiting the amount of wires you have to run between the Teensy and the Ethernet shield.
However, there’s always a catch. You need to be sure you have a Rev. 3 Ethernet shield, which is the current model sold by Arduino and their distributors. An older version of the Ethernet shield might damage or destroy your precious Teensy board. Read on to find out why.
SPI is a medium-speed, four-wire digital interface bus. It actually only uses three wires for the bus itself (two data lines and one clock line), and one extra wire to select the device, connected to the bus, the microcontroller wants to talk to. This is the so called Slave Select wire. In our case, we will need two SS wires, one for the Ethernet chip and one for the micro SD-card.
|Arduino name||Teensy name||Teensy pin|
The SPI bus on the Arduino Ethernet shield is broken out on the ICSP header on the backside of the board. The SS lines are on the regular digital pin headers.
The Teensy 3.0 uses a different naming scheme for the SPI bus.
Now before we go connecting the Arduino Ethernet shield to our Teensy 3.0, a note on why we need the Rev. 3 model of the Ethernet shield. The Teensy 3.0 works with 3.3V levels, while most of the Arduinos use the 5V level. The inputs of the Teensy, or rather the Freescale MK20 microcontroller on the Teensy board, however are NOT 3.3V tolerant. Connecting 5V to them will damage the microcontroller.
The Rev. 3 of the Arduino Ethernet shield features a IOREF pin. This pin is used to sense the voltage level the Arduino operates with and level shift the output of the shield to a compatible voltage. So the Rev. 3 version of the shield can be safely coupled to the Teensy without you having to worry about magic smoke leaving the Teensy microcontroller.
Some remarks about the power supply. The Wiznet W5100 chip works on 3.3V, but it’s quite a power hungry fellow. It consumes up to 150mA, which is around the maximum current the MK20 microcontroller on the Teensy can provide. The Arduino Ethernet shield luckily has a linear regulator converting power from the 5V pin to 3.3V. To avoid damaging the Teensy microcontroller, you should connect the 5V pin of the Arduino Ethernet shield to the Vin pin of the Teensy, provided you use the USB connection to power the Teensy. This way, the Arduino Ethernet shield will use the 5V provided by USB to power the W5100 chip, avoiding putting too much stress on the Teensy microcontroller.