Monday, 2 September 2013
Calibrating is hard. Let's do math.
Wanted to calibrate the speed of the motors, since the ReplicatorG setting had a much larger speed than we seemed to support. So I made a nice little state machine that first moved a bit away, then moved to the min endstop, then a larger bit away, then back and forth with increasing speed. I tested it during development with the X stage, improving it over a couple iterations until I noticed I was reading from the wrong endstop. Fixing that, everything stopped moving. No response whatsover from any of the motors regardless of program. I still hear back from the Arduino, but no reaction otherwise. Odd, but time to go now.
Monday, 26 August 2013
Trim a toe and hack a heel...
I took the extruder block home and sliced a piece off the rear end, so now it doesn't hit the base of the Z stage any more. But when testing that, it turned out that at a specific X stage position, a screw in the Y stage would hit the extruder holder. 'Tis but plexiglas, I can take a wirecutter to it and snip off a corner. Works.
The lower Z endstop is not calibrated for the current height at all. Need to add a better-than-cardboard piece. Unfortunately, it's in a very tight spot -- that's one of the issues with this design: While the printing surface is nice and accessible, the L- and U-shaped aluminium pieces and the multiple layers of plexiglas makes it difficult to get in and adjust things.
Finally after some fiddling got it bolted on - though a broken-off corner on the teflon runner foot -- only in that corner, of course -- made the endstop plate bend forward, so I had to bend it back. Fiddly.
The endstops don't work the way I'd hoped to. At the moment, they seem to be floating, though the bottom Z LED registers nicely, and the bottom X LED registers weakly.
Oh. I had old pin settings on them. After fixing that, it turns out the two Z endstops and the two loose ones are fine, but the X and Y endstops are floating. I wonder if it's a problem with the mounting? Will take one off and try it on its own. Yes, definitely the case for the X endstop. I guess the bits of wire on the back side were enough to dig through the paint and short it. Adding a piece of cardboard helped quite a bit.
I'm also getting a bit concerned about the X and Y stage rail pressors. The X stage wobbles sideways quite a bit, and the Y stage jumps easily up and down. Not easy to fix, particularly the Y stage, due to the construction.
Trying the ReplicatorG calibration block. It seems to expect much higher speeds than I have given in the firmware settings. I should re-measure the speed and put in realistic rates. 4mm/sec is kinda low.
Here's some of the bits I chipped off today and the precision tool I used for it:
The lower Z endstop is not calibrated for the current height at all. Need to add a better-than-cardboard piece. Unfortunately, it's in a very tight spot -- that's one of the issues with this design: While the printing surface is nice and accessible, the L- and U-shaped aluminium pieces and the multiple layers of plexiglas makes it difficult to get in and adjust things.
Finally after some fiddling got it bolted on - though a broken-off corner on the teflon runner foot -- only in that corner, of course -- made the endstop plate bend forward, so I had to bend it back. Fiddly.
The endstops don't work the way I'd hoped to. At the moment, they seem to be floating, though the bottom Z LED registers nicely, and the bottom X LED registers weakly.
Oh. I had old pin settings on them. After fixing that, it turns out the two Z endstops and the two loose ones are fine, but the X and Y endstops are floating. I wonder if it's a problem with the mounting? Will take one off and try it on its own. Yes, definitely the case for the X endstop. I guess the bits of wire on the back side were enough to dig through the paint and short it. Adding a piece of cardboard helped quite a bit.
I'm also getting a bit concerned about the X and Y stage rail pressors. The X stage wobbles sideways quite a bit, and the Y stage jumps easily up and down. Not easy to fix, particularly the Y stage, due to the construction.
Trying the ReplicatorG calibration block. It seems to expect much higher speeds than I have given in the firmware settings. I should re-measure the speed and put in realistic rates. 4mm/sec is kinda low.
Here's some of the bits I chipped off today and the precision tool I used for it:
Monday, 5 August 2013
Crashing the Teacup
Wired the Arduino back up after last time's oscilloscope adventures. Testing first with G1 [XYZE]nn commands, only X works. With homebrew firmware, the extruder works as well.
Giving G1 E10, the extruder motor starts chopping angrily. Setting a search speed (despite the lack of real "search" capability) it moved nicely for a bit, then went back to angry chopping. Trying to adjust the potentiometer does nothing. Odd. Adjusting the potentiometer while it's running a simple back-and-forth doesn't change anything, have to turn it off and on. After adjusting, it now runs stably from Teacup, though slowly and noisily.
D'oh. Simple but consistent miswiring. Green is step (go), yellow is dir (change). Not sure why the Teacup movement is so slow. Using the G0 commands it goes zippy-fast, actually too fast for Y and Z. Setting the max feedrate for all down to 226 from 500 helped the Z, but Y is still unhappy. E is now doing fine.
M104 S100 sets the target temperature to 100ºC. M105 shows that the temperature is going up! It went 5º over before it stopped cooling. Excellent!
Crashed the Z head into the bearing holding the rod. Annoyingly, the extruder house also hits the bearing and supports, after I carefully filed parts of the underlying plate. Need to slice 4cm x 3mm off that, too. Not tonight.
The crashed head:
Giving G1 E10, the extruder motor starts chopping angrily. Setting a search speed (despite the lack of real "search" capability) it moved nicely for a bit, then went back to angry chopping. Trying to adjust the potentiometer does nothing. Odd. Adjusting the potentiometer while it's running a simple back-and-forth doesn't change anything, have to turn it off and on. After adjusting, it now runs stably from Teacup, though slowly and noisily.
D'oh. Simple but consistent miswiring. Green is step (go), yellow is dir (change). Not sure why the Teacup movement is so slow. Using the G0 commands it goes zippy-fast, actually too fast for Y and Z. Setting the max feedrate for all down to 226 from 500 helped the Z, but Y is still unhappy. E is now doing fine.
M104 S100 sets the target temperature to 100ºC. M105 shows that the temperature is going up! It went 5º over before it stopped cooling. Excellent!
Crashed the Z head into the bearing holding the rod. Annoyingly, the extruder house also hits the bearing and supports, after I carefully filed parts of the underlying plate. Need to slice 4cm x 3mm off that, too. Not tonight.
The crashed head:
Monday, 22 July 2013
Calling down the oscilloscope
Having seen no reaction from the extruder motor, I decided to use the oscilloscope in FabLab to see if the correct signals were being sent. This turned out to be a more difficult task than expected, mainly because I don't have the first clue about oscilloscopes. I and a few other FabLab members fiddled for a while with the knobs and dials without seeing any output. The calibration output showed a nice signal, but nothing from the Arduino.
It wasn't until a 70-year-old electrical engineer offered his advice that we figured out what was going on: The signal was so weak that it didn't trigger at the voltage we expected. Even though the signal is supposed to be 5V, a capacitor somewhere in the circuit cut it down so quickly that we needed to go down into 1/100ths of a volt to see the signal. Must be something in the Arduino.
With this new knowledge, I ran raw GCode commands against the Teacup firmware. Trying the various extruder-specific commands didn't do anything, but just using G1 Enn to tell the extruder to move gave the expected signal. So it does work, if you just ask it the right way. I wonder if ReplicatorG doesn't do that. Looking at the generated GCode, it does indeed use the G1 commands, maybe it's just the manual control panel that doesn't.
It wasn't until a 70-year-old electrical engineer offered his advice that we figured out what was going on: The signal was so weak that it didn't trigger at the voltage we expected. Even though the signal is supposed to be 5V, a capacitor somewhere in the circuit cut it down so quickly that we needed to go down into 1/100ths of a volt to see the signal. Must be something in the Arduino.
With this new knowledge, I ran raw GCode commands against the Teacup firmware. Trying the various extruder-specific commands didn't do anything, but just using G1 Enn to tell the extruder to move gave the expected signal. So it does work, if you just ask it the right way. I wonder if ReplicatorG doesn't do that. Looking at the generated GCode, it does indeed use the G1 commands, maybe it's just the manual control panel that doesn't.
Tuesday, 16 July 2013
Homework
Finding out what's up with the temperature does not require the full Monster. I took the Arduino home, and am using a simple potentiometer to emulate a thermistor.
Adding a printf (sersendf_P(PSTR("RAW TEMP[%d]:"), temp), to be exact) and it shows that the raw read is correct. The temperature table however always gives 0. I'm thinking something is read out of bounds.
Problem solved: The temptable is actually a list of lists of pairs of temperatures, but I only defined the list of pairs. Adding an extra pair of brackets helped immensely.
Oh, joy, new version of Arduino wants to change my filename extensions. Including those in the teacup firmware. I don't think so...
Moving on to why the extruder doesn't work... testing the voltage of the Z axis dir pin shows it changes between 0 and 5 depending on direction, while the step pin goes up a bit when told to move, regardless of direction. The step pin only goes up slightly because it's sending timed pulses. On the extruder pins (using the ReplicatorG control panel) - nothing.
Trying to figure out which GCode to use to run the extruder. M108 and M113 both give Bad M-Code. System info (M115) says there's an extruder. Turning the extruder forward/reverse (M101/M102) shows nothing on either pin. G0/G1 commands give no reaction either.
Some fiddling with G1 and M114 shows that repositioning indeed takes place. The default feedrate was 50, slow enough that it was hard to measure. At a feed rate of 1000, it's clear that there's stepping going on.
The E position is odd, but that's probably just me not understanding how a circular position is represented. It's definitely doing something, but only in one direction.
I'm not entirely convinced that Teacup thinks of the extruder as a stepper motor rather than a PWM. Must investigate later.
Adding a printf (sersendf_P(PSTR("RAW TEMP[%d]:"), temp), to be exact) and it shows that the raw read is correct. The temperature table however always gives 0. I'm thinking something is read out of bounds.
Problem solved: The temptable is actually a list of lists of pairs of temperatures, but I only defined the list of pairs. Adding an extra pair of brackets helped immensely.
Oh, joy, new version of Arduino wants to change my filename extensions. Including those in the teacup firmware. I don't think so...
Moving on to why the extruder doesn't work... testing the voltage of the Z axis dir pin shows it changes between 0 and 5 depending on direction, while the step pin goes up a bit when told to move, regardless of direction. The step pin only goes up slightly because it's sending timed pulses. On the extruder pins (using the ReplicatorG control panel) - nothing.
Trying to figure out which GCode to use to run the extruder. M108 and M113 both give Bad M-Code. System info (M115) says there's an extruder. Turning the extruder forward/reverse (M101/M102) shows nothing on either pin. G0/G1 commands give no reaction either.
Some fiddling with G1 and M114 shows that repositioning indeed takes place. The default feedrate was 50, slow enough that it was hard to measure. At a feed rate of 1000, it's clear that there's stepping going on.
The E position is odd, but that's probably just me not understanding how a circular position is represented. It's definitely doing something, but only in one direction.
I'm not entirely convinced that Teacup thinks of the extruder as a stepper motor rather than a PWM. Must investigate later.
Monday, 8 July 2013
Fiddling with GCode
Repeatably, I see the temp sensor and extruder motor working with hand-crafted Arduino code but not with Teacup firmware through the ReplicatorG manual control panel. To fix this, I took the GCode in the ReplicatorG model I'd created long ago and trimmed it down to just heating and reporting temperature. When I tried to run it, I got a number of safety check warnings.
First: Recreate GCode with the new firmware - the GCode was created for other firmware setup. Didn't change much.
Found out how to cut ReplicatorG out of the equation: By running the firmware in the Arduino app, opening the serial monitor, setting baud to 115200 and line ending to newline, I can run commands directly to the GCode interpreter. And, indeed, it just returns 0.0 for temperature. Maybe there's a problem with the thermistor table.
Tuesday, 18 June 2013
Finishing the hardware, now for the software.
After a two-week hiatus, I'm back to adjust a few things:
These are the relevant config files, for debugging the thermistor problems:
config.h:
ThermistorTable.h:
machines/reprap.xml:
- I moved the Y stepper motor driver cooler to give better access to its potentiometer, since it was overheating. Also applied thermal paste for superior heat transfer to the frame. I notice now that the power supply gives a nice breeze of air, I should point that at the drivers:)
- Took off the Z stage and tightened the mount.
- Mounted X and Z stage opto endstops.
- Found some thin metal plates to trigger the endstops.
- Ran some stress tests on the stages. The Y stage has a disconcerting tendency to just randomly refuse to move. Maybe more oil is needed.
- The extruder driver is not currently overheating, a step forward.
- I can get the extruder to heat using ReplicatorG, but the thermistor readings still look digital.
- Mounted X and Z minimum opto endstops.
- Used some scrap metal straps from the new CNC to make the endstop triggers.
These are the relevant config files, for debugging the thermistor problems:
config.h:
/* Notice to developers: this file is intentionally included twice. */
/** \file
\brief Sample Configuration
\note this sample uses AIO0 for both X_STEP and thermistor, and is intended to be an example only!
*/
/*
CONTENTS
1. Mechanical/Hardware
2. Acceleration settings
3. Pinouts
4. Temperature sensors
5. Heaters
6. Communication options
7. Miscellaneous
8. Appendix A - PWMable pins and mappings
*/
/***************************************************************************\
* *
* 1. MECHANICAL/HARDWARE *
* *
\***************************************************************************/
/*
Set your microcontroller type in Makefile! atmega168/atmega328p/atmega644p/atmega1280
If you want to port this to a new chip, start off with arduino.h and see how you go.
*/
/** \def F_CPU
CPU clock rate
*/
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
/** \def MOTHERBOARD
This is the motherboard, as opposed to the extruder. See extruder/ directory for GEN3 extruder firmware
*/
#define MOTHERBOARD
/** \def STEPS_PER_M
steps per meter ( = steps per mm * 1000 )
calculate these values appropriate for your machine
for threaded rods, this is
(steps motor per turn) / (pitch of the thread) * 1000
for belts, this is
(steps per motor turn) / (number of gear teeth) / (belt module) * 1000
half-stepping doubles the number, quarter stepping requires * 4, etc.
valid range = 20 to 4'0960'000 (0.02 to 40960 steps/mm)
all numbers are integers, so no decimal point, please :-)
*/
#define STEPS_PER_M_X 266666
#define STEPS_PER_M_Y 266666
#define STEPS_PER_M_Z 266666
/// http://blog.arcol.hu/?p=157 may help with this one
#define STEPS_PER_M_E 320000
/*
Values depending on the capabilities of your stepper motors and other mechanics.
All numbers are integers, no decimals allowed.
Units are mm/min
*/
/// used for G0 rapid moves and as a cap for all other feedrates
#define MAXIMUM_FEEDRATE_X 500 // 226
#define MAXIMUM_FEEDRATE_Y 500 // 226
#define MAXIMUM_FEEDRATE_Z 500 // 226
#define MAXIMUM_FEEDRATE_E 200
/// used when searching endstops and as default feedrate
#define SEARCH_FEEDRATE_X 50
#define SEARCH_FEEDRATE_Y 50
#define SEARCH_FEEDRATE_Z 50
// no SEARCH_FEEDRATE_E, as E can't be searched
/** \def SLOW_HOMING
wether to search the home point slowly
With some endstop configurations, like when probing for the surface of a PCB, you can't deal with overrunning the endstop. In such a case, uncomment this definition.
*/
// #define SLOW_HOMING
/// this is how many steps to suck back the filament by when we stop. set to zero to disable
#define E_STARTSTOP_STEPS 20
/**
Soft axis limits, in mm.
Define them to your machine's size relative to what your host considers to be the origin.
*/
#define X_MIN -140.0
#define X_MAX 140.0
#define Y_MIN -80.0
#define Y_MAX 80.0
#define Z_MIN -55.0
#define Z_MAX 55.0
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE
/***************************************************************************\
* *
* 2. ACCELERATION *
* *
* IMPORTANT: choose only one! These algorithms choose when to step, trying *
* to use more than one will have undefined and probably *
* disastrous results! *
* *
\***************************************************************************/
/** \def ACCELERATION_REPRAP
acceleration, reprap style.
Each movement starts at the speed of the previous command and accelerates or decelerates linearly to reach target speed at the end of the movement.
*/
#define ACCELERATION_REPRAP
/** \def ACCELERATION_RAMPING
acceleration and deceleration ramping.
Each movement starts at (almost) no speed, linearly accelerates to target speed and decelerates just in time to smoothly stop at the target. alternative to ACCELERATION_REPRAP
*/
// #define ACCELERATION_RAMPING
/** \def ACCELERATION
how fast to accelerate when using ACCELERATION_RAMPING.
given in mm/s^2, decimal allowed, useful range 1. to 10'000. Start with 10. for milling (high precision) or 1000. for printing
*/
#define ACCELERATION 1000.
/** \def ACCELERATION_TEMPORAL
temporal step algorithm
This algorithm causes the timer to fire when any axis needs to step, instead of synchronising to the axis with the most steps ala bresenham.
This algorithm is not a type of acceleration, and I haven't worked out how to integrate acceleration with it.
However it does control step timing, so acceleration algorithms seemed appropriate
The Bresenham algorithm is great for drawing lines, but not so good for steppers - In the case where X steps 3 times to Y's two, Y experiences massive jitter as it steps in sync with X every 2 out of 3 X steps. This is a worst-case, but the problem exists for most non-45/90 degree moves. At higher speeds, the jitter /will/ cause position loss and unnecessary vibration.
This algorithm instead calculates when a step occurs on any axis, and sets the timer to that value.
// TODO: figure out how to add acceleration to this algorithm
*/
// #define ACCELERATION_TEMPORAL
/***************************************************************************\
* *
* 3. PINOUTS *
* *
\***************************************************************************/
/*
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
*/
#include "arduino.h"
/** \def USE_INTERNAL_PULLUPS
internal pullup resistors
the ATmega has internal pullup resistors on its input pins which are counterproductive with the commonly used eletronic endstops, so they should be switched off. For other endstops, like mechanical ones, you may want to uncomment this.
*/
//#define USE_INTERNAL_PULLUPS
/*
user defined pins
adjust to suit your electronics,
or adjust your electronics to suit this
*/
#define X_STEP_PIN DIO4
#define X_DIR_PIN DIO5
#define X_MIN_PIN AIO5
//#define X_MAX_PIN xxxx
//#define X_ENABLE_PIN xxxx
//#define X_INVERT_DIR
//#define X_INVERT_MIN
//#define X_INVERT_MAX
//#define X_INVERT_ENABLE
#define Y_STEP_PIN DIO6
#define Y_DIR_PIN DIO7
#define Y_MIN_PIN AIO4
//#define Y_MAX_PIN xxxx
//#define Y_ENABLE_PIN xxxx
//#define Y_INVERT_DIR
//#define Y_INVERT_MIN
//#define Y_INVERT_MAX
//#define Y_INVERT_ENABLE
#define Z_STEP_PIN DIO8
#define Z_DIR_PIN DIO9
#define Z_MIN_PIN AIO3
//#define Z_MAX_PIN xxxx
//#define Z_ENABLE_PIN xxxx
//#define Z_INVERT_DIR
//#define Z_INVERT_MIN
//#define Z_INVERT_MAX
//#define Z_INVERT_ENABLE
#define E_STEP_PIN DIO2
#define E_DIR_PIN DIO3
//#define E_ENABLE_PIN xxxx
//#define E_INVERT_DIR
//#define E_INVERT_ENABLE
//#define PS_ON_PIN DIO9
//#define STEPPER_ENABLE_PIN xxxx
//#define STEPPER_INVERT_ENABLE
/***************************************************************************\
* *
* 4. TEMPERATURE SENSORS *
* *
\***************************************************************************/
/**
TEMP_HYSTERESIS: actual temperature must be target +/- hysteresis before target temperature can be achieved.
Unit is degree Celsius.
*/
#define TEMP_HYSTERESIS 5
/**
TEMP_RESIDENCY_TIME: actual temperature must be close to target (within
set temperature +- TEMP_HYSTERESIS) for this long before target is achieved
(and a M116 succeeds). Unit is seconds.
*/
#define TEMP_RESIDENCY_TIME 60
/**
TEMP_EWMA: Smooth noisy temperature sensors. Good hardware shouldn't be
noisy. Set to 1.0 for unfiltered data (and a 140 bytes smaller binary).
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
quicker but rougher. If you need to use this, set the PID parameter to zero
(M132 S0) to make the PID loop insensitive to noise.
Valid range: 0.001 to 1.0
*/
#define TEMP_EWMA 1.0
/// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board.
// #define TEMP_MAX6675
#define TEMP_THERMISTOR
// #define TEMP_AD595
// #define TEMP_PT100
// #define TEMP_INTERCOM
/***************************************************************************\
* *
* Define your temperature sensors here. One line for each sensor, only *
* limited by the number of available ATmega pins. *
* *
* Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595, *
* TT_PT100, TT_INTERCOM. See list in temp.c. *
* *
* The "additional" field is used for TT_THERMISTOR only. It defines the *
* name of the table(s) in ThermistorTable.h to use. Typically, this is *
* THERMISTOR_EXTRUDER for the first or only table, or THERMISTOR_BED for *
* the second table. See also early in ThermistorTable.{single|double}.h. *
* *
* For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin *
* won't be used in this case. *
* *
\***************************************************************************/
#ifndef DEFINE_TEMP_SENSOR
#define DEFINE_TEMP_SENSOR(...)
#endif
// There is an apparent bug in temp.h that it uses analog pin # corresponding
// to the temp sensor #, not the pin # given. So I use AIO0.
// name type pin additional
DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO0, THERMISTOR_EXTRUDER)
//DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
// "noheater" is a special name for a sensor which doesn't have a heater.
// Use "M105 P#" to read it, where # is a zero-based index into this list.
// DEFINE_TEMP_SENSOR(noheater, TT_THERMISTOR, 1, 0)
/***************************************************************************\
* *
* 5. HEATERS *
* *
\***************************************************************************/
/** \def HEATER_SANITY_CHECK
check if heater responds to changes in target temperature, disable and spit errors if not
largely untested, please comment in forum if this works, or doesn't work for you!
*/
// #define HEATER_SANITY_CHECK
/***************************************************************************\
* *
* Define your heaters and devices here. *
* *
* To attach a heater to a temp sensor above, simply use exactly the same *
* name - copy+paste is your friend. Some common names are 'extruder', *
* 'bed', 'fan', 'motor', ... names with special meaning can be found *
* in gcode_process.c. Currently, these are: *
* HEATER_extruder (M104) *
* HEATER_bed (M140) *
* HEATER_fan (M106) *
* *
* Devices don't neccessarily have a temperature sensor, e.g. fans or *
* milling spindles. Operate such devices by setting their power (M106), *
* instead of setting their temperature (M104). *
* *
* Also note, the index of a heater (M106 P#) can differ from the index of *
* its attached temperature sensor (M104 P#) in case sensor-less devices *
* are defined or the order of the definitions differs. The first defined *
* device has the index 0 (zero). *
* *
* Set 'pwm' to ... *
* 1 for using PWM on a PWM-able pin and on/off on other pins. *
* 0 for using on/off on a PWM-able pin, too. *
* Using PWM usually gives smoother temperature control but can conflict *
* with slow switches, like solid state relays. PWM frequency can be *
* influenced globally with FAST_PWM, see below. *
* *
\***************************************************************************/
#ifndef DEFINE_HEATER
#define DEFINE_HEATER(...)
#endif
// name port pwm
DEFINE_HEATER(extruder, PB3, 0) // DIO11
//DEFINE_HEATER(bed, PB4, 1)
// DEFINE_HEATER(fan, PINB4, 1)
// DEFINE_HEATER(chamber, PIND7, 1)
// DEFINE_HEATER(motor, PIND6, 1)
/// and now because the c preprocessor isn't as smart as it could be,
/// uncomment the ones you've listed above and comment the rest.
/// NOTE: these are used to enable various capability-specific chunks of code, you do NOT need to create new entries unless you are adding new capabilities elsewhere in the code!
/// so if you list a bed above, uncomment HEATER_BED, but if you list a chamber you do NOT need to create HEATED_CHAMBER
/// I have searched high and low for a way to make the preprocessor do this for us, but so far I have not found a way.
#define HEATER_EXTRUDER HEATER_extruder
//#define HEATER_BED HEATER_bed
// #define HEATER_FAN HEATER_fan
// #define HEATER_CHAMBER HEATER_chamber
// #define HEATER_MOTOR HEATER_motor
/***************************************************************************\
* *
* 6. COMMUNICATION OPTIONS *
* *
\***************************************************************************/
/** \def BAUD
Baud rate for the serial RS232 protocol connection to the host. Usually
115200, other common values are 19200, 38400 or 57600. Ignored when USB_SERIAL
is defined.
*/
#define BAUD 115200
/** \def USB_SERIAL
Define this for using USB instead of the serial RS232 protocol. Works on
USB-equipped ATmegas, like the ATmega32U4, only.
*/
//#define USB_SERIAL
/** \def XONXOFF
Xon/Xoff flow control.
Redundant when using RepRap Host for sending GCode, but mandatory when sending GCode files with a plain terminal emulator, like GtkTerm (Linux), CoolTerm (Mac) or HyperTerminal (Windows).
Can also be set in Makefile
*/
// #define XONXOFF
/***************************************************************************\
* *
* 7. MISCELLANEOUS OPTIONS *
* *
\***************************************************************************/
/** \def EECONFIG
EECONFIG: Enable EEPROM configuration storage.
Enabled by default. Commenting this out makes the binary several hundred
bytes smaller, so you might want to disable EEPROM storage on small MCUs,
like the ATmega168.
*/
#define EECONFIG
/** \def DEBUG
DEBUG
enables /heaps/ of extra output, and some extra M-codes.
WARNING: this WILL break most host-side talkers that expect particular responses from firmware such as reprap host and replicatorG
use with serial terminal or other suitable talker only.
*/
// #define DEBUG
/** \def BANG_BANG
BANG_BANG
drops PID loop from heater control, reduces code size significantly (1300 bytes!)
may allow DEBUG on '168
*/
// #define BANG_BANG
/** \def BANG_BANG_ON
BANG_BANG_ON
PWM value for 'on'
*/
// #define BANG_BANG_ON 200
/** \def BANG_BANG_OFF
BANG_BANG_OFF
PWM value for 'off'
*/
// #define BANG_BANG_OFF 45
/**
move buffer size, in number of moves
note that each move takes a fair chunk of ram (69 bytes as of this writing) so don't make the buffer too big - a bigger serial readbuffer may help more than increasing this unless your gcodes are more than 70 characters long on average.
however, a larger movebuffer will probably help with lots of short consecutive moves, as each move takes a bunch of math (hence time) to set up so a longer buffer allows more of the math to be done during preceding longer moves
*/
#define MOVEBUFFER_SIZE 8
/** \def DC_EXTRUDER
DC extruder
If you have a DC motor extruder, configure it as a "heater" above and define this value as the index or name. You probably also want to comment out E_STEP_PIN and E_DIR_PIN in the Pinouts section above.
*/
// #define DC_EXTRUDER HEATER_motor
// #define DC_EXTRUDER_PWM 180
/** \def USE_WATCHDOG
Teacup implements a watchdog, which has to be reset every 250ms or it will reboot the controller. As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now.
*/
// #define USE_WATCHDOG
/**
analog subsystem stuff
REFERENCE - which analog reference to use. see analog.h for choices
*/
#define REFERENCE REFERENCE_AVCC
/** \def STEP_INTERRUPT_INTERRUPTIBLE
this option makes the step interrupt interruptible (nested).
this should help immensely with dropped serial characters, but may also make debugging infuriating due to the complexities arising from nested interrupts
\note disable this option if you're using a '168 or for some reason your ram usage is above 90%. This option hugely increases likelihood of stack smashing.
*/
#define STEP_INTERRUPT_INTERRUPTIBLE 1
/**
temperature history count. This is how many temperature readings to keep in order to calculate derivative in PID loop
higher values make PID derivative term more stable at the expense of reaction time
*/
#define TH_COUNT 8
/** \def FAST_PWM
Teacup offers two PWM frequencies, 76(61) Hz and 78000(62500) Hz on a
20(16) MHz electronics. The slower one is the default, as it's the safer
choice. Drawback is, in a quiet environment you might notice the heaters
and your power supply humming.
Uncomment this option if you want to get rid of this humming or want
faster PWM for other reasons.
See also: http://reprap.org/wiki/Gen7_Research#MOSFET_heat_and_PWM
*/
// #define FAST_PWM
/// this is the scaling of internally stored PID values. 1024L is a good value
#define PID_SCALE 1024L
/** \def ENDSTOP_STEPS
number of steps to run into the endstops intentionally
As Endstops trigger false alarm sometimes, Teacup debounces them by counting a number of consecutive positives. Valid range is 1...255. Use 4 or less for reliable endstops, 8 or even more for flaky ones.
*/
#define ENDSTOP_STEPS 4
/***************************************************************************\
* *
* 8. APPENDIX A - PWMABLE PINS AND MAPPINGS *
* *
* *
* list of PWM-able pins and corresponding timers *
* timer1 is used for step timing so don't use OC1A/OC1B *
* they are omitted from this listing for that reason *
* *
* For the atmega168/328, timer/pin mappings are as follows *
* *
* OCR0A - PD6 - DIO6 *
* OCR0B - PD5 - DIO5 *
* OCR2A - PB3 - DIO11 *
* OCR2B - PD3 - DIO3 *
* *
* For the atmega644, timer/pin mappings are as follows *
* *
* OCR0A - PB3 - DIO3 *
* OCR0B - PB4 - DIO4 *
* OCR2A - PD7 - DIO15 *
* OCR2B - PD6 - DIO14 *
* *
* For the atmega1280, timer/pin mappings are as follows *
* *
* OCR0A - PB7 - DIO13 *
* OCR0B - PG5 - DIO4 *
* OCR2A - PB4 - DIO10 *
* OCR2B - PH6 - DIO9 *
* OCR3AL - PE3 - DIO5 *
* OCR3BL - PE4 - DIO2 *
* OCR3CL - PE5 - DIO3 *
* OCR4AL - PH3 - DIO6 *
* OCR4BL - PH4 - DIO7 *
* OCR4CL - PH5 - DIO8 *
* OCR5AL - PL3 - DIO46 *
* OCR5BL - PL4 - DIO45 *
* OCR5CL - PL5 - DIO44 *
* *
\***************************************************************************/
// Thermistor lookup table for one thermistor or
// identical thermistors in all places.
/*
This table doesn't depend on the type of electronics, but on the type of
thermistor(s) you use. You want one table for each thermistor type you use.
*/
// How many thermistor tables we have.
#define NUMTABLES 1
// Names for our tables, so you can use them in config.h.
// Table numbering starts at 0.
#define THERMISTOR_EXTRUDER 0
/*
You may be able to improve the accuracy of this table in various ways.
1. Measure the actual resistance of the resistor. It's "nominally" 4.7K,
but that's ± 5%.
2. Measure the actual beta of your thermistor:
http://reprap.org/wiki/MeasuringThermistorBeta
3. Generate more table entries than you need, then trim down the ones
in uninteresting ranges.
In either case you'll have to regenerate this table with
createTemperatureLookup.py, which requires python, which is difficult to
install on windows. Since you'll have to do some testing to determine the
correct temperature for your application anyway, you may decide that the
effort isn't worth it. Who cares if it's reporting the "right" temperature
as long as it's keeping the temperature steady enough to print, right?
*/
// The number of value pairs in our table.
// Must be the same for all tables.
#define NUMTEMPS 21
uint16_t const temptable[NUMTABLES][NUMTEMPS][2] PROGMEM = {
// Table for the Extruder.
// Thermistor: unknown
// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023
// {ADC, temp*4 }, // temp Rtherm Vtherm resolution power
{ 1, 6645}, // 1661.41 C, 1 Ohm, 0.005 V, 480.29 C/count, 0.02mW
{ 54, 1554}, // 388.64 C, 56 Ohm, 0.264 V, 2.13 C/count, 1.25mW
{ 107, 1269}, // 317.50 C, 117 Ohm, 0.522 V, 0.90 C/count, 2.34mW
{ 160, 1121}, // 280.36 C, 185 Ohm, 0.781 V, 0.56 C/count, 3.30mW
{ 213, 1020}, // 255.23 C, 263 Ohm, 1.040 V, 0.41 C/count, 4.12mW
{ 266, 944}, // 236.05 C, 351 Ohm, 1.299 V, 0.32 C/count, 4.81mW
{ 319, 881}, // 220.34 C, 452 Ohm, 1.558 V, 0.27 C/count, 5.36mW
{ 372, 827}, // 206.83 C, 571 Ohm, 1.816 V, 0.24 C/count, 5.78mW
{ 425, 779}, // 194.79 C, 710 Ohm, 2.075 V, 0.22 C/count, 6.07mW
{ 478, 734}, // 183.74 C, 875 Ohm, 2.334 V, 0.20 C/count, 6.22mW
{ 531, 693}, // 173.34 C, 1077 Ohm, 2.593 V, 0.19 C/count, 6.24mW
{ 584, 653}, // 163.33 C, 1327 Ohm, 2.852 V, 0.19 C/count, 6.13mW
{ 637, 613}, // 153.48 C, 1646 Ohm, 3.110 V, 0.19 C/count, 5.88mW
{ 690, 574}, // 143.54 C, 2066 Ohm, 3.369 V, 0.19 C/count, 5.49mW
{ 743, 533}, // 133.26 C, 2644 Ohm, 3.628 V, 0.20 C/count, 4.98mW
{ 796, 489}, // 122.28 C, 3491 Ohm, 3.887 V, 0.22 C/count, 4.33mW
{ 849, 440}, // 110.02 C, 4851 Ohm, 4.146 V, 0.25 C/count, 3.54mW
{ 902, 381}, // 95.39 C, 7393 Ohm, 4.404 V, 0.31 C/count, 2.62mW
{ 955, 302}, // 75.57 C, 13841 Ohm, 4.663 V, 0.46 C/count, 1.57mW
{1008, 141}, // 35.46 C, 63000 Ohm, 4.922 V, 1.45 C/count, 0.38mW
{1021, 1} // 0.43 C, 340333 Ohm, 4.985 V, 5.42 C/count, 0.07mW}
};
<?xml version="1.1" encoding="utf-8"?>
<machines>
<machine experimental="0">
<name>Monster w/Teacup (115200 Baud)</name>
<geometry type="cartesian">
<axis id="x" length="140" maxfeedrate="500" stepspermm="266" endstops="min"/>
<axis id="y" length="80" maxfeedrate="500" stepspermm="266" endstops="min"/>
<axis id="z" length="55" maxfeedrate="500" stepspermm="266" endstops="min"/>
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="false" valve="false" collet="false" heater="true" stepper_axis="a" motor_steps="1000" heatedplatform="false" />
</tools>
<clamps></clamps>
<firmware url="???" autoupgrade="false"></firmware>
<help name="Teacup Help" url="http://reprap.org/wiki/Teacup_Firmware"></help>
<driver name="reprap5d">
<okAfterResend>false</okAfterResend> <!-- Teacup option for reprap5d driver -->
<alwaysRelativeE>true</alwaysRelativeE> <!-- Teacup option for reprap5d driver -->
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<debugLevel>0</debugLevel>
<fived>true</fived>
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
</cooldown>
</machine>
<machine experimental="0">
<name>Klimentkip (115200 Baud)</name>
<geometry type="cartesian">
<axis id="x" length="205" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="y" length="195" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="z" length="140" maxfeedrate="200" stepspermm="1133.858" endstops="min"/>
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" stepper_axis="a" motor_steps="1000" heatedplatform="true" />
</tools>
<clamps></clamps>
<firmware url="???" autoupgrade="false"></firmware>
<help name="Gcode Help" url="http://reprap.org/wiki/Gcode"></help>
<driver name="reprap5d">
<okAfterResend>true</okAfterResend>
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<debugLevel>0</debugLevel>
<fived>true</fived>
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
</cooldown>
</machine>
<machine experimental="0">
<name>RepRap5d (76800 Baud)</name>
<geometry type="cartesian">
<axis id="x" length="205" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="y" length="195" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="z" length="140" maxfeedrate="200" stepspermm="1133.858" endstops="min"/>
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" stepper_axis="a" motor_steps="1000" heatedplatform="true" />
</tools>
<clamps></clamps>
<firmware url="???" autoupgrade="false"></firmware>
<help name="Gcode Help" url="http://reprap.org/wiki/Gcode"></help>
<driver name="reprap5d">
<okAfterResend>true</okAfterResend>
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<debugLevel>0</debugLevel>
<fived>true</fived>
<rate>76800</rate> <!-- higher and fw drops too many chars -->
</driver>
<warmup>
</warmup>
<cooldown>
</cooldown>
</machine>
<machine experimental="0">
<name>Teacup (115200 Baud)</name>
<geometry type="cartesian">
<axis id="x" length="205" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="y" length="195" maxfeedrate="5000" stepspermm="31.496" endstops="min"/>
<axis id="z" length="140" maxfeedrate="200" stepspermm="1133.858" endstops="min"/>
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" stepper_axis="a" motor_steps="1000" heatedplatform="true" />
</tools>
<clamps></clamps>
<firmware url="???" autoupgrade="false"></firmware>
<help name="Teacup Help" url="http://reprap.org/wiki/Teacup_Firmware"></help>
<driver name="reprap5d">
<okAfterResend>false</okAfterResend> <!-- Teacup option for reprap5d driver -->
<alwaysRelativeE>true</alwaysRelativeE> <!-- Teacup option for reprap5d driver -->
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<debugLevel>0</debugLevel>
<fived>true</fived>
<rate>115200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
</cooldown>
</machine>
<machine experimental="1">
<name>Mendel with Gen 3 Electronics (19200 Baud)</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="200" maxfeedrate="5000" stepspermm="47.069852" endstops="min"/> <!-- 16th-step driver -->
<axis id="y" length="200" maxfeedrate="5000" stepspermm="47.0698523" endstops="min"/> <!-- 16th-step driver -->
<axis id="z" length="140" maxfeedrate="30" stepspermm="160" endstops="min"/> <!-- quarter-step driver -->
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" motor_steps="200" heatedplatform="true" />
</tools>
<clamps></clamps>
<help name="RepRap Help" url="http://www.reprap.org/ReplicatorG"></help>
<driver name="reprap5d">
<!-- optional: <portname>COM1</portname>!-->
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<fived>true</fived>
<rate>19200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
(Turn off steppers after a build.)
M108 S0
</cooldown>
</machine>
<machine experimental="1">
<name>Darwin with Gen 2 Electronics (19200 Baud)</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="200" maxfeedrate="5000" stepspermm="47.069852" endstops="min"/> <!-- 16th-step driver -->
<axis id="y" length="200" maxfeedrate="5000" stepspermm="47.0698523" endstops="min"/> <!-- 16th-step driver -->
<axis id="z" length="140" maxfeedrate="30" stepspermm="160" endstops="min"/> <!-- quarter-step driver -->
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" motor_steps="200" heatedplatform="true" />
</tools>
<clamps></clamps>
<help name="RepRap Help" url="http://www.reprap.org/ReplicatorG"></help>
<driver name="reprap5d">
<!-- optional: <portname>COM1</portname>!-->
<pulserts>false</pulserts>
<waitforstart enabled="false"></waitforstart>
<checksums>false</checksums>
<fived>true</fived>
<rate>19200</rate>
</driver>
<warmup>
</warmup>
<cooldown>
(Turn off steppers after a build.)
M108 S0
</cooldown>
</machine>
<machine experimental="1">
<name>Mendel with Mega/RAMPS Electronics (57600 baud)</name>
<geometry type="cartesian">
<!-- different pulleys on X and Y axii -->
<axis id="x" length="200" maxfeedrate="5000" scale="47.069852" endstops="min"/> <!-- 16th-step driver -->
<axis id="y" length="200" maxfeedrate="5000" scale="47.0698523" endstops="min"/> <!-- 16th-step driver -->
<axis id="z" length="140" maxfeedrate="150" scale="160" endstops="min"/> <!-- quarter-step driver -->
</geometry>
<tools>
<tool name="Stepper-based extruder" type="extruder" material="abs" motor="true" floodcoolant="false" mistcoolant="false" fan="true" valve="false" collet="false" heater="true" motor_steps="200" heatedplatform="true" />
</tools>
<clamps></clamps>
<help name="RepRap Help" url="http://www.reprap.org/ReplicatorG"></help>
<driver name="reprap5d">
<!-- optional, defaults to first serial port found. <portname>COM1</portname> -->
<rate>57600</rate>
<parity>8</parity>
<pulserts>true</pulserts>
<waitforstart enabled="true" timeout="1000" retries="3"></waitforstart>
<fived>true</fived>
<!-- optional, defaults to 1. <databits>1</databits> -->
<!-- optional, defaults to N. <stopbits>N</stopbits> -->
</driver>
<warmup>
</warmup>
<cooldown>
(Turn off steppers after a build.)
M108 S0
</cooldown>
</machine>
</machines>
Subscribe to:
Posts (Atom)
-
I've had the worst time with my PETG filament, test prints literally exploding during the print and finished prints being very brittle. ...
-
Trying to get things to work on my iMac. On Tim's advice, trying out Lulzbot Cura, and it does seem nicer, including pretty much all the...
-
After +Tim Hatch 's suggestion started making more and more sense, I re-soldered the Z and E microstepper jumpers. After that, it's...

