Generation 7 Electronics

From RepRap
Revision as of 10:27, 25 May 2011 by Pelrun (talk | contribs) (Clarified the direction of RxD and TxD on the serial connector.)
Jump to: navigation, search
Crystal Clear action run.png
Generation 7 Electronics

Release status: working

Gen7 Layout.png
Description
Generation 7 Electronics
License
GPL v2
Author
Contributors
Based-on
[[]]
Categories
CAD Models
External Link
(none)


This is a complete set of electronics designed to be manufactured on RepRap machines. Replication is what makes RepRap unique, so this is extended to electronics now. All PCBs can be manufactured on your Mendel, Prusa Mendel, Huxley, or on a general CNC milling machine.

The electronic design is much like a "RAMPS with integrated Arduino". Many details were added or refined to guarantee even smoother and more comfortable operation. It started out with the Gen2OnABoard design and also took over a number of features from the various Pololu_Electronics variants.


Design Goals

  • PCB easy to manufacture on a RepRap.
  • All parts on one board. Except for the Opto Endstops, of course.
  • Enough components to run a Mendel or Huxley with extruder and heated bed.
  • Easy to set up. For example, this would include an USB port.
  • Well available and cheap parts.
  • Based on the ATmega644(P).
  • Well suited for community driven development.

Features & Specifications

  • Single board solution.
  • Dimensions about 100 x 130 mm.
  • Single sided PCB.
  • Processor: ATmega644 (Atmel Corp.)
  • Pololu stepper drivers, exchangeable.
  • 4x stepper motor drivers with 1/16 microstepping.
  • TODO: on-board USB-RS232 converter.
  • Integrated hardware for driving one extruder (stepper, heater and thermistor).
  • Integrated hardware for a heated bed (heater, thermistor).
  • Integrated hardware for driving a fan.
  • Ready to be hooked up onto a generic PC power supply unit (PSU) via it's 20-pin connector.
  • Power supply via only the 4-pin Molex connector supported as well.
  • Use of standard connectors.
  • Motor connector layout prepared for both, 4 mm or 200 mil spaced components. This allows Gen3 type plugs as well as screw terminals.
  • Debug LEDs for power, Fan and both heater outputs.
  • Can turn PSU on and off in software, when supplied via the 20-pin connector.
  • Reset button.
  • ICMP header.
  • I2C header.

Individual Components

As Gen7 is a single board solution, it consists of only few components:

Board

Gen7 Board 1.2 is the central unit. It can drive a RepRap machine on it's own, but not much more.

Endstop

Gen7 Endstop 1.2 is an optical endstop, made to fit on Mendels & Co.

Extension Board

Currently, the extension board is an idea, at best. It's mentioned her because you may wonder why Gen7 Board has only few features and even some previously existing features got removed over time.

The single sign currently existing about the extension board is the Misc Header, right below the ATmega on the Board.

Releases

Plans for 1.3

New features: clean up unused pins and connectors.

  • Make the thermistor connectors 2 pin only.
  • Same for heater connectors.
  • Use 4 mm connectors (the same as the motors, but 2 pin) for the heaters.
  • Remove the MOSFET for the fan. So far, nobody uses this.
  • Remove the I2C header for the same reason.

12. May 2011: v1.2

Git Repository

Release Documents

New features:

  • The endstop now uses the TCST1103/2103 photo interrupter.

28. Mar 2011: v1.1

Git Repository

Release Documents

New features: fix all those silly 1.0 mistakes.

  • Cleaned up that drill size mess. Now 275 of the 369 holes are either 0.75 mm or 1.0 mm, the remaining ones are the bigger ones for the connectors and can be drill-milled.
  • Various smaller changes for better compatibility with G-Code generators.
  • Added an appropriate plus (+) signs to all polar components.
  • Swapped the TIP120 MOSFETs for IRFZ 44N ones. These are now fast enough to allow PWM in the kHz range.
  • Added two jumper headers to one existing to have one for each of the three possible power sources. This adds safety against misconfigurations: use only one jumper and you're always safe.
  • Fixed the solder mask.
  • Changed the pin assignments of the heater MOSFETs. Now they're on PWM-able ATmega pins.
  • Added a Release Maker script, bundling up design files for those without gEDA.
  • Added Arduino Support, consisting of bootloaders, board descriptions and library files.

10. Feb 2011: v1.0

New features: it works. Isn't that the most important thing on an 1.0 release?

How to get it

You want three groups of parts:

PCBs

Get Gen7 Board and Gen7 Endstop PCBs from Traumflug.

