3d Printer - part 6
Progress continues slowly on my 3d printer. While waiting for the increasingly erratic Chinese postal system, I set about getting the extruder and hot-end working.
The hot-end is responsible for turning the plastic filament into a model, by melting it and squeezing it out of a tiny hole. The filament looks a bit like white spaghetti, or like the cutting cord used in line-trimmers in the garden.
The extruder grabs the filament and pushes it down a tube to the hot-end. The hot-end has a large block of metal with a heater and temperature sensor built into it; these work in concert to keep the metal block at a constant temperature, about 180°C for melting the PLA plastic that I have.
So I sent about making sure it was all going to work. First test was to ensure that the temperature sensor worked correctly. The hot-end I'd purchased had a thermistor built into it, which is a type of resister that changes its value as its temperature rises and falls. I did some tests and seemed to be getting very weird readings; at one point the machine was telling me it was at 4000°C!
I did some more tests and decided I needed to calibrate the sensor. To do this, you place the sensor in the oven along with a thermometer, both on an insulated piece of material. The how-to guide suggested an egg carton, which I had.
The oven is them heated to approximately 100°C, and the resistance and temperature measured. All well and good in theory, however I was getting utterly bizarre results. As the temperate rose, the resistance fell. This is normal. However as the temperature fell, the resistance continued to fall. This is not normal. In fact, the longer I measured the resistance for, the lower the value. Normally a resister remains fairly constant, but this was changing from 100kΩ down to 4kΩ... a huge range of values.
So I scrapped that. I've never had much luck with thermistors. But I happened to have the guts of a thermocouple based PID temperature controller lying around, from a kiln I made mum. I quickly repurposed it and assembled a very crude collection of PCBs to make a new temperature controller.
It is based around a MAX6675 K type thermocouple interface IC, a very accurate IC with a completely digital interface. Digital. I can work with that.
I added in a rotary encode to adjust the target temperature, an LED to indicate what the heater element was doing, a switch to easily turn off the element (I'm learning, backup disaster-controls are now standard) and a funky blue & white LCD to indicate the temperature values.
I then spent some time working out how to make the Teacup firmware give me a boolean "on"/"off" type signal for the extruder. It turned out to be very easy; define a dummy sensor, and then define the heater as the pin to toggle.
DEFINE_TEMP_SENSOR(extruder, TT_DUMMY, AIO0 /* dummy ADC port */, 0)
DEFINE_HEATER(extruder, PB3, 0)
#define BANG_BANG_ON 255
#define BANG_BANG_OFF 0
The dummy sensor will report 0°C all the time. By disabling PID control in the Teacup code (#define BANG_BANG) and setting the on value to 100% and off value to 0%, the heater pin will always be on when we turn on the element, and always off when we don't want heating.
By reading the state of this pin in my extruder and using a simple state-machine, I can easily make it so the heating element is only on when it needs to be; when the machine is sitting idle waiting for instructions, it isn't heating. When it's ready to print, it turns on the heater.
Inside the heater I have a PID control loop which monitors the target and actual temperatures and adjusts the output to suit. I slept through most of my PID lectures with Harsha and Rick, they really were the most appallingly boring and dry topics on the face of the planet. So as a result my PID loop is quite under-damped, quickly getting up to temp but then wildly overshooting before settling back down to the correct value. As far as I can tell, my Ki value needs reducing... something to play around with.
Anyway tonight I connected everything up and did my first live tests. Apart from the PID tuning issues above, it worked! No explosions, no mysterious smoke erupting... just a 400kHz buzz as the PWM kicked in to heat the element.
I then tried to extrude some filament, which after a few tries and false starts worked quite well. A tiny little stream of plastic comes out the nozzle!
Over the last couple of days some of the replacement step-sticks have arrived, I now have 3 sticks, so I'm just one short of a 3D printer. In the meantime, more tuning and calibrating to do.
Leave a comment?