Sunday, June 26, 2016

3D Printer - The Temperature Controller

Before I say anything about converting my gantry CNC milling machine to do 3D printing, I figured I'd cover the controller I designed and built for the extruder and heated bed. Unlike most purpose built 3D printers, like one built from user-sourced parts, a kit, or even a pre-built unit, a CNC milling machine doesn't provide for controlling the temperature of the extruder nozzle and the heated build bed. This project describe that part of the conversion process.

My gantry CNC mill is somewhat large. At about 2' x 4' (600mm x 1200mm) with approximately 5" (130mm) of vertical depth, it takes up a large portion of my modest work room. Because of that, I knew I wanted a larger build surface than the common 200mm x 200mm of many existing printer designs. I settled on the largest one I could find, 8.4" x 12.6".

The larger heat bed presented a problem. It required a large amount of current, approximately 18 amps at 12 volts. Most of the off-the-shelf controllers are designed for more modest sized heated beds and I was concerned that it would quickly be overloaded and possibly burn out. Yes, I could have used the smaller MOSFET on an existing controller to switch a larger MOSFET, but where's the fun in that? So, I spent some time reviewing various controller designs and then came up with my own.
Even though the LCD component says it's a 16x2 display, I'm actually using a 16x4 display. The pinout is identical. Because I knew I needed to switch up to 18 amps of current, I settled on these MOSFETs. 60V/30A should give me enough room to spare.

This is actually the third-revision of the design. I'd built one version and then wanted to add a pin header to control a cooling fan for the MOSFETs (they were getting rather warm even with a heaksink), and a serial port to allow for control via the LinuxCNC machine. I could then add custom "M" codes within the GCode file that call scripts to turn on/off the nozzle and bed heaters.

Here is what the first one I built looks like. I never built revision one; this is revision two. Notice the extra hacked in components and headers for fan control and serial port.

I designed the board and software to accept both thermistor input and thermocouple input via a couple of daughter boards I'd already built. The row of switches are for selecting menu items and programming the controller. A simple arrangement of up/down/select buttons is all that is needed. Additionally, all functions are available via the serial port using simple ASCII commands.

As with most of the printed circuit boards I design, I try and put as many of the traces on the top layer. This makes it easier to build using a single-sided copper-clad board with a minimum number of manually installed jump wires on the underside. Of course, that doesn't preclude one having the board professionally manufactured.

The two female headers are for the thermocouple daughter board. Here's what one looks like:
The schematic for this is based directly on the reference design provided by Maxim Semiconductor. I was able to sample two MAX31855KASA devices at no cost. I did purchase several more for my reflow oven project.

K-type thermocouples are rather inexpensive on eBay as many ship directly from China, if you're willing to wait a couple of weeks. I got the ones with the connector pre-installed with the exposed junction on the other end. The junction was going to be electrically insulated anyway so there was no need to get them pre-insulated.

Here's the current revision installed on the Y-Axis of the gantry. The large black wire provides the high-current 12V supply from a 12V 30A power supply.


Even though I beefed up the high-current traces for the the heaters, I added some extra thick wire jumpers to reduce voltage drop. The fan is mounted above the MOSFETs. The MOSFET for bed heater has an added heatsink I made using some thin aluminum. The fan is a normal 4 pin PC chassis fan whose speed can be controlled with a PWM signal. The controller will idle the fan at 25% when not actually heating things. It will be kicked to 100% while the heaters are on and will run at 100% for up to 4 minutes after the heaters are turned off. It then drops back to 25%.


Yes, the extruder nozzle filament driver is itself 3D printed. I'll explain how I was able to bootstrap that part of the 3D printer project in a later installment.

The software I wrote for this contraption is available here. For serial port control, you'll need to get a USB serial to TTL board or cable. There are many available on eBay, Sparkfun, and other places. Be careful, there are many "fake" chips out there that mimic other commercial chips such as the PL2303 or the FTDI chips. Sometimes the latest official drivers won't work these counterfeit devices. I know first hand as the PL2303 based USB cables I got don't work with the latest drivers.

Here's a screenshot of LinuxCNC with a gcode file loaded for a couple of extruder gears. The view in the upper right is the app that links to the controller. It shows the set temperatures and the current temp. It updates every second.

The software is the easiest part. In order to maximize available RAM, most of the string constants were pushed into the program flash memory. I could have spent more effort making it even more OOP-like, but that does add some extra overhead and I was trying to be as space-efficient as possible.

No comments:

Post a Comment

Please keep your comments related to the post on which you are commenting. No spam, personal attacks, or general nastiness. I will be watching and will delete comments I find irrelevant, offensive and unnecessary.