As Gen7 is designed to be manufactured on a RepRap, you can make PCBs yourself, of course. How to do this on a RepRap or a general milling machine is described later on this page. You want one "Gen7Board" PCB and up to six "Endstop" PCBs.

Yet another way is to purchase from one of the many houses specialized in manufacturing prototype PCBs. Gen7 is single sided, so this won't cost a fortune.

Electronic components

Get Gen7 Components Kits and Gen7 Connectors Kits from Traumflug.

If you want to assemble the collection yourself, see the #Parts Lists section.

Pololus

You need four Pololus. Only few general electronics dealers offer them, but many RepRap specific shops have them in stock.


Parts Lists

For the parts lists of Gen7 components, see their dedicated page

To assemble or verify parts lists, open the layout with gEDA/PCB and export a "BOM". This will give you a list of all required components.

Miscellaneous

Generation 7 Electronics uses a TTL header for serial communications to the host. As many modern PCs lack a serial port, these need an appropriate USB to TTL cable:

USB to TTL Cable Mouser Adafruit Industries MAKE Store MakerBot Industries Watterott

An alternative to the USB to TTL cable is the same electronics in form of a small breakout board:

USB to TTL Breakout Board Watterott Sparkfun
Cable for the above Watterott

Assembly Instructions

  • To find out which components to put where, have the layout on your PC screen available.
  • PCBs fabricated with Voronoi paths need more heat, so raise your soldering iron's temperature by about 20 deg Celsius.
  • Start with the flattest parts, usually wire bridges or resistors. This way, components won't fall out when you lay the PCB on it's front for soldering. Then continue with parts of raising height, connectors are usually among the last ones.
  • To ease soldering jumper headers and similar components, put a small drop of cyanoacrylate glue onto the component side before inserting them. As the PCB is single-sided, this won't hurt the solder point. Avoid heating cyanoacrylate. The fumes are irritant to eyes and the respiratory tract.

Board

Gen7 Mainboard Front.jpeg Gen7 Mainboard Back.jpeg

The pictures show the soldered mainboard, semiconductors not yet inserted. It's a good idea to check supplied voltages before inserting them.

  • The coil 100 uH looks just like a resistor. It's a bit thicker and comes with rings brown-black-brown.
  • Start with the 10 wire bridges, then follow the table in the parts list.
  • As 8 pin headers for the Pololus are expensive, many kits come with lower cost 10 pin headers. Cut 2 pins off of each.
  • While soldering a pair of these headers, insert a Pololu to ensure good alignment.

Opto Endstop

Gen7 Endstop Gen2-3 Compatible Front.jpeg Gen7 Endstop Gen2-3 Compatible Back.jpeg (pictures show an older version)

  • Take care to not overheat the photo sensor. Solder one pin on each side, then make a pause of a minute before continueing.
  • As LEDs have to be inserted the right way, they have legs of different length. The longer leg (+) goes into the hole closer to the photo sensor, the shorter one (-) into the hole closer to the border.

Setup

These steps show how to get from a soldered mainboard to a working one.

Power Source Selection

Gen7 Board PSU Selection.jpeg

In the lower right corner of the board you see three jumper headers. You may jumper one, and only one of them.

  • Serial: feed 5 Volts from the serial connector. USB2TTL converter cables provide this pin. The ATmega as well as the Pololus are supplied all the time, then. You can leave the ATX20 disconnected.
  • ATX20: power 5 Volts through the big, 20 pin PSU connector. The ATmega will be supplied all the time, while other parts are supplied only on demand. This allows to turn the PSU on and off with G-Code commands. For example, Teacup firmware fires up the PSU on incoming heater or movement commands and turns it off automatically 30 seconds after the last movement or when all heaters are done.
  • Molex 4 Pin: supply 5 Volts through the Molex connector in the upper left corner of the board. The ATmega as well as the Pololus are supplied all the time, then. You can leave the ATX20 disconnected.

Power Supply Checks

If you want to do some extra checks to confirm you soldered correctly before inserting semiconductors, insert the power source selection jumper as explained above and hook up your type of power supply.

No smoke? Great, then take a few measurements:

Gen7 Board Power Checks.jpeg
  • Red: power supply inserted. In case of an ATX20 PSU, PSU not yet activated.
  • Blue: as above, with ATX20 PSU activated (bridge between pin 14 PWR_ON and GND).
  • Green: as above, with the Molex 4 Pin also inserted.

Even those without a voltage meter can have a look wether and when one or two LEDs light up.

That done, you can solder in the MOSFETs and plug in the Pololus and the ATmega.

Preprare your Arduino IDE

  • Download and unpack or install the Arduino IDE.
  • Download and unpack the latest Gen7 Arduino IDE Support package.
  • Find the folder Gen7 in this package and move it into the hardware folder inside the Arduino package.

