It was 2011 when I first decided to convert my desktop CNC to a 3D printer. Years past by and 3D printers become a mainstream. Makers who are coming from CNC background know that CNCs are great tools to make things. Of course, 3D printers are also nice machines for makers but what about having both? This two functionality is what we are looking for. Believe me. As I talked about a lot regarding converting your desktop CNC to a 3D printer at this blog It is great to see people all around word dual use their CNCs. Today I like to introduce you my new Extruder Controller which has great features coming from seven years of research and development as well as feedbacks from users all around the world.
I am sure you heard about PID (Proportional+Integral+Derivative). It is a very common process control routine for process control. Yes, be sure that It has many implementations from factory automation systems to drones balancing algorithms. I will not talk too much about it but if you have time please google PID and dive into details.
From Wikipedia: "A PID controller calculates an 'error' value as the difference between a measured [Input] and the desired setpoint. The controller attempts to minimize the error by adjusting [an Output]."
If you like to go deep inside about what PID is, please take a look at Brett Beauregard's introduction
In our extruder controller, the main functionality is to stabilize the extruder temperature at a set point. This is very important because the 3D printed part quality depends on smooth temperature control. In our new design, we separate the PID control functions and wifi implementation into two separate ICs. What we need is a high-speed error calculation in order to stabilize the temperature. Atmega328P IC is completely responsible for running two independent PID channels. For the wifi control tasks, we use famous ESP8266. ESP is great and can be also used standalone for this project but we read a lot and learn that there can be some delays in the PID loop while the IC is working on wifi related tasks. We do not want this and continuous PID calculations are the most important part of this project. So we decided on using two independent IC for our design.
High Level Design:
ESP has a built in web server in order to get system parameters from the user. You can use any web browser to edit and save the system parameters. In our previous models, we spent a lot of work on LCD and buttons to develop an UI. But now It is great for headless systems to have a built in web server for user interaction. ESP can be used to publish the process data logs to the cloud for you to analyze and fine tune your process.
This PID extruder controller is for people who have their own desktop CNC machine and wish to use it as a 3D printer. But this board can also be used for any other temperature related tasks like:
- Bear brewing
- BBQ temperature controller
- Coffee roaster automation
- Food dehydrator control
- Pot still control
Please contact me if you need a smart temperature controller for your different projects. We can adjust anything as needed.
In order to properly set your temperature, you have to measure it accurately. It is very important to select the right sensor. There are lots of temperature sensors and they have their pros and cons. If you like to have more info about sensors, please read our blog post about precise temperature measurement. In this design, we try to support the most popular temperature sensors. So we decided to support below sensors for our board:
- NTC Thermistor (2 inputs)
- K-type Thermocouple (1 input)
You can select any of them for your two independent PID loop. We have 2 thermistor input, one thermocouple input connections on the board. From the web interface, you can select and assign them easily.
By the way; I want to be clear here about the web server. It is running on your own board. So there is no any subscription to a cloud service needed. In order to analyze the output, we will use free thing speak cloud service. And this is optional. If you do not want to save the output to a cloud you can ignore this functionality. We also think about the people who may not have wifi in their workshop. You can still use this controller without any internet connection.
In our extruder controller design, we use two power MOSFETs capable of sourcing more than 5 amps in order to output power to our heaters.
You can always use a web browser and connect to the onboard web server in order to see what's going on about the temperature values. We also add a character LCD to the board. It can be useful if you are near your device and see the real-time temperatures.
I decided to connect the display to ESP because, as I said before Atmel needs to deal only with PID. Second reason is to be sure about the communication is carry on correctly.
Serial Communication between ICs
Separating needed tasks into different ICs bring communication issues on the table. Luckily, both ICs has serial hardware ports to communicate with each other. So it is better to use this feature. Formatting the messages is another task but we here have to give the credits to Arduino JSON-Lib. It is great and easy to use with both Arduino and ESP. We JSON formatted the message before sending.
I am very happy with the design and software implementations. We always keep in mind the makers who may want to upload their own firmware. As always you can find both the hardware and software source code in our repo. We also populated the programming headers for both ICs. You can upload your own software with an ordinary USB to Serial converter board. More to this both IC can be programmed with popular Arduino IDE. this board is maker friendly, Isn't it :)