Search This Blog

Tuesday 15 July 2014

Developing a Robot Shield for Teensy 3.1: Looking for feedback

The many features and beautiful simplicity of the venerable Arduino, have captured the minds and imaginations millions of hobbyists, programmers, and Roboteers.  

Arduino, as a company, has created a diverse number of boards as Open Source Hardware . This diversity caters to various physical, electrical, and I/O requirements, allowing for a broad spectrum of applications.   That said, an entire industry has sprung up around reproducing variants of the Arduino

All of these boards, however,  have two things in common.  
  1. They use Atmel AVR 8bit microcontrollers (Typically ATmega328 or in the case of the Mega - ATmega1280 or 2560)
  2. They have an Arduino bootloader installed to allow quick and convenient development/upload cycles with the Arduino IDE.


One of the most recent trends, has been to reproduce the Arduino form factor, complete with I/O, A/D and D/A for other microcontrollers, to allow them to utilize the hundreds (thousands?) of "shields" developed to support the Arduino family. 

Many of these alternative boards have also provided plug-ins (cross compilers and compatible libraries) for the Arduino IDE, to allow a smooth transition from the comfort of developing for the Arduino's 8bit AVR chip to a more complex 16 or 32bit microcontroller.


Today, I'm going to discuss the   Teensy 3.1.  

https://www.pjrc.com/teensy/teensy31.html 

Although not pin compatible with the Arduino family, it does leverage the Arduino IDE through Teesyduino for quick application development, while hopefully grooming it's users to step into more robust ARM development tools.  If UNO form factor compatibility is a requirement (for instance to use an existing shield) then the Teensy Development board from PetitStudio will do the trick.



The Teensy 3.1 is based on the   Freescale K20P64M72SF1 ARM Cortex M4 processor. It runs at 96Mhz, has 256K flash, and 64k RAM, 43 digital I/O, 21 Analog inputs, 12 PWM outputs,  12 Timers, 2 I2C ports, and 4 Serial UARTS.  Whew...

In addition to that, there are two TRUE Analog to Digital Converters that can be read simultaneously ie: no multiplexing inputs. Currently, Pedvide's ADC library can be used to access both ADCs. Thanks to Freescale, there is also a CAN Bus
(Controller Area Network - communication channel used in automobiles) Libraries for this will be available shortly.



Comparison Of Arduino UNO R3, Mega2560, and Teensy 3.1 specifications
Technical Specifications
Feature Arduino
Uno R3
Arduino Mega2560 Teensy 3.1 Units
Price 25 54 19.8 US Dollars
Processor Atmega328 ATMega2560 MK20DX256VLH7
Bits 8 8 32
    Core AVR AVR Cortex-M4
    Rated Speed 16 16 72 MHz
    Overclockable 24 24 96 MHz
Flash Memory 32 256 256 kbytes
    Bandwidth 16 16 192 Mbytes/sec
    Cache 0 0 256 Bytes
RAM 2 8 64 kbytes
EEPROM 1 4 2 kbytes
Direct Memory Access N/A N/A 16 Channels
Digital I/O 14 54 34 Pins
    Voltage Output 5 5 3.3V Volts
    Voltage Input 5 5 5V Tolerant Volts
Analog Input 6 16 21 Pins
    Converters 1 1 2
        Resolution 10 10 16 Bits
            Usable 10 10 13 Bits
        Prog Gain Amp 0 0 2
    Touch Sensing N/A 64 12 Pins
    Comparators 1 1 3
Analog Output 0 0 1 Pins
    DAC Resolution - - 12 Bits
Timers 3 6 Total 12 Total Pins
    FTM Type 0 0 3
        PWM Outputs 6 12 12
    PDB Type 0 0 1
    CMT (infrared) Type 0 0 1
    LPTMR Type 0 0 1
    PIT (interval) Type 1x8bit 2x16bit 2x8bit
 4x16bit
4
    Systick 0 0 1
    RTC (date/time) ** 0 1 1
Communication
    USB 1 1 1
    Serial 1 0 3
        With FIFOs 0 0 2
        High Res Baud 0 0 3
        Fast Clock 0 0 2
    SPI 1 1 1
        With FIFOs 0 0 1
    I2C 1 1 2
    CAN Bus 0 0 1
    I2S Audio 0 0 1
        FIFO Size 0 0 8

























 
Now, if you've happened to get this far, here is the meat of this article:
There are few "shields" available for the Teensy as yet. There are a few adapters that provide UNO form factor, there is an audio shield, a TFT display shield, and a Smartmatrix shield, as well as a few other special use shields. 

What I am looking to develop, is a multifunction shield that maintains the small size of the teensy as much as possible, but incorporates a 9dof  like the LSM9DS0 Teensy 3.1 Micro Shield, as well as an l293d to drive two small DC motors. I2C, as well as Remaining I/O will be brought out to right angle headers on the edge of the shield.  

Before I complete the board design, I'm looking for feedback, motivation, and warnings (like "that l293 is going to get too hot!") ... 

 Cheers.



References:

https://www.pjrc.com/teensy/K20P64M72SF1.pdf
http://cache.freescale.com/files/32bit/doc/ref_manual/K20P64M50SF0RM.pdf 
http://cache.freescale.com/files/32bit/doc/quick_ref_guide/KQRUG.pdf


 









My Teensy Playlist on Youtube  



 










http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K20_72
https://www.pjrc.com/teensy/td_libs_USBHostShield.html
OSH Park: SmartMatrix Shield for Teensy 3.1 
https://community.freescale.com/thread/320695 
http://hackaday.com/2013/12/09/meet-the-teensy-3-1/ 

http://trippylighting.com/category/uncategorized/
SmartMatrix Shield for Teensy 3.1
Adafruit 2.8" TFT Touch Shield for Arduino for Teensy 3.1
https://www.tindie.com/products/loglow/teensy-31-breakout/
http://petitstudio.blogspot.ca/2014/04/teensy-3-development-board-arduino.html
Audio Adapter Board for Teensy 3.0 & 3.1 and OctoWS2811 Adapter for Teensy 3.1 – Control tons of NeoPixels!
http://www.mccauslandcenter.sc.edu/CRNL/tools/oscilloscope
Github: KurtE- Modified version of Trossen Bioloid library to user Serialx objects
https://github.com/KurtE/Teensy3.1-Breakout-Boards
http://zentasrobots.com/
http://www.circuitsathome.com/category/mcu/arduino/usb-shield

http://forum.pjrc.com/threads/26017-Teensy-3-1-and-9DOF-Stick-I2C
https://github.com/ptrbrtz/razor-9dof-ahrs/pull/20
https://www.tindie.com/products/onehorse/lsm9ds0-teensy-31-micro-shield/ 
https://github.com/Poofjunior/RaspPi-Teensy-USB-ServoController 


Development tools:
PCJR.com : Teensyduino IDE extension
http://www.seanet.com/~karllunt/bareteensy31.html 
http://embedxcode.weebly.com/ 
http://www.uTasker.com/freescale/Teensy_Simulator.zip
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/overview/ 
Teensy 3.0 now supported by the USB Host library
Freescale Hack It Together (H.I.T.) Project Initiative - Get Excited!