Mattroberts' Firmware
Release status: Beta
Description | Firmware
|
License | |
Author | |
Contributors | |
Based-on | |
Categories | |
CAD Models | |
External Link |
Introduction
This code describes my firmware. My intention is simply to document (with working code) the various tricks that I think I've done first (or best).
Download
The license for the firmware is CC-by-3.0. And it can be downloaded from this link...
In order to compile it, you'll also need to install two supporting libraries (MIT licenced)...
What File Does What?
- config.h contains the description of the printer (in terms of steps/mm, maximum feedrate, baud rate to use, etc.)
- parse.c contains the gcode parser
- cmd.c contains the command interpretor
- dda.c contains the line drawing algorithm
- divide.c, log.c, dist.c contain supporting functions for dda.c
- hw/ contains the real implementation of all the various things that the hardware does. All the AVR specific code is here.
- hw/pins.h contains a description of the motherboard (which pin drives what thing)
- sim.c contains a simple implementation of all the hardware functions. This allows one to test a firmware before uploading to a printer.
- host.c contains a simple terminal program that can send gcode files to the printer.
Pressure Management
The unique feature of this firmware is the pressure management code. This code is contained in dda.c.
The basic idea is to model the extruder as a spring driving an incompressible fluid through the nozzle. This means that one can calculate the displacement to apply to the spring to achieve the desire flow rate. In the code: this displacement is called advance, is meassured in steps and added to E axis position.
The mathematics behind the calculation is described in config.h, repeated below:
// extruder advance constant (s2/mm3) // // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2 // // model the extruder as a spring followed by an incompressible fluid... // hooke's law says: force = k * distance // bernoulli's priniciple says: v ^ 2 / 2 + g . h + pressure / density = constant // ...so: v ^ 2 is proportional to number of steps we 'advance' the extruder #define EXTRUDER_ADVANCE_K 0.010