If you fire up your Arduino IDE now, you should be able to select your variant of Gen7 board under Menu -> Tools -> Board.

Bootloader Upload

Note: this section only applies if you have a blank, factory fresh ATmega on your board. Friendly Gen7 vendors will do these steps for you before shipping, so you don't need a programmer.

How to go:

  • Disconnect all connectors, including the power supply.
  • Insert the ATmega644 into it's socket. Make sure you do it the right way, the small nut on the housing goes towards the heater connectors, the numbers on the housing can be read looking from the ATX20 connector side.
  • Re-connect the power supply.

Note: The pins used for the programmer conflict with the pins used for the X_MAX, X_MIN and Y_MIN endstops. This isn't an issue in normal operation, but make really sure you have these endstops disconnected before hooking up the programmer.

  • Connect your programmer. Again, watch out for insertion of the plug the right way.

Now you should see something like this - the red LED indicates the PSU is still without juice:

Gen7 Programmer Setup.jpeg

Programming the bootloader using the command line

  • Have your Arduino IDE prepared for Gen7, as explained above.
  • Connect your power supply, at least one of the power connector indicators should be lighted.
  • Open a terminal and change directory into Arduino IDE's folder. All required tools are there, even if you haven't installed them system-wide.

The following sequence was done on Linux and should apply similarly on other OSs. Unlocking and locking the bootloader section is done on Arduinos, it's not done here.

cd hardware/tools
./avrdude -C ./avrdude.conf -c ?  # find your programmer, e.g. "avrispv2"

### For the ATmega644:
# write fuses
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644 -P /dev/ttyACM0 \
    -B 5 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m
# upload bootloader
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644 -P /dev/ttyACM0 \
    -B 1 -U flash:w:../Gen7/bootloaders/Gen7/bootloader-<your variant>.hex

### For the ATmega644P:
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644p -P /dev/ttyACM0 \
    -B 5 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644p -P /dev/ttyACM0 \
    -B 1 -U flash:w:../Gen7/bootloaders/Gen7/bootloader-<your variant>.hex

Watch your programmer a few seconds blinking and you're done.

Programming the bootloader using Arduino IDE

-- Yet to be found out --

Debugging hint: Arduino obviously doesn't attempt to use the "-B 5" flag when writing fuses onto a factory fresh chip. This is needed if the programmer was set to a higher speed earlier, as an ATmega running at 1 MHz (factory default) can't keep up with 115200 baud.

References

./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644p -P /dev/ttyACM0 -n -v

Serial Connection

It's recommended to either use a USB to TTL cable or USB to TTL breakout board. Custom solutions are possible, see Customisations.

Here's how you connect them, GND is always the pin to the left:

Gen7 Serial Connection With USB2TTL Breakout Board.jpeg Gen7 Serial Connection With USB2TTL Cable.jpeg

Simply plug the connector in, connect USB to your PC and a new serial port should show up in your PC's operating system.

Microstepping

Last not least, you probably want to set up microstepping to something other than the default. The default is halfstepping. Smaller microsteps make the motors run smoother, but also raise the computing load for the ATmega. The smallest steps possible are 1/16 microstepping.

Feel free to select different settings for each of the motors, e.g. 1/8 microstepping for threaded rod axes (Z) and 1/16 microstepping for belt driven axes (X, Y).

Selecting microstepping is done with the jumpers in front of each of the Pololus, they refer to MS2 and MS3. Allegro documents also know about MS1, which is hard wired to High in Gen7. Plugging a jumper sets High, while leaving the header free sets Low. Here's a detail picture of a Gen7, with MS2 set to High, MS3 set to Low:

Gen7 Microstepping Jumpers.jpeg

The following table shows what you get with each combination:

MS2 MS3 Microstep Resolution
Open Open Half step
Open Plugged Not allowed!
Plugged Open Eighth step
Plugged Plugged Sixteenth step

Firmware

In principle, you can run any of the RepRap Firmwares on this board. Adjust the I/O pin layout, adjust compile time options for no secondary board/no RS485 and proceed. Just like Gen2, RAMPS or similar electronics.

Teacup Firmware

Teacup's Simple Installation instructions show nicely how to do this. Two additional tweaks are required for Gen7:

  • Have your Arduino IDE prepared for Gen7, as explained above.
  • Instead of using one of the prepared config.hs from the Teacup repository, use the one attached to this post: [1]. Oh, and I hope somebody with an extruder can donate a Gen7 config.h for inclusion into the Tecup repository ...

