What’s up my friends, welcome back. Since I’ve reviewed the TS100 soldering iron, I’ve been working on my own portable soldering iron. So, I’ve made some tests, some research, create the PCB and finally made this project. We need a heating element to heat the iron of course. But we also need a thermocouple to read the real temperature value and then create the PID control.
by: ELECTRONOOBS on 2026-08-04
But using the thermocouple is not that easy, so we also need a thermocouple amplifier IC. I’ve used the MAX66 75, so I’ve bought the SMD IC so I could place it on my own PCB. This IC has a SPI port so I could communicate with it.
1 x 24V soldering iron LINK eBay
1 x ATMega328p-AU LINK eBay
1 x 16MHz crystal: LINK eBay
1 x i2c OLED display: LINK eBay
1 x IRF540NSTRLPBF MOSFET: LINK eBay
1 x MAX6675 IC: LINK eBay
1 x buck converter: LINK eBay
1 x J8 plug: LINK eBay
2 x SMD push buttons: LINK eBay
2 x M7 diode: LINK eBay
2 x 0805 1k resistor: LINK eBay
1 x 0805 100R resistor: LINK eBay
2 x 0805 10k resistor: LINK eBay
2 x 0805 22pF capacitor: LINK eBay
4 x 0805 100nF capacitor: LINK eBay
1 x A3144 hall sensor: LINK eBay
Wires LINK eBay
Wire, soldering iron, solder, etc...

Before we build the entire PCB, let's see how to measure the real temperature. For that we need a thermocouple, the MAX6675 IC and the Arduino. Make the connections below. Be careful, the thermocouple has polarity so positive to positive and negative to negative. Onde you have made the connections, you have to open Arduino IDE:

Now, open the next example code and make sure you install the MAX6675 library. You can alos dwonload the library from below and install it. For that go to sketch, include library, add .ZIP library and open the downlaoded .zip file. You could also use the library manager and search for MAX6675.
Ok, copy the code below and compile.
#include "max6675.h" //INCLUDE THE LIBRARY
int thermoDO = 9;
int thermoCS = 8;
int thermoCLK = 13;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
void setup() {
Serial.begin(9600);
Serial.println("MAX6675 test");
// wait for MAX chip to stabilize
delay(500);
}
void loop() {
// basic readout test, just print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
delay(1000);
}
Now, copy the code below and compile in Arduino IDE. If no errors, upload the code to the Arduino using the schematic above and then open serial monitor and set the speed at 9600 baud. Each half second you should have the real temperature printed in both C and F. Heat the thermocouple and see for yourself. The thermocouple has to be a k-type for this example!
We know how to read the real temperature and we know the parts that the iron needs. With all the components I've made the schematic below. We can see the ATMega328p-AU microcontroller connected to different other components. We haev the MAX6675 thermocouple read IC with SPI communication to the microcontroller. Also, main input plug with the reverse voltage diode, the MOSFET to control the power applied to the heater, push buttons with pulldown resistors, some pins for the UART port and OLED display i2c communication. We also have a hall sensor but that was not used in this tutorial. Finally, there are 4 pins for the heater output and thermocouple input.

Once the schematic was made and I was sure that everything is OK, I've created the layout of the board with a size of 100mm width by 17mm height. I've placed the components as you can see in the layout below with a board of two layers. The uC is on the top layer and the MOSFET on the bottom layer. Alos, on the right, we can see the input of 24V and output of 5V from the buck converter.

Now, that I have the layout, I copper fill the board and create the GERBERS and send those to JLCPCB and manufacture 10 boards. You can download the GERBER files from the link below and order your own boards.

First thing first, let's mount the bare minimum configuration of the ATMega chip. Below we have the schematic for that. This is the configuration for this chip in order to work. It needs a 5V supply, the crystal of 16MHz and two capacitors of exactly 22pF and a 10K pullup resistor connected to reset pin.

Now, I solder these elements on my PCB. The chip, the crystal, two 22pF capacitors and the 10k pullup resistor and then connect an FTDI module like the one in the photo below to the UART port on the PCB. With these 4 elements we can check if the chip works.

Connect the FTDI to your PC and upload any serial communication test. For example, a code with a Serial.println("HI"); . Open serial monitor and test if it works. If yes, we are good to go.
This part is just in case your chip doesn't have a bootloader. I recommend you to buy one with bootloader or, if not, desolder the chip from an Arduino NANO with a hot air gun and in this way you make sure it will work. Besside, the Arduino NANO has the same price as the chip by itself.
To burn the bootlaoder make the next connections between the baord and an Arduino NANO, SPI connection.

