Project

Do-It-Yourself Soldering Station with an ATmega8

May 05, 2016 by Cezar Chirila

The mighty soldering iron. If you need one, want one, or just love to build stuff, then this project is for you.

The mighty soldering iron. If you need one, want one, or just love to build stuff, then this project is for you.

What is one of the most essential tools in an electrical engineer’s kit? I’ll tell you one that you probably love and hate; the soldering iron. You don’t have to be an EE to need one, you'll need one even if you're just a tinkerer who enjoys repairing stuff around the house. 

For basic applications, a standard soldering iron that you plug into the wall does the job, but for more sensitive work like repairing and building electronic circuits, you'll need a soldering station. The temperature control is critical as to not burn the components, especially the integrated circuits. In addition, you may also need it to be powerful enough to maintain a certain temperature in case you find yourself a big ground plane that you want to solder to. 

As a student attending University far from home, I found that it was impractical to uninstall my soldering station from my workbench to bring it back and forth when I visit home. I decided that it was best to get a new one, or better yet, build a new one.

Design

As I designed the soldering station, I had a few key qualities in my mind.

  • Portability – This is achieved by using an SMPS (Switched - Mode Power Supply) instead of a regular transformer and rectifier bridge.
  • Simple design – I didn’t want any LCDs, unnecessary LEDs, or buttons. I just wanted an LED segment display to show me the set and current temperature. I also wanted a simple knob to select the temperature (potentiometer) and no pot for adjusting the accuracy since it can easily be done by software.
  • Universal – I used a standard aviator’s 5 pin plug (some type of DIN) so that it is compatible with Hakko soldering irons and its tips.

The best way to temperature control a soldering iron is, in my opinion, using a microcontroller as a PID (proportional–integral–derivative) controller. It's very likely that you've heard of PID before, for example, 3D printers use it to set the hot end temperature. The principle is not new, as it can be used for anything that requires automatic adjustment and is widely used in the industry. Even your digital thermostat at home uses this type of controller. 

How it Works

Schematic

 

First of all, let’s talk about the PID. To explain it bluntly, let’s take our particular case here with the soldering station. The system is constantly monitoring the error, which is the difference between the set point (in our case, the temperature that we want and our current temperature). It adjusts the output of the microcontroller which controls the heater via PWM based on the following formula: 

 

.

 

As we can see, there are three parameters Kp, Ki, Kd. The Kp parameter is proportional to the error at the present time. The Ki parameter accounts for errors that have accumulated over time. The Kd parameter is a prediction of future error. In our setup, we are using Brett Beauregard’s PID library for adaptive tuning which has two sets of parameters: aggressive and conservative. When the current temperature is far from the set point, the controller uses aggressive parameters, otherwise, it uses the conservative ones. This allows us to have a low heat up time while still achieving precision.

Here is the schematic. It uses an 8-bit microcontroller ATMEGA8 in DIP (you can use an ATMEGA168-328 if you have one of those laying around) which is very common and the 328 variant is found in Arduino UNO. I chose it because it's very simple to program using the Arduino IDE, which also has some good libraries that are ready to go.

The temperature is read by the thermocouple that's built into the soldering iron. We amplify the voltage generated by the thermocouple by about 120 times using an op-amp because of the thermoelectric effect. The output is connected to the ADC0 pin of the microcontroller that turns the voltage into a value between 0 and 1023.

The set point is given by the potentiometer that's used as a voltage divider. It's connected to the ADC1 pin of the ATMEGA8. The range 0-5V (pot output) is changed to 0-1023 by the ADC and again to 0-350 degrees Celsius by the function “map”. 

Bill of Materials

ReferenceValueCount
IC1ATMEGA8-P1
U1LM3581
Q1IRF540N1
R4120k1
R6;R31k2
R5;R110k2
C3;C4;C7100nF3
Y116MHz1
C1;C222pF2
R21001
U2LM78051
C5;C6100uF (can be lower)2
R7;R8;R9;R10;R11;R12;R13;R141508

