Teensy Breadboard

From RepRapWiki
Jump to: navigation, search

Contents

Teensy Breadboard

This page is a development stub. Please enhance this page by adding information, cad files, nice big images, and well structured data!

TeensyBreadboard20121031.JPG


Crystal Clear action run.png
Teensy Breadboard

Release status: working

TeensyBreadboard20121031.JPG
Description Breadboard-based Pololu_Electronics
License GPL
Author DaveX
Contributors
Based-on Sui Generis
Categories Electronics
CAD Models none
External Link none


Combines a $16 ATmega32U4 or $24 AT90USB1286 based carrier from http://www.pjrc.com/teensy with Pololus on a solderless breadboard. Runs Teacup through integrated USB 250000 baud. (Teensy is capable of 12MBit/sec communication per [[1]]. Tested at 230400 baud with CoolTerm, and 250000 Baud with Pronterface with Teacup using Teensy's usb_serial* routines.) Possible (and recommended) upgrade path to the AT90USB1286 on a $24 Teensy++ towards Teensylu and Printrboard compatibility. Possible upgrade path to a $19 32 bit ARM Cortex-M4 96MHz processor on Teensy 3.1, http://www.pjrc.com/store/teensy3.html

Philosophy

Some of the most expensive parts for a RepRap are the steppers and stepper drivers. If you settle on either NEMA14 or NEMA17 steppers, you can buy them with some stepper drivers early in the RepRap process. Before committing to a RepRap design, or even to Filament Deposition Manufacturing, you could play with the steppers and control with an eye towards other projects. If you think automated steppers would be fun to play with, you can start with a single stepper, matching driver, a piece of breadboard, and a USB-capable cpu.

Price, commitment, end-of-lifecycle-wise, $9*4 for the drivers + $16 for the CPU and $4 for a Protected Mosfet gets you most of what you need for the electronics for only $56 worth (2012-11-01) of very reusable components.

On the electronics side, it all fits in a single solderless breadboard ($4 Ebay 2012-11-01) with a little usb-capable carrier like the Teensy. The Teensy 2.0++ might be easier to build firmware for, since it matches the atmega1286usb chip already used in the in the Teensylu and Printrboard. I used the smaller Teensy 2.0 since I already owned one.

