Tuesday, April 21, 2009

Extruder Tempuratue Control

So I have been spending some time trying to fully implement PID heater control for my EMC based repstrap. As part of that I needed to get all the bugs worked out of the heater design. I'll post of pictures of my new compact extruder heater a little later, I left my USB cable at home.

Well I have reduced the mass of the extruder greatly and attached my thermocouple inside of the heater. By doing this I was able to reduce the warm up time, from 20 C to 220 C, to about 18 seconds. I'm using a 16 ohm resistance heater with a 24VDC supply, so about 36 watts max. Here is the responce shown in the Hal scope:

I'm using a maxim MAX6675 thermocouple to SPI interface (read by a mesa 7i43 anything I/O FPGA board running hostmot2). The Max 6675 chip requires about 100ms to perform a conversion, so I'm sampling it at a little less than 10hz. I have tunned the PID parameters so that the responce time is fast, but there is little overshoot (1-2 degrees) and high disturbance rejection.

For you EMC guys, right now I'm using the hm2 raw interface with a custom realtime component to do the SPI communication. Hopefully somtime soon we will be able to have a formal SPI interface for hm2. I used comp to make the rt component, it is attached to hm2 in the hal.

Here is the dirty awefull code for the comp file:
// This is a component for EMC2 HAL
// Copyright 2009 Jon George
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General
// Public License as published by the Free Software Foundation.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
component SPI "Drive my SPI thermcouple amp";

//Setup the pins
pin in u32 raw_read_data "Raw Read data";
pin out u32 raw_write_data "Raw Write data" ;
pin io bit raw_strobe "strobe the raw write";
pin out u32 raw_write_address "raw write addres";
pin out u32 raw_read_address "Raw read adderes";
pin out float temp "Current Temp";
pin in u32 CD "the all mighty channel descriptor";
pin in u32 timer ;

//Initialize a variable to store the iteration number
variable u32 iteration=1;// "used to store the interation before configuration"

function _;
license "GPL";
//Select the correct case based on the current iteration
case 1: {
// Set up the DDR for the port
raw_write_address= 0x1104;
raw_write_data= ((raw_read_data | 0x3B000) & 0xFFBFFF);
raw_read_address= 0x1204;
case 2: {
//Set up the alt source stuff
raw_write_address= 0x1204;
raw_write_data= raw_read_data | 0x3F000;
case 3: {
//Set up the DBSPI chanell descriptor
raw_write_address= 0x5900;
raw_write_data= CD;
case 4: {
// The regular running type
//Request the data
raw_write_address= 0x5800;
raw_write_data= 0xFFFFFFFF;
case 5: {
// Actually read the data on the next cycle
// Read the data
// Note-The data is one cycle old by now!!!!
temp =((raw_read_data & 0x7ff8)>>3)/4.0;
if(iteration > timer) iteration =4; //only return to case 4

Anyhow, I hope this makes us a little step closer to having a really fantastic Reprap interface for EMC.

No comments:

Post a Comment