How to Program an AT90USB1286/Teensylu/Printrboard with Arduino and USBtinyISP

My first step in loading Marlin RepRap firmware into the Printrboard is to get Arduino to play nicely with it.  The method I am going to describe in this article for programming a Printrboard with Arduino will work with the Teensylu or any other device that uses the AT90USB1286 and has an ICSP connector.   The programmer we are going to use is a USBtinyISP or compatible. Since the AT90USB1286 isn’t officially supported by Arduino, it takes a bit of setting up to get things working properly.

I first looked at the instructions on Teensylu’s page in the RepRap wiki, but found them very confusing, and I didn’t like the idea of having to send the HEX file to the MCU using an external utility instead of doing everything within the Arduino IDE. So, I set out to streamline the process and document it as I went.  If you follow my method below, you’ll be able to compile and download your firmware all within the Arduino IDE.

Step 1: Download and install Teensyduino

Teensyduino was created by PJRC for their Teensy line of boards.  Teensy is a great alternative to Arduino if you want an ultra compact board with built in USB.  The Teensy++ happens to also use the AT90USB1286, so it’s compatible w/ Printrboard/Teensylu.  Follow PJRC’s instructions for installation from the download link.

If you only plan to program for RepRap, you don’t need to install any of the libraries.  On Windows, you will be prompted to install the serial driver. Select yes.  You don’t have to worry when Windows complains that the driver is unsigned… it’s just an INF file to tell Windows to use one of its own built-in drivers.

Step 2: Modify Teensyduino Configuration for use with USBtinyISP

Download at90usb1286txt.zip.

Navigate to where your Arduino files are located.  On my computer, I have them in d:\arduino-0022.  We will call this <arduinofolder>.  Now, find the subfolder where the Teensyduino library was installed:

<arduinofolder>\hardware\teensy

If you are in the correct folder, you should already see a boards.txt and a subfolder called core in there.  Drop the files from at90usb1286txt.zip into that folder, overwriting the existing boards.txt.  You should see something like this:

If you don’t plan to develop with any of PJRC’s Teensy or Teensy++ boards, you can keep them from showing up in your Arduino menu by copying boards.txt.nopjrc over boards.txt.

Now, when you start Arduino, you should see some new configurations in the Tools->Board menu.  The important ones are:

[usbtinyisp]AT90USB1286
[usbtinyisp]Teensylu/Printrboard
[BootloaderCDC]AT90USB1286
[BootloaderCDC]Teensylu/Printrboard

To use a USBtinyISP programmer, select either [usbtinyisp]AT90USB1286 or [usbtinyisp]Teensylu/Printrboard. The only difference between the two configurations is that I took the extra useless options out to make things simpler when programming Teensylu/Printrboard.  The Teensylu/Printrboard option is the same as the AT90USB1286 option with USB Type = Serial and CPU Speed = 16MHz.

At this point, you can plug in your USBtinyISP and into your AT90USB1286/Teensylu/Printrboard and start programming!

So what are the [BootloaderCDC] configurations for?  They allow you to download sketches into your target board directly through a USB connection to your host, without the USBtinyISP programmer.  See my next article for details on how to do that.

Update 20140909: I have uploaded a copy of Arduino 1.0.5-r2 for Windows to github, which is already modified to work with the AT90usb1286, so you don’t have to modify it as above. Simply go to https://github.com/lincomatic/arduino-1.0.5-r2-at90usb1286 and click the Download Zip button, and then extract the contents to your PC. My distribution also supports the USBasp in addition to the USBtinyISP.

RepRap – 3D Printing Project Kickoff – Printrboard First Look

I have been somewhat intrigued by the RepRap project, an open source 3D printer movement, for several years.  However, wasn’t motivated enough to jump into the fray until late last year, when I saw Brook Drumm’s Printrbot on Kickstarter.

With only about 1 hour left before funding closed, I pledged $500 to get a Printrbot kit. While I could have started from scratch, and built a Prusa Mendel, after reading about how much tweaking is involved in building and setting up a RepRap, I decided to start with a Printrbot – a cute, compact, and simple design, and the most inexpensive RepRap at the time.  Printrbot’s Kickstarter was a smashing success.  They raised an astonishing $830K. Unfortunately, the gigantic amount of orders they received means that mine will take a little longer to get to me than I originally anticipated. So, I’ve been immersing myself in the intricacies of the electronics, firmware, host software, and mechanical aspects of RepRap for the past couple of months.

There are a variety of popular controller electronics for RepRap, the most popular being RAMPS.  The electronics are one of the largest costs of building a RepRap.  Although RAMPS is convenient, because it’s based on an Arduino Mega, I like the idea of having a single dedicated board.  The Printrbot folks have designed their own controller board, which they call Printrboard.  Although Printrbot is not yet selling Printrboards, the design is open source, and thus, I was able to obtain one before their release.

Kang, a fellow RepRapper from Seoul, Korea, built a few Printrboards and sent me one to play with.

Printrboard is a fork of Teensylu, an AT90USB1286/AT90USB1287 based RepRap controller.  I like the fact that these boards are based on the AT90USB128x MCU’s because they have built-in full USB support, eliminating the need for an external serial->USB bridge IC; additionally, the native USB support means that communication with the host computer is blazingly fast – 12Mbps rather than 115200kbps.

There are a few notable differences between Printrboard and Teensylu.  Printrboard is a single board solution.  First, Printrboard adds an integrated SD card reader.  This is handy for printing while untethered to a computer.  Teensylu has I/O pins which can be used to easily add an SD card reader.

Second, the stepper motor drivers are integrated onto Printrboard’s PCB, while Teensylu uses plug-in Pololu/Stepstick carriers.  The advantages of integrating the stepper drivers onto the main PCB are reduced cost and compactness.  The downside is that it is not uncommon to blow up a stepper driver IC, so having them soldered in means if one goes bad, the whole board is unusable.

Third, Printrboard uses Allegro A4982’s in a 24-TSSOP package, while Pololu/Stepstick use the Allegro A4988 in a 28QFN package.  The TSSOP package is considerably larger, and has a wider pin pitch, which makes reworking the board easier if one of them blows out; the 28QFN is very tiny and not for the faint of heart.  The other difference between the A4982 and A4988 is that the A4982 only supports full/half/quarter/sixteenth stepping, while the A4988 also supports one eighth stepping.

Some other minor differences between Printrboard and Teensylu are that while Printrboard only supports a 12V2 ATX power input, Teensylu gives more power options.  Also, Teensylu has a large USB-A socket, while Printrboard uses a micro USB-B socket.

I am diving into figuring out how to load Marlin RepRap firmware into Printrboard/Teensylu, to keep my end of the bargain with Kang.  A series of articles will follow with my findings.