Here is the bill of materials exported from the Kicad. In addition, you will need: 

  • Soldering iron Hakko clone, the most popular are on eBay and Chinese websites (with thermocouple, not thermistor) 
  • 24V 2A power supply (I recommend SMPS, but you can use a transformer with a rectifier bridge)
  • 10k potentiometer
  • Electrical aviation style plug with 5 pins
  • Panel mounted electrical connector
  • PCB
  • Power switch
  • 2.54mm pin headers
  • Lots of wires
  • Dupont connectors
  • Case (I 3D printed mine)
  • One triple LED array display
  • AVR ISP programmer (you can use your Arduino for this).

Of course, you can easily substitute the LED array with an LCD or use buttons instead of a potentiometer, after all, it’s your soldering station. I stated my design choices, but you can do it however you want it. If you need help with your code or if you are changing components, leave a comment and I will help you!

Build Instructions

 

First, you have to make the PCB. Use whichever method you prefer, I recommend toner transfer as it’s the easiest way. Also, my PCB is longer because I wanted it to be the size of the SMPS so I can put one on top of the other. Feel free to modify it, you can download the files and edit them with Kicad. After that, solder all the parts to the PCB.

Make sure to put a switch between the power supply and the power connector. Use relatively thick wires for the mains as well as the connection between the power supply and the PCB, as well as between the MOSFET output (H on PCB) and the ground wire for output. To wire the potentiometer, connect the 1st pin to 5V, the 2nd pin to POT, and the 3rd pin to the ground. All of the connections you need are on the PCB. For the LED array, take note that I used a common anode, but yours may be different. You will have to modify the code a bit, but the instructions are commented in the sketch. Connect pins E1-E3 to the common anodes/cathodes and pins a-dp to the corresponding pins on your array. You should consult the datasheet for it. Finally, mount the plug for the soldering station and solder the connections. The picture with the schematic should help you here. 

Now comes the fun part, uploading the code. You will need the PID library to do this. If you have an AVR ISP programmer, you know what you need to do. Connect the +5v, Ground and MISO, MOSI, SCK and RESET pins, download the Arduino sketch, open it (you need to have Arduino IDE installed on your computer) and click upload.

If you don’t have one, you can use your Arduino for this. Connect your Arduino (UNO/NANO) to the PC, go to file -> examples -> ArduinoISP and upload that. Then go to tools -> programmer  -> Arduino as ISP. Connect as below (PICTURE) and then download the Arduino sketch, open it and click Sketch -> Upload using Programmer.

ATTENTION! If you are using like me, an ATMEGA8 instead of the 168/328 and your Arduino version is greater than 1.6.0 you need to follow these instructions

That’s it. You can now enjoy your soldering station, built with your own skillful hands. 

 

Calibration

I lied, that’s not it. We need to calibrate it now. Since the heaters and the thermocouples inside have variations, especially if you don’t use an original Hakko soldering iron, we need to calibrate it.

First, you need a digital multimeter with a thermocouple to measure the tip temperature, although the best way to do this is to buy a tip thermometer (eBay has some fake Hakko ones that should be sufficient). After you measured the temperature, you need to adjust the default “510” value in this line in the code : map(Input, 0, 510, 25, 350) using this formula:

 

  

 

where TempRead is the temperature that appears on your digital thermometer and TempSet is the temperature that you have set on your soldering station This is just an approximate adjustment but should be sufficient, you do not need extreme precision for soldering. I used Celsius because this is what it is usually used in electronics, but you can change to Fahrenheit in the code if you would like.

3D Printed Case (optional)

I designed and printed myself a case because I can stack the SMPS and PCB to be nice and tidy. Unfortunately, for you to use this case, you would need to find the exact type of SMPS. If you do have one and want to build it or if you want to modify it to your needs, you can download the files. I printed mine at 20% infill, 0.3 layer height. You can use higher infill and smaller layer height if you have the time and patience. 

Conclusion

There are still a lot of things that can be improved, like using a specialized thermocouple IC with cold junction compensation. If you have any suggestions, want any new features, or you just have problems during your build, please leave a comment.

I’ll leave you to thoroughly read the instructions again; find your parts and build the thing. I wish you burn-free soldering!

 

SolderingStation.zip

Give this project a try for yourself! Get the BOM.

