Repic

From RepRap
Revision as of 20:49, 18 November 2010 by Myndale (talk | contribs) (Repic - Minimal USB-based electronics for RepRap)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." - Antoine de Saint-Exupery

This page details the experimental electronics I am in the process of developing for RepRap and CNC routers. It may be of interest to programmers who are familiar with Visual Studio Express and want to play around with the RepRap firmware within that environment using a minimal set of hardware.

Please note that Repic is still in development and has not yet been tested. Repic is a significant departure from the RepRap official standard both in terms of architectural design and compatibility. It is experimental and is in no way meant to replace the official electronics. I'm making it publicly available in keeping with the spirit of RepRap, but it's up to RepRap-dev and the community as a whole to decide whether any of it has any merit.

Current Status

Motherboard design complete.

PCB partially built. USB link and in-circuit programming have been tested and are working.

Firmware is still in development and not yet usable.

Host software is still in development and not yet usable.

Design Goals

The primary design goal for Repic is to pare the electronics back to an absolute minimum. This means designing a single-sided, through-hole PCB that can be easily made at home. It also means a lowering of cost: a full set of electronics on EBay frequently sells in excess of AU$300 whereas a complete set of Repic-based electronics costs around $80, including the four Pololu stepper drivers. I am currently researching ways to safely replace the Pololus with PWM-controlled H-bridges which should bring the price down further to around $40. Another consideration is that the holy grail of RepRap is 100% replication; the more complex the hardware requirements, the longer this will take to achieve.

A secondary goal of Repic is to make it as user friendly as possible. In pursuit of this goal I have chosen to move to a USB-based hardware interface. This allows RepRap to support full plug-n-play capability as well as removing the need for a USB->serial convertor and the associated configuration headaches for the end user.

Initial Design

For the main controller of my motherboard I have replaced the Arduino-based architecture with one based on the Microchip PIC series. My current PIC of choice is the 18F4550 which has several advantages:

- Cost. At $11 per chip it's about the same as an Arduino.
- Native USB 2.0 compliancy. Development of USB client devices is extremely easy with this chip.
- Minimum support electronics required.
- Good I/O support. Up to 16 bi-directional digital endpoints, 13 10-bit A/D inputs and 1 D/A output.
- Support for both SMD and thru-hole form factors.

One of the disadvantages to using this chipset is that the standard RepRap firmware has been developed in C++ and there is no freeware C++ compiler available for the PIC18 architecture. Personally I question the decision to use C++ in any type of low-level embedded system such as RepRap for a whole variety of reasons, but that's what we have so that's what I work with. For the time being I get around the problem by running it host-side, which means Repic cannot operate in standalone mode and must rely on the host PC to do the gcode parsing for now. On the plus side, the firmware is reduced to just a few dozen lines of C code and the need for an end-user to re-flash the firmware is virtually eliminated.

There is a project currently in development to port the official RepRap firmware to C99, when completed I intend to move this into the Repic firmware and switch to the PIC 24F series which will in turn allow the Repic motherboard to operate in USB host mode. This will allow support for reading gcode files off the now well-established USB memstick standard, thus replacing the current SD-card based system and finalizing the design of Repic as a fully USB-compliant device.

Repic Motherboard

The Repic motherboard is a single-sided PCB using through-hole components only. There are no jumpers or thin traces between pins. The board supports the following features:

- A USB interface port.
- Plug in slots for four Pololu driver boards (three motors and one extruder).
- Terminals for microswitch endstops (although opto-endstops are also supported).
- Terminals for the extruder heater, two PWM-controlled heatbeds (5V and 12V) and two thermistors.

Repic Host Software

The host software is still in the very early stages of development. I currently have the official firmware running host-side with the output feeding into a 3D model of RepRap with support for extrusion rendering. This is effectively a "Virtual Mendel" that allows me to "play" print sequences in realtime (albeit at much higher speed) before committing them to plastic.

Repic Project Files

Unless you're a curious developer and willing to get your hands dirty there's not much here that will be useful to you, but building Repic electronics will involve the following steps:

1) Download the PCB files and make a single-sided PCB from them.
2) Load the bootloader image into the PIC18F4550. If you don't have a PIC burner then try breadboarding one. Then install the chip onto the Repic circuit board.
3) Download the Repic firmware and upload it to the chip. To do this, plug Repic into the host PC (or press the reset button) while holding down the program button. Then use the Microchip bootloader to upload the firmware into the chip.
4) Assemble the rest of your RepRap as normal plugging in the motors, IR end-stops, heater coil and temperature probe into the appropriate sockets.

The entire project package can be downloaded here (todo: add these links):

- Repic v0.1 (alpha) Project Files The package includes the following components:
- Parts list Eagle layout files Circuit schematic PCB image 3D render Firmware source code Compiled firmware hex file Host software executableHost software source code.

You'll also need the following software installed:

- Eagle (needed to open and edit the circuit schematic and PCB project files).
- Microsoft Visual C++ 2010 Express (needed to compile the gcode parser class library, which is based on the official firmware).
- Microsoft Visual C# 2010 Express (needed to compile the WPF front-end and USB interface code).
- MPAB IDE v8.56 (needed to open the firmware project and edit settings etc).
- MPAB C18 Compiler  (needed to compile the firmware)