Now, let's solder all the parts but the buck converter. Once all the parts are soldered, the OLED screen, the MOSFET, the MAX6675 IC, all the resistors and capacitors and the input plug, here is what you have to do.

Now, take the buck converter and supply 12V to 24V to it and rotate the potentiometer till you get around 5 or 5.1V at the output. Now, place hot glue on the potentiometer so we make sure it won't move by mistake and bur our microcontroller and the entire board.

Now we have the 5V. We can solder the buck converter to the board and next step is to solder the heater and the thermocouple to the H and T pins. For that, first we have to know which are the positive and negative pins of the thermocouple.

Open the commercial soldering iron. As we can see below, it has 5 wires. 2 for the heater, 2 for thermocouple and 1 is earth. The heater doesn't matter, it has no polarity. But the thermocouple has polarity so we have to find that. Solder wires to the thermocouple and connect those to a k-type thermometer. If you get a good read, well, now you now the polarity.

Now, solder the heater and thermocouple to the PCB and we can jump to the code part. The heater is marked with H+ and H- and the thermocouple with T- and T+ on the PCB. Don't worry about the heater polarity, but be careful witht the thermocouple.

Below you have the code that has to be uploaded. Connec the FTDI module to the UART ports and uplaod the next code. Make sure, you ahev the MAX6675 and OLEd libraries installed as we haev seen before. The code is easy. Read all the comments in the code to understand more and also look at my PID temperature controller video. The idea goes like this. We start in sleep mode. We press any of the buttons and get out the sleep mode and then create a PID code. In another loop we read the temperature using SPI communication, calculate the error and finally get the PID value. Next, we write a PWM signal to the MOSFET connected on pin D3. And that’s it. There are other small "ifs" in the code that will increase or decrease the set temperature value or start the sleep mode.
/* ELECTRONOOBS portable soldering iron version 1.0
* Tutorial: http://www.electronoobs.com/eng_arduino_tut32.php
* Read all the comments in this code!
*/
#include "max6675.h" //http://www.ELECTRONOOBS.com/eng_arduino_max6675.php
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h> //http://www.ELECTRONOOBS.com/eng_arduino_Adafruit_GFX.php
#include <Adafruit_SSD1306.h> //http://www.ELECTRONOOBS.com/eng_arduino_Adafruit_SSD1306.php
///////////////
//OLED setup
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 5
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
///////////////
//EN logo
static const unsigned char PROGMEM logo_EN[] =
{
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B00011110, B00011111, B00111111, B11001111, B11110011, B10000001, B11100000, B01111111, B10011111, B11000111, B00111100, B11001111, B11110000,
B00110011, B11111111, B11000000, B01111110, B00011111, B00111111, B11001111, B11110011, B10000001, B11110000, B01111111, B10011000, B01100111, B00111100, B11001100, B11110000,
B00110001, B11111111, B11000000, B11111110, B00011111, B00110000, B00001100, B00110011, B10000001, B10111000, B01110000, B00011000, B01100111, B00111100, B11001100, B00000000,
B00110011, B11111111, B11000000, B11111110, B00010001, B00110000, B00001100, B00110011, B10000001, B10011100, B01110000, B00011000, B11000111, B00110010, B11001100, B00000000,
B00111111, B11111111, B00000000, B11111110, B00010001, B00111111, B11001100, B00110011, B10000001, B10001110, B01111111, B10011111, B00000111, B00110010, B11001100, B00000000,
B00111111, B00000000, B00000000, B11111110, B00011001, B00111111, B11001100, B00110011, B10000001, B10001110, B01111111, B10011011, B00000111, B00110001, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00000000, B11001100, B00110011, B00000001, B10011100, B01110000, B00011011, B10000111, B00110001, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00000000, B11001100, B00110011, B10000001, B10110000, B01110000, B00011001, B11000111, B00110001, B11001100, B00110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00111111, B11001111, B11110011, B11111001, B11110000, B01111111, B10011000, B11000111, B00110000, B11001100, B11110000,
B00111111, B00000000, B00000000, B11111011, B00011111, B00111111, B11001111, B11110011, B11111001, B11100000, B01111111, B10011000, B01100111, B00110000, B11001111, B11110000,
B00111111, B11111111, B00000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B11000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B10011111, B11000000, B11111011, B00011111, B00000000, B00000000, B00000000, B00011100, B11111111, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B10011111, B11000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111111, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B11000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11000011, B00110000, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11000011, B00110000, B11001111, B10110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11001110, B00110000, B11001111, B10110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B11111000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111000, B00110000, B11001111, B01110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10001000, B11011111, B00000000, B00000000, B00000000, B00011100, B11111000, B00110000, B11001111, B01110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10001000, B00011111, B00000000, B00000000, B00000000, B00011100, B11001100, B00110000, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B00000000, B00000000, B10011000, B01111111, B00000000, B00000000, B00000000, B00011100, B11000110, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00011100, B11000011, B00111111, B11001111, B00110000, B00000000, B00000000, B00000000,
B00110011, B10000011, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00100011, B10000011, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00001111, B11000111, B11000000, B11111000, B01111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00111111, B11111111, B00000000, B11111000, B00011111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
};
//Sleep mode icon pressed
static const unsigned char PROGMEM press_logo[] =
{
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11100011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B11000010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B01100010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B00110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11000000, B11000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B01100001, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00001100, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111110, B00000000, B00000000, B00000000, B00000000, B00011111, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B00000111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
};
//Sleep mode icon unpressed
static const unsigned char PROGMEM no_press_logo[] =
{
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10001001, B00010010, B00000100, B00001000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B11111001, B11100011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B11000010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B11000000, B11000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B01100010, B00000000, B01000000, B10000000, B00000000, B00000000, B00000000, B00000000, B01100001, B10000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B10000001, B00110011, B11100111, B11001111, B10000000, B00000000, B00000000, B00000000, B00000000, B00111111, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00001100, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00111110, B00000000, B00000000, B00000000, B00000000, B00011111, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B00000111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111,
B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B11100000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11111111, B11100000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000
};
// Inputs and outputs
int butL = 4; //left button
int butR = 7; //right button
int ktcSO = 9; //SPI pins for MAX6675 sensor
int ktcCS = 8;
int ktcCLK = 13;
int mosfet = 3; //MOSFET pwm pin
MAX6675 ktc(ktcCLK, ktcCS, ktcSO);
//Variables
float temperature_read = 0;
int logo_slide =128;
unsigned long previousMillis = 0;
float Delay=300;
int sleeplogo_count = 0;
bool sleepmode = true;
bool temp_change = false;
int sleep_out_count = 0;
float set_value = 250;
int temp_change_count = 0;
float min_temp = 200;
float max_temp = 480;
int both_pressed_count = 0;
//PID values
float P_pid = 0;
float I_pid = 0;
float D_pid = 0;
/////////////////////////////////
float kp = 18.8;
float ki = 0.02;
float kd = 1.4;
//////////////////////////////////
float kp_init = 18.8;
float ki_init = 0.02;
float kd_init = 1.2;
//////////////////////////////////
float kp_fine= 8.8;
float ki_fine = 0.42;
float kd_fine = 4.1;
//////////////////////////////////
float error = 0;
float error_percent = 0;
float previous_error = 0;
float PID_value = 0;
void setup() {
Serial.begin(9600);
pinMode(mosfet,OUTPUT);
digitalWrite(mosfet,LOW);
pinMode(butL,INPUT);
pinMode(butR,INPUT);//Begin the display i2c omunication
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
delay(200);
display.clearDisplay();
while(logo_slide >= 0)
{
display.clearDisplay();
display.drawBitmap(logo_slide, 0, logo_EN, 128, 32, 1);
display.display();
logo_slide = logo_slide-2;
delayMicroseconds(700);
}
display.drawBitmap(0, 0, logo_EN, 128, 32, 1);
display.display();
delay(500);
display.clearDisplay();
display.drawBitmap(0, 0, no_press_logo, 128, 32, 1);
display.display();
}
void loop() {
//Get out of sleepmode
if((digitalRead(butL) || digitalRead(butR)) && sleepmode)
{
if(sleep_out_count > 1300)
{
sleepmode = false;
sleep_out_count = 0;
delay(100);
}
sleep_out_count = sleep_out_count + 1;
}//end of dig read of buttons and SLEEPMODE activated
if(digitalRead(butR) && !digitalRead(butL))
{
if(sleep_out_count > 6500)
{
temp_change = true;
digitalWrite(mosfet,LOW);
sleep_out_count = 0;
set_value = set_value + 10;
if (set_value > max_temp)
{
set_value = max_temp;
}
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(10,4);
display.print(set_value);
display.display();
}
sleep_out_count = sleep_out_count + 1;
}//increase temp
if(digitalRead(butL) && !digitalRead(butR))
{
if(sleep_out_count > 6500)
{
temp_change = true;
digitalWrite(mosfet,LOW);
sleep_out_count = 0;
set_value = set_value - 10;
if (set_value < min_temp)
{
set_value = min_temp;
}
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(10,4);
display.print(set_value);
display.display();
}
sleep_out_count = sleep_out_count + 1;
}//decrease temp
if(!digitalRead(butL) && !digitalRead(butR) && temp_change)
{
if(temp_change_count > 28000)
{
temp_change = false;
temp_change_count = 0;
}
temp_change_count = temp_change_count + 1;
}
if(digitalRead(butL) && digitalRead(butR) && !sleepmode)
{
if(both_pressed_count > 30000)
{
sleepmode=true;
digitalWrite(mosfet,LOW);
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(20,4);
display.print("SLEEP");
display.display();
delay(2000);
both_pressed_count=0;
}
both_pressed_count = both_pressed_count +1;
}
if(sleepmode)
{
if(sleeplogo_count > 3000 && sleeplogo_count < 3005)
{
display.clearDisplay();
display.drawBitmap(0, 0, press_logo, 128, 32, 1);
display.display();
}
if(sleeplogo_count > 6000 && sleeplogo_count < 6005)
{
display.clearDisplay();
display.drawBitmap(0, 0, no_press_logo, 128, 32, 1);
display.display();
sleeplogo_count = 0;
}
sleeplogo_count = sleeplogo_count + 1;
}//end sleepmode
//Start PID code
unsigned long currentMillis = millis();
if( (currentMillis - previousMillis >= Delay) && (!sleepmode && !temp_change)){
previousMillis += Delay;
if(!sleepmode)
{
temperature_read = (ktc.readCelsius());
error = set_value - temperature_read + 3;
error_percent = (error/set_value)*100.0;
P_pid = kp * error;
I_pid = I_pid + (ki * error);
D_pid = kd*((error - previous_error)/(Delay/1000));
PID_value = P_pid + I_pid + D_pid;
if(PID_value > 255)
{
PID_value = 255;
}
if(PID_value < 1)
{
PID_value = 1;
}
/*
if(error_percent > 20)
{
analogWrite(mosfet,250);
}
*/
analogWrite(mosfet,PID_value);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Set: ");
display.setCursor(60,0);
display.print(set_value,1);
display.setCursor(0,18);
display.print("Temp: ");
display.setCursor(60,18);
display.print(temperature_read- 5,1);
display.display(); //This functions will display the data
previous_error = error;
}
}//end current milis
}//end void loop
Once uplaoded, test if it works. Connect 12 to 24V to the DC plug. It will start with the logo, then in sleep mode. press any button and change the temperature. It can reach up to 480 degrees. If it works, is time to add the plastic case.
For the case, I first shorten the stock wires and soldered the heater to my PCB. Next, I first cut the plastic case of the other iron that I’ve bought. I then designed and 3D printed a case for the electronics. The case is made out of two parts and 2 buttons. I use this plastic part from the commercial iron because is more heat resistant and already has the part where I can screw the tip.
I pass the wires through this plastic part and solder them on to my PCB. I remove the UART cables since the Iron is already programmed and test it once again with voltages from 12 to 24 volts. I get the 3D printed case. I fit the PCB inside, the size is peret. When I’m sure everything is ok, I use a bit of hot glue. I add the small plastic buttons and close the top part. And there you have it.

Glue the case and the project is done. Now, connect the power and use the buttons and test if it can solder well. Let’s talk a bit about it and future improvements. First of all, with a battery of 14V I couldn’t reach the maximum temperature. But with 24V It had no problems. Other disadvantage is the bad quality of the iron metal tips because it is very cheap. The heater gets quite hot but the heat is not well transferred and you end up with a bad iron.

I think I’ll make more research and test with the TS100 tip because it is a very high quality one and work’s very well. Also, next version will have a hall sensor and a magnet on the stand so I could implement auto sleep mode in the firmware. There you have it my friends. You have all the files in this tutorial.
If you consider helping my projects, here is my PATREON page, THANK YOU!
Leave a comment
Please login in order to comment.