67 Comments
  • spyglass May 20, 2016

    hi
    why do you have 2 versions of the code ?

    Like. Reply
    • Cezar Chirila May 20, 2016
      Hello spyglass. Sorry for that, It is fixed now. It was actually the same code, only the second one had more comments to explain some lines better. Please tell me if you have any further questions.
      Like. Reply
  • spyglass May 20, 2016

    HI
    does lm7805 or q1 require heat sinks ?

    Like. Reply
    • Cezar Chirila May 21, 2016
      Hello They do not require a heatsink. Q1 has a low rDS on. If you want you can put a small heatsink on lm7805 especially when using a 24v power supply.
      Like. Reply
  • grahamed June 24, 2016

    Hi

    Many Hakko irons use thermistor not thermocouple

    Like. Reply
    • Cezar Chirila June 24, 2016
      Hello! In the Bill of Materials I was referring to the Hakko clone irons, not the original ones. Over the years I have bought about 5 or 6 of these, each time from diferent vendor, and all of them had thermocouple.
      Like. Reply
  • spyglass June 27, 2016

    Hi Cezar
    Do you have the code to use it 2x16 lcd display instead of 7 segment display ?

    Like. Reply
    • Cezar Chirila June 28, 2016
      I do not have the code, but it shouldn't be too hard to implement. Put this in the beggining : // include the library code: #include // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); In the void setup add this : // set up the LCD's number of columns and rows: lcd.begin(16, 2); And in the void main function change this : show(temperature); into this : lcd.setCursor(0, 1); lcd.print(temperature);
      Like. Reply
  • spyglass June 28, 2016

    Hi Cezar

    is Enable 1 the left or right digit ?

    Like. Reply
    • Cezar Chirila June 28, 2016
      I think that Enable 1 is the right digit, but I am not 100% certain. You can easily reverse the connector or just reverse it in software if it isn't right.
      Like. Reply
  • spyglass July 04, 2016

    Hi
    What is the value of the pot ?

    Like. Reply
  • micvee July 12, 2016

    Bonehead question, I’m sure, but what wattage did you use for your resistors?

    Like. Reply
    • Cezar Chirila July 13, 2016
      Hello Micvee! I think I use some 1/4 and 1/2 because it was what I had available. You are safe to use 1/4W for all if you wish.
      Like. Reply
    • Cezar Chirila July 13, 2016
      Hello Micvee! I think I use some 1/4 and 1/2 because it was what I had available. You are safe to use 1/4W for all if you wish.
      Like. Reply
  • sencer July 31, 2016

    hey. nice project. I’m currently trying to build this one. But the temperature circuit is not working with me? When I plug the thermocouple I always get a stable “0” on the analogread regardless what the temperature is. But when I unplug the value changes between 760-770. I’m using Lm358N and I’ve checked the circuit several times. Any help with that ??

    Like. Reply
    • Cezar Chirila July 31, 2016
      Hello! First, make sure your power supply connections to the Op-Amp are correct. Then make sure the thermocouple is plugged in right, it has a polarity. A picture would help a lot.
      Like. Reply
      • Cezar Chirila July 31, 2016
        Also it is ok to get a stable 0 when the temperature on the tip of the thermocouple is the same as that on the connection to the op-amp.
        Like. Reply
      • sencer July 31, 2016
        Umm. I checked again, not working. I mean the thermocouple's resistance is about 120 ohms at 250-300 C degrees.at 25 C it is about 50 ohms. Now I am testing this iron unplugged(heater). Do I have to plug the heater and then check it. But another design with the thermocouple is working. So I really need help. How can I send some photos. Thanks
        Like. Reply
    • Cezar Chirila July 31, 2016
      Unfortunately You do not have a thermocouple, but a thermistor. The thermocouple generates voltage (a few mV), a thermistor changes its resistance according to temperature. Here is a table : http://s15.postimg.org/pslo7mlmz/Hakko936_Temperature_Curve.jpg Also, look here for how to use the thermocouple : http://playground.arduino.cc/ComponentLib/Thermistor2 In the schematic, just change the resistor value (10k) with a 51 ohm one that measures as close as possible to your thermistor (resistors have tolerance).
      Like. Reply
      • sencer July 31, 2016
        Thanks. It is working better. Need few adjusting but overall good. Last thing: How did you calculated the "51ohm" resistor. Can you send the formula? Thanks.
        Like. Reply
    • Cezar Chirila July 31, 2016
      In order for that code to work "out of the box" u need to use a resistor with a value equal to that of the thermistor at room temperature, which you said it was 50ohm (confirmed by that graph). You can also make your own function using arduino map(), but this will be linear.
      Like. Reply
    • Cezar Chirila July 31, 2016
      In order for that code to work "out of the box" u need to use a resistor with a value equal to that of the thermistor at room temperature, which you said it was 50ohm (confirmed by that graph). You can also make your own function using arduino map(), but this will be linear.
      Like. Reply
  • 4759Sy August 01, 2016

    Hy
    Icanont open skema eith eagle?what the solve problem?
    Thank?

    Like. Reply
    • Cezar Chirila August 02, 2016
      Hi 475Sy! You need to use KiCAD. It is Open Source, give it a shot.
      Like. Reply
      • 4759Sy August 03, 2016
        Hy. I was download kicad .but the andruino can not komplier.this mesage .exit status 1 Error compiling for board andruino uno. Iam sory ism newbe
        Like. Reply
    • Cezar Chirila August 03, 2016
      Did you install the PID library?
      Like. Reply
      • 4759Sy August 05, 2016
        Hy.iam yesterday not yet instal pid library.it is ok now.i has instal.but i am has problem again.i use prosteus 8 and use arduino uno and i try simulation.why its 3digit not same wit temperatur thermo couple input?can7segmet replace wint lcd 16*2?thecode firm ware ? Thanks before .iam new in mikrokontroler
        Like. Reply
    • Cezar Chirila August 25, 2016
      Please check the above comments for code to use with 1602 LCD.
      Like. Reply
  • monkeysass_half August 29, 2016

    Is there a preferred or recommended method to change the code to display Fahrenheit? Instinct tells me to write the conversion into the temp loop but experience (or the lack thereof)  tells me there’s a less messy way. Any advice?

    Like. Reply
    • Cezar Chirila August 29, 2016
      I think the easiest way to do it is to change line #77 to "show(temperature * 9 / 5 + 32);".
      Like. Reply
      • Cezar Chirila August 29, 2016
        The most correct way to do this is to use Fahrenheit from the beginning, at the map function. If you use the above easy way, your will have a greater error, because it rounds twice. Once for the float to integer, second for the celsius to Fahrenheit. In the worse case scenario you loose 0.49 + 0.49 = 0.98 degree Celsius as opposed to a 0.49 Fahrenheit loss.. You should be more preoccupied with the calibration, in my opinion.
        Like. Reply
  • monkeysass_half August 29, 2016

    Thank you for your quick reply. Your tutelage proved to be reliable as far as my being able to calibrate my tip to within a few degrees Centigrade of what my Fluke 51 Digital Thermometer displays. Results that I am very happy with and are likely more accurate than I am able to measure.
    My inquiry was the first step toward my inclusion of a switch that will (hopefully) change my LED array to display either scale as well as LEDs to indicate which scale is currently in use. Not imperative by any means but, more of a “bells and whistles” feature that presents another challenge with which I hope to hone my skills even further. The extra “ooh’s” and “aah’s” from the guys at work when they see that part of it will serve as a well executed shoulder rub for my ego, as well. 😉
    My part was merely the execution and I would not benefit or enjoy taking credit for YOUR hard work on this project for which I would like to express a heart-felt “thank you” for sharing it. It is my intention to recognize you as the creator and designer to everyone I share it with.

    Like. Reply
    • Cezar Chirila August 29, 2016
      Thank you very much for your comment. I am truly happy to read comments such as yours, knowing that my article helped someone. Congratulations on the build, you deserve all the credit for YOUR hard work, my article was just an inspiration. Keep on tinkering. PS. If you have any trouble with the state of the scale feel free to comment here and I will help you. (A boolean that changes it's value on the press of a momentary switch and an if statement should do the trick)
      Like. Reply
  • milimod October 18, 2016

    Hi Cezar

    Please put the source code For software BASCOM-AVR or CodeVisionAVR.

    Like. Reply
  • superbee383 February 20, 2017

    Hello,

    In your calibration formula, what does ValueSet mean?

    Like. Reply
    • Cezar Chirila February 22, 2017
      It is the default Value set in the code, which I think it is "510". Replace this value with the newValue obtained from the formula. Sorry for late response.
      Like. Reply
      • superbee383 March 01, 2017
        Hi Cezar, I got the circuit built using an Amega328. When I rotate the Pot, it reads in the range of 150 to 350. This is correct. The problem I'm having is the temperature is reading between 500 to about 508 all the time. I checked the soldering iron to make sure it has a thermocouple and to verify that it is, I hooked it up to a thermocouple connector, then to my meter. It reads ok. Do you have any ideas what the problem is? Thank you, Kerry
        Like. Reply
  • dephazz March 15, 2017

    What are the lines of code to modify to showu common cathode please.

    Like. Reply
    • Cezar Chirila March 17, 2017
      The lines have a comment in them. Try to modify these : digitalWrite(digit_common_pins[z], HIGH); //Change to LOW for common cathode }else{ digitalWrite(digit_common_pins[z], LOW); //Change to HIGH for common cathode } AND PORTD = ~digits[digits_array[z]]; //Remove ~ for common cathode (Follow instructions from comments). Please tell me if you got it working.
      Like. Reply
  • mirceacra April 09, 2017

    Salutare si felcitari pt realizare, poti pune sau trimite un pcb in format pdf pe .(JavaScript must be enabled to view this email address)?
    Multumesc !

    Like. Reply
  • amitray November 04, 2017

    Sir Thanks a lot for this tutorial. I have a basic doubt. Suppose I want to use 24 volt 3A DC output to get 72 Watt output then what other changes I need to make in this circuit?

    Like. Reply
    • Cezar Chirila November 05, 2017
      Hello! Unfortunately increasing only the current will not work because the heating element in the soldering iron is basically just a resistor and I = V / R. If V remains 24V, the currents remain constant because the R is fixed. You have two options. 1: Use a different soldering iron, with a lower resistance, that can withstand 72W or 2: Use a higher voltage, but this may damage your soldering iron if it isn't meant to support a greater power.
      Like. Reply
      • amitray November 05, 2017
        Thanks for the reply sir. Actually I have a soldering iron of 60W. I just want to understand if I can use the laptop adapter I have which outputs 24 volt and 3A. As you said we can use 24V 2A for this project, I just want to confirm if I can use 24V 3A output(From Laptop Adapter) instead and use my soldering iron.
        Like. Reply
  • amitray November 11, 2017

    Sir,
      i dont have 100nF capacitor instead I have 4.7 uf, 47uf, 80uf, 100uf, 22pf, 10 kpf, 220pf, 470 pf , 10pf capacitors. I am a chemical engineer and have very less idea on electronics. I am sorry for asking silly questions but I need your help to build this station.

    Like. Reply
    • 100nF is very common value, usually you get ir by the name "0.1 uF", the name that appears on ceramic and polyester types is "104". You can use a lower value, is not very critical here, but an 100nF would be 'as designed' https://www.elprocus.com/wp-content/uploads/2013/01/Capacitor-Values.png
      Like. Reply
  • johngr1 March 07, 2018

    good evening from greece.i built your project and works fine except one thing.if for instance i set the temperature to 300c the display shows that the temperature starts rising(this is correct) then it shows again the temp i set and then shows some random numbers with this order 300-(the set temp) then 280,(the temp the iron is) 283,(rising correct)then appears 320 which does not make sense then again cycles and so on..i measured the tip of the iron and the temperature at the end is fairly close +-10% any ideas why is this happening?i mean the number which is above the temperature i set.

    Like. Reply
    • Cezar Chirila March 07, 2018
      One reason this might be happening is that of noise. Do you by any chance have access to an oscilloscope? Also, did you hook the thermocouple - (minus) pin close to the ground pin (22)?
      Like. Reply
      • johngr1 March 09, 2018
        thanks for your reply..unfortunately i dont have access to an osciliscope. i have 2 same soldering irons that tryied with the same result.those irons works perfectly well on a different soldering iron project. i also use an arduino pro mini for this project. which is placed on a header and then soldered on a prototype strip board.the input and output of the opamp is done with small jst connectors for easy removal or repair if needed.i noticed by measuring with a milivolt meter the pins from thermocouple while the iron heats that sometimes the readings from the meter sometimes jumping..maybe this is the reason for the problem im having but why this is not happening on the different project i have made which also uses the same opamp and output mosfet...i also tryied different lm358 and various decoupling capacitors at various points.i will try to give more grounds to arduino pro mini .....
        Like. Reply
        • Cezar Chirila March 09, 2018
          An easy fix would be instead of 1 reading, do 50 reading and average them, so instead of this line "Input = analogRead(0);" you could put something like this "Input = 0; for(int i=;i<50;i++) Input += analogRead(0); Input /= 50" and decrease the number of readings if the display starts to flicker. The strange thing is the noise that can also be seen with a multimeter. Is it also present in the other project code or just mine? Feel free to contact me if you do not understand the above code so that I can display it better. Cezar
          Like.
        • johngr1 March 09, 2018
          i dont know much about arduino programming but i replaced the line you told me “Input = analogRead(0);” with this “Input = 0; for(int i=;i<50;i++) Input += analogRead(0); Input /= 50” and now i get an error stray/342 in program. maybe i dont understand how to modifie the code .thanks again for the reply.you are very kind..
          Like.
        • Cezar Chirila March 09, 2018
          Try this https://pastebin.com/Sigz0zP3 . That code was just a guideline, this shoudl work (0 was missing in "i=0" and a semicolon at the end of the line.
          Like.
        • johngr1 March 09, 2018
          the code compiled.the display is now flikering but the problem remains..
          Like.
        • Cezar Chirila March 09, 2018
          Can you please tell me if the voltage on the thermocouple is fluctuating with both my code and the other project? Or is it just my code?
          Like.
        • johngr1 March 09, 2018
          i just unscrewed the connector of the iron from the other project which im currently using many months now the milivolt reading on the pins of thermocouple while it has reach the desired temperature is rock solid. 14,38mv - 14,39mv this is the only variation i can measure it could be from the contact leads of the multimeter..
          Like.
  • Phạm Hoàng Long March 21, 2018

    I suggest using Arduino onboard temp. sensor ( calibrated to room temperature) to do “cold-junction compensation” because thermocouple voltage is a linear function of the difference between hot and cold junction temperature.

    Like. Reply
  • Budi Saif August 04, 2018

    hi cezar
    can you please hare a photo of your already working pcb i have a couple of questions about the placement of the other tow pins of the pot and the power input your pcb file doesnt clarify that
    thanks in advance.

    Like. Reply
    • Budi Saif August 04, 2018
      i found the pot pic but where does themp- go and +24 on the pcb
      Like. Reply
      • Cezar Chirila August 05, 2018
        You should follow the silkscreen, but here is a quick picture. It looks kinda bad as I had to rush it. If you do not understand please let me know and I'll draw a better one. https://imgur.com/a/XXsR1ZX
        Like. Reply
        • Budi Saif August 05, 2018
          tnx cezar for taking the time to answer me from what i understand i temp- connect with the 100nf cap directly and the iron's +24 and gnd connect directly with the main ??!!
          Like.
      • Cezar Chirila August 05, 2018
        You need to connect temp- to GND, which is very near to the 100nF capacitor which is also connected to ground. The iron's heater +24V is connected to the Power Supply, and the iron's heater Ground is connected to the H pin on the PCB, which is near the MOSFET transistor. If you send me a picture with your iron and your PCB I can make you a diagram.
        Like. Reply
  • mouskichab February 25, 2019

    Hi Cezar,

    Congratulations for this nice project!!
    I was wondering if you had the .hex file for this project, cause I don’t have an arduino.

    Thank you!

    Like. Reply
  • Timmsy June 26, 2019

    What part of the code do I need to change for an OLED I2C display to show the set temp and the current temp?

    Like. Reply
  • profharris July 12, 2019

    The CODE download link returns a page not found error message ~ Where can I find the CODE? .(JavaScript must be enabled to view this email address)

    Like. Reply
  • profharris July 12, 2019

    I came back, tried it again, and now the .zip file downloaded -Thank You.

    Like. Reply