My Wallace uses 4 NEMA 14s ($16 from Pololu) and an expensive MakerBot high torque NEMA17 ([17Y402S-LW4-01] (overkill) on my Wade's extruder.

The design is future proof in that you could easily add a couple more axes, extruders, fans, or an upgraded processor, as RepRap or your needs evolve.

Firmware


Here's a screenshot of Teacup/Gen7 working on a Teensy 2.0:

TeacupGen7 Teensy Pronterface.png

Parts


  • Note 1: 1-3 MOSFET circuits and thermistor circuits, depending on whether or not you have a heated bed or fan. More heater/spindle circuits are possible, depending on pin availability
  • Note 2: Other MOSFETS could certainly be used. But fully protected, logic-level, ESD-protected MOSFETS reduce component count. This 49A one is overkill, but should handle anything a reprap could need. Other (OMNIFETS or OMNIFET IIs) might work better for you. If you chose one which more closely matched the amps of your extruder or bed, it would limit the current for you and protect better against shorts, over temperature, etc.. If you are using the overcurrent/overtemperature feature, you will want a protection resistor, R3, in series with the gate to protect the output pin from the overtemperature feedback feature.

Pinouts

Teensy 2.0

My pinouts from https://github.com/Traumflug/Teacup_Firmware/blob/master/config.teensy.h :


/*
	Machine Pin Definitions
	- make sure to avoid duplicate usage of a pin
	- comment out pins not in use, as this drops the corresponding code and makes operations faster

Teensy http://www.pjrc.com/teensy ATMega64U4 carrier:

DaveX plan for Wallace:
                               USB
           GND       GND |-----#####-----| +5V              ATX +5SB
     ATX PS_ON         0 |b0   #####   F0| 21 A0            Extruder TC
         X_MIN         1 |b1           f1| 20 A1            Bed TC
         Y_MIN         2 |b2  /=e6     f4| 19 A2            Stepper -ENABLE (or -SLEEP)
         Z_MIN         3 |b3 *      *  f5| 18 A3            STEP X
                 PWM   4 |b7  aref=/   f6| 17 A4            DIR X
                 PWM   5 |d0           f7| 16 A5            STEP Y
                       6 |d1           b6| 15 A6  PWM       DIR Y
                       7 |d2   V G R   b5| 14 A7            STEP Z
           Fan         8 |d3 d c n S d b4| 13 A8            DIR Z
      Bed Heat   PWM   9 |d6 5 c d T 4 d7| 12 A9  PWM       STEP E
 Extruder Heat   PWM  10 |d7 * * * * * d6| 11 A10 (led)     DIR E
                         --------------------
                          23 ^      \ \----22 A11
                                      \------ RST

      Interior E6: 24, AIN0, INT6
      Interior Aref : Aref
      End d5 : 23
      End d4 : 22, A1


With This configuration there remain 4 (or 7, if you count the three holes in the interior) IO connections leftover.

Teensy++ 2.0

A layout from https://github.com/Traumflug/Teacup_Firmware/blob/experimental/config.teensypp.h :


Teensy https://www.pjrc.com/store/teensypp.html AT90USB1286 carrier:

DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a TeensyBreadboard:

                               USB
           GND       GND |-----#####-----| +5V              ATX +5SB
     ATX PS_ON    PWM 27 |b7   #####   b6| 26    PWM*       Stepper Enable 
                  PWM  0 |d0           b5| 25    PWM*        
                  PWM  1 |d1           b4| 24    PWM        
         X_MIN         2 |d2           b3| 23               
         Y_MIN         3 |d3           b2| 22               
         Z_MIN         4 |d4  * *      b1| 21                      
                       5 |d5  e e      b0| 20               
           LED         6 |d6  5 4      e7| 19               
                       7 |d7           e6| 18               
                       8 |e0             | GND              
                       9 |e1   a4 a0    R| AREF             
                      10 |c0   a5 a1   f0| 38 A0            
                      11 |c1   a6 a2   f1| 39 A1            
                      12 |c2   a7 a3   f2| 40 A2            
                      13 |c3           f3| 41 A3            
      Bed Heat    PWM 14 |c4   V G R   f4| 42 A4            
 Extruder Heat    PWM 15 |c5   c n S   f5| 43 A5            
           Fan    PWM 16 |c6   c d T   f6| 44 A6            Bed TC
                      17 |c7   * * *   f7| 45 A7            Extruder TC *4.7k *+5          
                         -----------------                  

      Interior E4: 36, INT4
      Interior E5: 37, INT5
      Interior PA0-7: 28-35  -- Printrboard and Teensylu use these pins for step & direction:
	     T++ PA Signal  Marlin
              28 a0 X_STEP  0
              29 a1 X_DIR   1
              30 a2 Y_STEP  2
              31 a3 Y_DIR   3
              32 a4 Z_STEP  4 
              33 a5 Z_DIR   5
              34 a6 E_STEP  6
              35 a7 E_DIR   7


With the AT90USB1286 on this carrier, many additional IO ports are available, and any firmwares that support Printrboard or Teensylu should work, with suitable pin reassignments. Marlin may work with SD support and a display, but take care since some of the pin numbers are assigned alphabetically instead of in Teensyduino order.

Wiring

Most of the wiring is straightforward. You can leave a few things disconnected and iteratively power up and test things as you build.

  • Cut the +5V-VUSB trace on the Teensy so you can use the. See http://www.pjrc.com/teensy/external_power.html for details and other options (The diode or modified cable options might be nicer)
  • I put the four stepper drivers on the left end of the breadboard, signal-side towards the front and motor side towards the rear. I put the teensy on the right, USB on the right edge. (If you put the teensy on the left and the drivers on the right, you could switch sides and leave more of the analog inputs open.)
  • Wire a power supply to the terminal block
  • Tie +5 and GND to the rails of the breadboard (I used the ATX standby +5V)
  • If using PS_ON, connect that output pin on the teensy to the ATX power supply's PS_ON input through a 1K current-limiting resistor.)
  • Wire the Teensy to +5 and GND
  • Wire each stepper driver to enable itself (Pololus: short -SLEEP to -RESET, GND to GND, VDD to +5),
  • Wire the microstepping (I used 1/(4,4,2,4) microstepping for (X,Y,Z,T), so I wired my Pololus with 1 microstepping pin each (MS2, MS2, MS1, MS2) tied to +5.)
  • Connect the -ENABLE pin of each stepper driver together and to the STEPPER_ENABLE pin on the Teensy
  • Connect the DIR and STEP connections for each stepper driver to the Teensy
  • Run a separate 12V line and GND from the terminal block to the VMOT and GND on the motor side of the stepper drivers.
  • Tune the stepper drivers appropriately Pololu_stepper_driver_board#Tuning_motor_current (On my Pololus, Vref of 0.280V will feed 0.7A to my stepper coils.)
  • Connect the motors to the stepper drivers, swapping wires as appropriate to get one coil attached to the 1A-1B pair on the driver, and the other coil on the 2A-2B pair on the driver.
  • Add pigtails to the MOSFETs, two heavier wires (10A+ for the bed) to the source and drain of the MOSFET, and a thinner, breadboard compatible wire for the gate. Wire the MOSFET sources to a terminal block ground, the drains to their own terminals, and the gate to the appropriate pin on the Teensy through a 1K protection resistor. The MOSFETS are mounted on the terminal block, with just the signal wire going to the breadboard.
  • I mounted the thermistor calibration resistor R2 in one row lined up with the appropriate Teensy pins: R2 vertical with short side in the +5 rail and long side in the first pinhole, leaving the other pinholes for the thermistor. Repeat for extruder and bed. See lower right corner of Media:TeensyBreadboard20121031.JPG at points (60-61) X (+,-,A,B) for a picture. If you have a 100K thermistor, you might not want to use a parallel R1.
  • Check and test

Options

  • The version shown above shows a Teensy 2.0, a couple Pololus with voltage regulators, a couple regular Pololus, a single heater output for the extruder, no endstops, and a single thermistor circuit. The Pololus are fed 12v through separate lines.
  • The $24 Teensy 2.0++ uses an AT90USB1286, which matches the Teensylu and Printrboard chips, which may make compiling and configuring a firmware easier. It also has lots of extra IO pins.
  • The Teensy 2.0 has 25 IO pins, 12 of them can do analog input, while 7 of them do PWM output, which is more than enough for the 15 pins required for 4 steppers, 2 heaters, 2 thermistors, and 3 endstops.

Discussion on first build

  • 2012-09-29 -- The original thermistor circuit is pretty noisy, with successive dT up to ~10C. The thermistor is fed off of the +5 rail supplied by an ATX power supply, and uses a 4.7uf capacitor, small relative to other electronics. Using a regulated 5V supply and a 10uf capacitor as in Ramps#Schematic or Sanguinololu may help with the noise. Alternately, you could filter it in software with TEMP_EWMA
  • 2012-10-29 -- The teensy and 4 pololus would take only 12+4*8=44 columns on a breadboard, so it should fit easily on one slab of 830 point solderless breadboard.
  • To avoid overloading the breadboard connector and busses (<2A), I use a 10A terminal strip connected to the powersupply, and run a separate 12V line to each Pololu Vmot input. For the extruder and the bed heaters, I wire the MOSFETs directly to the terminal strip and bring just the gate lines back to the breadboard. Nophead had a post about something like this at http://hydraraptor.blogspot.com/2012/07/sanguinololu-fan-hack.html
  • 2012-10-29 -- The thermistor capacitor didn't seem to smooth the noise much. Maybe I should try to reduce the noise with a slower PWM frequency.
  • 2012-11-04 -- If you are building this, I'd recommend trying the Teensy++ 2.0, which uses the AT90USB1286 and should be compatible with several standard firmwares. I've not tested it, but it should work with Marlin as MOTHERBOARD = 8 with the connections modified to match pins.h or vice versa. Under Sprinter it should be MOTHERBOARD = 8 or 9, with either pins.h or the connections modified to match. With Teacup it should work with MCU_TARGET = at90usb1287 in the Makefile, and a config.h modified appropriately.
  • 2012-11-27 -- A PCPowerSupply can have significant noise: up to 120mVpp on the 12v lines, and 50mVpp on the +5V lines per the ATX specs (http://en.wikipedia.org/wiki/ATX#Power_supply ). If your ADC is using VCC as a reference, or as supply to the thermistors, 50mVpp noise could account for 0.050/(5/1024)=10 ADC counts worth of noise. You should add capacitors to smooth out the power supply ripple. The newer ATX 2.3 spec requires stability with up to 10,000uF of capacitance on its + lines, while older ATXs specify stability for up to 350uF on +5Vsb. On mine, I smoothed 50mVpp to 10mVpp with a 220uF capacitor across the GND-+5SB lines.
  • 2014-01-16 -- I rebuilt it with a Teensy++2.0 with a few changes, rewiring some of it like a Teensylu, and using a USB cable with a cut V+ line. Marlin pin mapping for the AT90USB is very confusing, but this works with both Teacup and Marlin.

Thermistor Circuit

I used an EPCOS B57540G1104 100K Beta_25/100=4092 thermistor with a 2700 Ohm pullup resistor for improved resolution at operating temperatures. Later used a 4700 ohm (measured 4637 Ohm) on a rebuild. Marlin and Teacup software both have 'createTemperatureLookup' programs that provide diagnostic info and resolution at each entry, whcih makes it easy to see the effect of the pullup resistor and the non-linearity of the thermistor.

See User:DaveX#Thermistor_Table_for_Teacup and User:DaveX#Thermistor_Table_for_Marlin for thermistor tables I used with Teacup and Marlin.

Compiling Teacup for Teensy using the Makefile

Below is a transcript of a download and compilation of the Teacup master branch for Teensy. You will need Arduino and Teensyduino, and likely need to make your own config.h and ThermistorTable.h

Note that this was performed on 2014-03-20

GIT $ git clone https://github.com/Traumflug/Teacup_Firmware.git Teacup
Cloning into 'Teacup'...
remote: Reusing existing pack: 5069, done.
remote: Total 5069 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (5069/5069), 3.79 MiB | 3.43 MiB/s, done.
Resolving deltas: 100% (2805/2805), done.
Checking connectivity... done
GIT $ cd Teacup/
Teacup $ cp config.teensy.h config.h
Teacup $ cp ThermistorTable.double.h  ThermistorTable.single.h  
Teacup $ cp ThermistorTable.double.h ThermistorTable.h
Teacup $ MCU_TARGET=atmega32u4  make -f Makefile-AVR    ### you could use Arduino w
mkdir -p build
  CC        build/analog.o
  CC        build/clock.o
  CC        build/copier.o
  CC        build/crc.o
  CC        build/dda.o
  CC        build/dda_lookahead.o
  CC        build/dda_maths.o
  CC        build/dda_queue.o
  CC        build/debug.o
  CC        build/delay.o
  CC        build/gcode_parse.o
  CC        build/gcode_process.o
  CC        build/graycode.o
  CC        build/heater.o
  CC        build/home.o
  CC        build/intercom.o
  CC        build/mendel.o
  CC        build/pinio.o
  CC        build/sd.o
  CC        build/serial.o
  CC        build/sermsg.o
  CC        build/sersendf.o
  CC        build/temp.o
  CC        build/timer.o
  CC        build/usb_serial.o
  CC        build/watchdog.o
  LINK      build/teacup.elf
  OBJCOPY   teacup.hex
  OBJDUMP   build/teacup.lst
  SYM       build/teacup.sym
    SIZES             ATmega...  '168    '328(P)    '644(P)    '1280
    FLASH  : 17696 bytes         124%        58%        28%      14%
    RAM    :   957 bytes          94%        47%        24%      12%
    EEPROM :    48 bytes           5%         3%         3%       2%
Teacup $