With config.h left untouched, at least something should move. This is fine for first tests, but not sufficient to have everything right for your machine. Edit your config.h further to match your machine and your setup. Config.h has a lot of comments inside the file, helping on the details. For example, STEPS_PER_MM_X should be set according to your choice of microstepping.

FiveD Firmware

FiveD has been run succssfully on Gen7. No installation instructions yet, though. If you want to try yourself, start with adjusting the pin layout in configure.h, see the next section, "Other Configurations".

Other Configurations

The following should help to configure other firmwares.

Pinout (board v.1.0)

Sanguino pin bindings
Function ATMega Name Teacup Original firmware Direction in firmware
X Step PC3 DIO19 19 Digital Output
X Direction PC2 DIO18 18 Digital Output
X Min PB7 DIO7 7 Digital Output
X Max PB6 DIO6 6 Digital Output
Y Step PC7 DIO23 23 Digital Output
Y Direction PC6 DIO22 22 Digital Output
Y Min PB5 DIO5 5 Digital Output
Y Max PB4 DIO4 4 Digital Output
Z Step PA5 DIO26 26 Digital Output
Z Direction PA6 DIO25 25 Digital Output
Z Min PB3 DIO3 3 Digital Output
Z Max PB2 DIO2 2 Digital Output
Extruder Step PA3 DIO28 28 Digital Output
Extruder Direction PA4 DIO27 27 Digital Output
Power Enable PD7 DIO15 15 Open Drain Output, active low
Motors Enable PA7 DIO24 24 Digital Output
Heater 1 PA0 DIO31 31 Digital Output
Heater 2 PB0 DIO0 0 Digital Output
Fan 1 PB1 DIO1 1 Digital Output
Temp 1 PA1 AIO1 1 Analog Input
Temp 2 PA2 AIO2 2 Analog Input

Pinout (board v1.1 & v1.2)

In bold changes from board v.1.0

Sanguino pin bindings
Function ATMega Name Teacup Original firmware Direction in firmware
X Step PC3 DIO19 19 Digital Output
X Direction PC2 DIO18 18 Digital Output
X Min PB7 DIO7 7 Digital Output
X Max PB6 DIO6 6 Digital Output
Y Step PC7 DIO23 23 Digital Output
Y Direction PC6 DIO22 22 Digital Output
Y Min PB5 DIO5 5 Digital Output
Y Max PB2 DIO2 2 Digital Output
Z Step PA5 DIO26 26 Digital Output
Z Direction PA6 DIO25 25 Digital Output
Z Min PB1 DIO1 1 Digital Output
Z Max PB0 DIO0 0 Digital Output
Extruder Step PA3 DIO28 28 Digital Output
Extruder Direction PA4 DIO27 27 Digital Output
Power Enable PD7 DIO15 15 Open Drain Output, active low
Motors Enable PA7 DIO24 24 Digital Output
Heater 1 PB4 DIO4 4 Digital Output
Heater 2 PB3 DIO3 3 Digital Output
Fan 1 PA0 DIO31 31 Digital Output
Temp 1 PA1 AIO1 1 Analog Input
Temp 2 PA2 AIO2 2 Analog Input

Customisations

This part describes possible modifcations for advanced users only.

Serial Connection

If you want a custom solution, you can create one, of course. Just connecting an RS-232 port to the serial connector won't work, however, even if you ignored the different voltage levels. ATmega's serial signal is inverted (Logical 0 = 5V, Logical 1 = 0V). Here's the serial connector's pinout:

Gen7 Serial Pinout.png

 

1 2 3 4 5 6
GND CTS (set to GND) +5 Volts RxD TxD Reset

RxD is ATmega's pin 14 (data to the chip); TxD is ATmega's pin 15 (data from the chip).

With pin 3 you can feed the ATmega, if you have no other current source. If you have another current source, e.g. your power supply, you might have slightly different potentials of 5V though, so you better keep this pin unconnected. As of version 1.1, the board comes with a jumper to make sure no bad things can happen.

Pin 6 is usually connected to the serial line's RTS. This triggers a reset each time you start a connection to the ATmega and is very convenient when uploading firmware - no pressing of the reset button needed, then. Arduinos have this hardwired. If you keep pin 6 free, press the reset button each time your IDE (avrdude) attempts an upload.

Development

Status

First test board of Gen7

March 2011: Four Mendels are driven by Gen7 Electronics successfully, first reprapp'd PCBs were shipped.

24.12.2010: A first version of the Gen7 board has been etched and is beeing tested. The hardware seems to work, but the software still needs to be ported and tested with a RepRap.

29.12.2010: Some patches were made in the firmware to support endstops and homing. The patched firmware can be downloaded in the firmware section.

30.12.2010: Some more patches to the firmware. Current firmware seems to be stable and working. Not 100% tested yet.

04.01.2011: We found some bugs in the firmware again. All of them seems to be fixed, release is planned tomorrow.

05.01.2011: Uploaded current firmware with a lot of patches.

08.01.2011: Some little modifications of the PCB are required. Pull-Up resistors for I²C are missing, we want to change some headers to more common one, some resistor values are missing, ...

12.01.2011: I discovered a bad problem with the board which can destroy you ISP programmer or the ATMega! When you are using the board without the 20 pin ATX connector do NOT program the board while the endstops are plugged in! The endstops may hold some lines of the ISP low. As a workaround pull out the endstops (X_MAX, X_MIN and Y_MIN) or use the 20 pin ATX connector when programming and don't forget to remove the jumper J13 when using the ATX connector!

09.02.2011: The master branch of FiveD on Adruion firmware is ported and seems to work but is not tested 100%. The config file for the firmware will come soon.

History

(Well, that part of the history which didn't result in a Release).

The Forum thread (german) where everything started.

Layout, PCB Editing

Gen7 uses gEDA, a true open source set of Electronics Development Applications (EDA). While gEDA has a bit of a learning curve and has some room for improvement regarding the graphical user interface, it's reliable, fast and well suited for the task. gEDA is available for Linux and Mac OS X and has ready-to-use packages on Debian/Ubuntu and SuSe. To install it on Ubuntu, simply type

sudo apt-get install geda geda-utils geda-xgsch2pcb

and you'll find schematics and PCB layout editor applications in your applications menu.

Typical Work Loop

RepRap is all about evolution of machines and lowering entry barriers into their (self-)replication, so here you have an easy how-to type description of a typical work loop for changing these electronics with the gEDA/PCB tool chain.

Download the files with Git or GitHub's download button. In the later case choose to download source and unpack that when done.

  • Always start editing with the project (.gsch2pcb suffix) file. You can open it by double-clicking it.
  • Select the schematics and use the button below the list to open it.
  • When done, save it and return to the project.
  • Open the PCB using one of the buttons to the right. Both have almost the same functionality.
  • If you have chosen to update the PCB, footprints no longer in use will have vanished and new or previously missing ones appear in the upper left corner. An updated list of connections (netlist) will have been loaded. Update the rats nest to find areas requiring work.
  • When done, save it and return to the project.

You get the idea?

PCB Manufacturing

gEDA can export PCBs to the Gerber and other file formats, of course.

Milling

On how to proceed further with that, see the PCB Milling page.

Etching

For etching, you likely want to reduce the amount of etched copper to a minimum. One way to get there perfectly, is to lay a ground plane into the layout.

Note: if you're in a hurry, you can leave out the step removing the tracks on the "GND-sldr" layer and setting Thermals. It'll work anyway.

  1. Open the layout in PCB.
  2. Switch to the "GND-sldr" layer.
  3. Remove all tracks on this layer ( = all light blue ones = all of the GND net minus vias and bridges, find the net with Menu -> Window -> Netlist).
  4. Draw a RECT (find the tool in the left bar) as big as the entire board.
  5. Do an "optimize rats nest" (o-key).
  6. Some non-GND tracks might be shortened with the new ground plane. Move the mouse over each of these tracks and press the "j" key (on your keyboard). Works for tracks hidden behind the ground plane as well, you'll see the difference immediately.
  7. For pins and pads you actually want to connect to the ground plane, set a Thermal (THRM tool to the left).
  8. Loop the last two steps until you get congratulations (no errors) on "optimize rats nest".
  9. In case the default clearance between the copper plane and pins/tracks are not sufficient for your purposes, you can adjust them with some command line work:
    1. Switch to the "solder" layer.
    2. Select Menu -> Edit -> Select all visible.
    3. Select Menu -> Windows -> Command Entry.
    4. Type the following and hit Enter:
      ChangeClearSize(selectedlines, 0.5, mm)
    5. Repeat the above with selectedpins instead of selectedlines.
    6. Repeat both of the above on the "Vcc-sldr" layer.
    7. As you probably guessed already, you can change this "0.5" to arbitrary values and "mm" to "mil", and use different values for each of the 4 groups.
  10. You're done.

On how to proceed with this etching-optimized board, see ... [Links needed]

Bug fixing, Sending Changes

This is community development, so getting changes from everyone is more than welcome. Write them to the forum, to the reprap-dev mailing list, use GitHub's Issue Tracker, whatever is most convenient for you. If you fork the repository at GitHub, you can also send Traumflug pull requests.