Projects

Handling the Heat

USB Soldering Station with Adjustable Power

Johann Wyss

Issue 16, October 2018

This article includes additional downloadable resources.
Please log in to access.

Log in

A standard USB Soldering Iron can be very handy, but they lack any circuitry to control the temperature. Here’s a simple solution to adjust the power to the tip in order to avoid overheating your components.

Build time: 6 hours
Difficulty rating: Intermediate

Portable soldering irons are becoming more popular among electrical/electronic students and hobbyists alike. Seemingly this is due to their low cost, easy to carry in a bag or toolbox, and ability to solder away from mains power. When I noticed that Jaycar had a portable USB powered soldering iron for under 20 bucks I knew I had to give it a look.

The Broad Overview

I was pleasantly surprised at just how useable Jaycar’s little USB soldering iron was. Like the package claimed it gets to temperature very quickly (13 seconds or so). Obviously, for its size, it does not have a huge amount of thermal capacity meaning it isn’t great for soldering thick wires together or soldering larger components with big ground planes etc. But it is perfectly suited for what most students or hobbyists would need it for.

With that said, it does have a few things which could be done better. For example, the stand leaves me with little confidence, and there is no way for the user to adjust the power to the iron. The iron only has two states, cold or hot, and its hot is very hot! My iron got to almost 500 degrees Celsius, which is a little too hot for my liking because it could potentially damage components. This is something I wanted to address, along with making a 3D printable enclosure and stand.

How it works

I decided the best way to get more functionality from the soldering iron was to give the user the ability to control the power and therefore the temperature of the device. This way the user can, if needed, reduce the temperature of the iron when soldering more sensitive components like integrated circuits.

To do this I opted to use pulse width modulation. PWM, as it is affectionately known, is a common way in electronics to control many circuits, from the speed of a DC motor to the brightness of an LED. There are a bunch of ways to produce this signal, including 555 timers and microcontrollers.

PWM works by using a high frequency pulsating DC square wave and changing the length of time the signal is high or low over a specific frequency. This ratio between high and low is called the duty cycle and is measured in percentage. To explain in further detail, let’s imagine we have a 5-volt peak-to-peak pulsating square wave with a 50% duty cycle. That means the signal is at 5 volts for 50% of the time and 0 volts the remaining 50%. If we were to average that we would get an average voltage of 2.5 volts delivered to our load.

avg = source voltage × duty cycle = 5V× 0.5 = 2.5V

Likewise, if we had an 80% duty cycle our average voltage delivered to our load would be 4V.

avg = source voltage × duty cycle = 5V × 0.8 = 4V

I measured the resistance of the soldering iron tip to be 3.8Ω, therefore considering an 80% duty cycle, the current to the load would be around 1 amp.

I = V/R = 4/3.8 = 1.05A

Note: After buying a second and third USB iron I realised that the tips are not all equal resistances, therefore, you need to adjust the math to suit your tips resistance.

This current is way too high for a 555 timer or microcontroller to produce, so we need to incorporate a circuit, which can be controlled by the PWM producing circuit, but deliver the required higher current.

For this, I opted to use an NPN Metal Oxide Semiconductor Field Effect Transistor (MOSFET).

MOSFET are voltage driven devices that allow a very small voltage and current to control a much higher voltage and current. When a voltage is applied to the gate of the MOSFET it allows current to flow from the drain to the source. Likewise, when the gate is pulled low the MOSFET current path from drain to source becomes open circuit and thus no current can flow. This allows us to use the PWM signal connected to the gate of the transistor to control the voltage and therefore the power to the load.

With the hard part out of the way I needed to figure out the user interface, and a way to adjust the duty cycle. My original thought was to use a potentiometer and a 555 timer as it is very inexpensive and easy to use. However, it began to get more complex once I started trying to devise a way to display the current duty cycle percentage. Whilst I could use a low pass filter and a resistor ladder as an analog to digital converter, along with an opamp to power LEDs, it seems a little unnecessarily complex given the low cost of microcontrollers. On top of that, whilst it would work, it would only provide a very rough idea of the power output. As such, I opted to use a microcontroller and an LCD to produce and display the duty cycle, and a potentiometer to allow the user to set the desired level.

So in summary, the user chooses the duty cycle by turning a potentiometer on the main unit. This creates a voltage divider which is connected to the analog pin of the microcontroller. The microcontroller is programmed to read this analog voltage and map it to a PWM signal, with 5V being 100% duty cycle and 0V being 0% duty cycle. It then displays the PWM percentage on an LCD. This PWM signal is then connected to the gate of the MOSFET to which our soldering iron is connected, allowing the current to flow from the resistive element of our soldering iron tip to ground, when the gate pin is pulled high.

build
Johann's early prototype used a Nano to make programming easier.

The Fundamental Build:

The Prototype

Parts Required:JaycarAltronicsCore Electronics
1 × 830 Tie Point BreadboardPB8815P1009ACE00304
1 × ATmega328P MCU with 16MHz Crystal & 2 × 22pF Ceramic CapacitorsZZ8727Z5126ATMEGA328+UNO+CAPS
1 × 16MHz Crystal if not included with ATmega328PRQ5296V1289ACOM-00536
1 × LM2936-3.3 Voltage RegulatorZV1650Z1025ADA2166
2 × 22pf Ceramic Capacitors if not included with ATmega328P*RC5316R2814CE05189
1 × Nokia 5110 LCDXC4616Z6348LCD-10168
1 × IRF1405 N-Channel MOSFETZT2468Z1537COM-10213
2 × 10nF Monolythic CapacitorsRG5125R2736BCOM-08375
2 × 100uF Electrolytic CapacitorRE6130R4825CE05258
1 × 1k 1/4W Resistor*RR0572R7558PRT-14492
5 × 10k 1/4W Resistors*RR0596R7582PRT-14491
1 × 3.9 Ohm 10W Wire Wound ResistorRR3347R0418-
1 × 50k Ohm TrimpotRT4364R2482B-
1 × USB Type A PCB Mount SocketPS0916P1300APRT-09011
1 × USB Type B PCB Mount SocketPS0920P1304APRT-00139
Breadboard Jumper Wires

Parts Required:

1 × 830 Tie Point BreadboardPB8815
1 × ATmega328P MCU with 16MHz Crystal & 2 × 22pF Ceramic CapacitorsZZ8727
1 × 16MHz Crystal if not included with ATmega328PRQ5296
1 × LM2936-3.3 Voltage RegulatorZV1650
2 × 22pf Ceramic Capacitors if not included with ATmega328P*RC5316
1 × Nokia 5110 LCDXC4616
1 × IRF1405 N-Channel MOSFETZT2468
2 × 10nF Monolythic CapacitorsRG5125
2 × 100uF Electrolytic CapacitorRE6130
1 × 1k 1/4W Resistor*RR0572
5 × 10k 1/4W Resistors*RR0596
1 × 3.9 Ohm 10W Wire Wound ResistorRR3347
1 × 50k Ohm TrimpotRT4364
1 × USB Type A PCB Mount SocketPS0916
1 × USB Type B PCB Mount SocketPS0920

* Quantity shown, may be sold in packs. You’ll also need a breadboard and prototyping hardware.

Before building a final build with PCB and 3D printed case I decided to make a prototype on a breadboard. I have included the Fritzing diagram if you would like to create your own prototype. You can choose to skip this prototype and go to the main build, but be sure to read the following details about the electronics and how to choose a MOSFET.

BUILDING THE PROTOTYPE

If you want to build the prototype you can follow the Fritzing diagram below.

fritzing

Electronics

I opted to use the Arduino Nano for the prototype as it fits nicely into a prototyping breadboard, and is easily programmed by connecting a USB cable directly to it. I built the prototype substituting the soldering iron with a 3.9Ω 10W resistive load as I didn’t have a way to connect a USB to the breadboard at the time. Given that the soldering iron at its core consists of little more than a low-value resistor the comparison was quite fitting. When prototyping on the breadboard I had to add several ground wires, it seems the little jumper wires can have a high resistance (plus the breadboard) and as such can reduce significantly the power delivered to the load.

Note: You will notice that I have used an ATmega328P in the supplied Fritzing. My original prototype used a Nano so I could regularly change the code, but you won't need to. However, if you wish to modify the code I highly recommend replacing the ATmega with the Arduino Nano as it is significantly easier to program.

Choosing the right MOSFET

Most electronics retailers sell MOSFETs, however, it’s common to find that whilst one retailer sells one MOSFET another does not stock the same one. Therefore, it’s important to be able to read a datasheet and find a substitute MOSFET just in case your retailer does not sell the device you’re searching for.

For this device it is crucial that the MOSFET is a logic level device, that is to say, the MOSFET can be controlled by a logic level voltage i.e. 5 volts.

Some MOSFETs require the voltage applied to the gate to be significantly higher than logic level. These MOSFETs are obviously not suitable for this project as our microcontroller can only produce a 5 volt signal. Therefore, the first thing we need to check is what is referred to in the datasheet as insert VGS(th) referring to the Gate Threshold Voltage.

For this example, I will use the IRF540N from International Rectifier sold at Jaycar. Its datasheet shows that the VGS(th) has a minimum of 2V and a maximum of 4V, all within the logic level of 5V.

After confirming that your MOSFET is logic level, you then want to look in the datasheet for the value that refers to the resistance between the drain and source when the gate is saturated / on.

Again, in this example, the datasheet for the IRF540N shows that RDS(on) is only 44mΩ, which is perfect for this application. You want to keep the value of as small as possible. Any resistance here equates to less voltage at the soldering iron tip, which correlates to less heating power at the tip, and higher power dissipation at the MOSFET junction. For this project, I would recommend keeping RDS(on) below 100mΩ.

After confirming that your chosen MOSFET is logic level, and has the lowest possible RDS(on) from what is available, we next need to ensure it can comfortably dissipate the power demands of the project.

soldering

Firstly, we need to calculate the approximate power demand. We know the maximum current draw will be a maximum of 2A, and we have the resistance of the MOSFET as RDS(on) 44mΩ, therefore we can calculate the power draw of the circuit.

Power = V × I == (I × R) × I == I2 × R

∴ Power = RDS(on) × Max current

∴ Power = 0.044Ω x 22 = 176mW

176mW is tiny for a project like this, however, it is still important to verify that the device is capable of dissipating this power. For that, we need to go back to the datasheet and find the value of which refers to the junction to ambient thermal resistance coefficient (R∅JA). In our case, the IRF540N has a 62˚C per Watt thermal resistance. This means we can expect our MOSFET junction to increase in temperature by 62˚C for every Watt of power dissipated.

Now, we need to go back to the datasheet and find the Maximum Junction Temperature the MOSFET can handle, which is called Operating Junction Temperature Range (TJ). In our case, the IRF540N is 175˚C.

Finally, we need to calculate if the MOSFET is capable of operating at this power dissipation without a heatsink. Since our circuit is only dissipating 176mW we are clearly within the operating range of this MOSFET without needing a heatsink.

PD = ((TJ) - Ambient)/R∅JA == (175 -25)/62 == 2.42W

If you follow the steps above, you can check your local distributors stock and check if the MOSFET’s they sell are suitable for this task while at the same time practice a valuable skill in electrical engineering.

soldering pcb

The Main Build:

Complete Soldering Station

Here I will walk you through how I made the final build with 3D printed case.

Parts Required:JaycarAltronicsCore Electronics
1 × 50mm × 70mm PCB ProtoboardHP9550^-FIT0099^
1 × 8W USB Soldering ironTS1532--
1 × 50k Linear Single Gang 9mm PotentiometerRP8516R2227ADA1831
1 × Knob to suitHK7705H6020ADA2048
1 × Male Pin Header StripHM3211P5430FIT0084
1 × Female Pin Header StripHM3230P5390PRT-00115
Hook-up Wire

Parts Required:

1 × 50mm × 70mm PCB ProtoboardHP9550^
1 × 8W USB Soldering ironTS1532
1 × 50k Linear Single Gang 9mm PotentiometerRP8516
1 × Knob to suitHK7705
1 × Male Pin Header StripHM3211
1 × Female Pin Header StripHM3230

*Quantity shown, may be sold in packs. ^Protoboard may need to be cut to fit

schematic

Wiring the circuit

This is a fairly easy circuit to build. I used a standard 50mm × 70mm PCB with a USB Type B style connector for the input. I chose this connector as it appears to have the largest terminals which I figured should lower the resistance, allowing for the maximum possible voltage and therefore current to be delivered to the load.

The output connector uses the standard USB Type A connector so that the cable supplied with the soldering iron can be used without any modification.

Directly from the input are two capacitors, a 0.1uF ceramic capacitor for noise decoupling and a 100uF electrolytic capacitor. These capacitors ensure the power supplied to the device is as noise and ripple free as possible, which provides a stable supply for the microcontroller. This allows the maker to use either a Switchmode power supply or a battery bank to power the device.

Microcontroller

To reduce costs, I opted to use the bare microcontroller for this project rather than utilising the entire Arduino system. It comes with a 16MHz crystal and 2 × 22pF capacitors. These components together create the clock signal for the Arduino and must be soldered in as close as practical to the XTAL pins of the ATMega328P microcontroller. I recommend adding another 0.1uF capacitor on the VCC (+) rail of this microcontroller to aid in noise reduction.

To program the microcontroller, you have several methods at your disposal. You can use a programmer sold at any of the major electronics distributors or you can simply use an Arduino UNO with the DIP microcontroller.

To program with the UNO all you need to do is insert the microcontroller from the purchased kit into the DIP socket of your Arduino UNO and program it as you would another Arduino sketch. Once programmed you can just take the IC out and place it into your project. This is by far the easiest method for beginners. Just take care and ensure that the IC is inserted correctly into the socket.

microcontroller

LCD Display

For this project, I am using the Sparkfun Nokia 5110 LCD sold by Core electronics. You need to take care to ensure that the LCD you have (if purchasing from a different distributor) matches the pinout of this LCD, as I have noticed there can be some differences between the distributors/manufacturers. If it doesn’t match simply follow this guide:

LCD PINARDUINO PIN
CLK / SCLKDigital pin 8
MOSI / DIN / DNDigital pin 9
DCDigital pin 10
Reset / RSTDigital pin 13
CS / CE / SCEDigital pin 11
VCCThe Arduino Nano 3.3V out (Do not connect to 5V)
LED / Light330Ω resistor to ground (Omit if you don’t want backlight)
GNDGround / GND on the Arduino

The Nokia 5110 LCD is a 3.3V device, which for the most part is tolerant of the 5V data lines provided by the microcontroller. It is, however, good practice to use a voltage divider or current limiting resistors on the data lines. Therefore, it is highly recommended that you add series resistors with the data lines in the following way.

LCD PIN ARDUINO PIN
SCLK / CLK 10KΩ
MOSI / DIN/ DN 10KΩ
DC 10KΩ
Reset / RST 10KΩ
CS / CE / SCE 1KΩ

This will ensure the LCD is not damaged in the long term.

To power the LCD we need to step down the 5V from the USB supply to a 3.3V rail. Linear regulators are cheap, readily available and easy to use so perfect for this project. Linear regulators normally need a few volts higher on the input than the target voltage. Given that we only have 5V and we need 3.3V, a difference of only 1.7V, we need what is known as a low dropout regulator. For this project, I used the LM2936-3.3. Like with most linear regulators, this device needs two capacitors for stable operation. It requires a small ceramic capacitor on the input for noise filtering and a larger electrolytic capacitor on the output. I used 10nF on the input and 100uF on the output.

MOSFET

The MOSFET is fairly straightforward. Its gate is connected to the microcontrollers digital pin 6, as well as being connected to a 10kΩ pulldown resistor attached to ground. This ensures that the pin is never left floating in an undefined state between on and off.

The drain is connected to the USB Type A (output) GND connection, and the source pin is connected to GND via thick solder traces. This allows the soldering iron GND pin to be at ground potential only when the MOSFET gate is pulled to 5V.

soldering station

Bypass the Iron’s Circuitry

The original circuitry in the soldering iron was activated by touching the small metal dome on the soldering iron. In this project, the original circuitry should be bypassed so that it does not interfere with the new operation. The good news is the procedure is 100% reversible as all we do is bypass the circuit.

iron
Once you have followed the steps it should resmeble this.

To modify the iron all you need to do is follow the following procedure.

  • Unscrew the silver nut holding the tip in place
  • Remove the yellow plastic retaining trim and the tip by pulling them away from the body
  • Unscrew the three screws on the package itself
  • Separate the two halves of the device
  • Carefully remove the PCB from the housing
  • Solder one end of a wire from the negative of the 2.5mm headphone jack
  • Solder the other end to the negative side of the tip connector

After soldering the wire in, its just a simple job of putting the device back together. Take care to avoid crushing the wire you have attached, as the case is a little bit cramped.

When retightening the screws into the plastic case it is recommended that you first turn the screws counter-clockwise for a rotation or two. This will allow the screw to fall into the already cut threads. That way when you tighten it up clockwise the threads of the screw are lined up with the cut threads in the plastic and you don’t need to cut another thread. Doing this will allow you to screw and unscrew screws in plastic hundreds of times without the plastic part failing.

3D Printed Enclosure

The case for this project utilises a dual extrusion printer, which allows for multiple colored filaments or materials to be deposited on a single pass. Dual extrusion is great to give 3D printed parts a more appealing finish. I chose to use a red filament for the banding and name, however, it is completely optional. The main body and holder were printed using ABS as the higher melting temperature would reduce the chance of warping with the hot soldering iron tip close to the body, however, note that care should be taken to reduce the chance the tip comes into contact with the plastic as even ABS will surely melt. Optionally, the feet for the device were printed using flexible (rubber) filament to give the item significantly higher surface friction on your bench.

For this project, I opted for my usual slide in PCB design. This removes the need to perfectly align screw holes while designing the case and therefore makes the device easier for others to construct. It also adds flexibility for a slightly different sized PCB, etc.

The case is designed to be printed face down on the build surface, which will improve the smoothness of the face and mean support material is not needed at all.

If you don’t have a dual extrusion 3D printer you can still print the device just ignore the banding and name files. You may want to use support material to bridge the gap however, I assume it won’t be any significant overhang. Therefore it’s up to you and your printer.

The Code

It does not get any simpler than the code for this project. Essentially, what it’s doing is reading the voltage across the potentiometer and mapping that voltage between 0 for 0V and 255 for 5V. It then converts that figure and stores it as a percentage with 0 being 0% and 255 being 100%.

After that it outputs a pulsating DC square wave corresponding to the output value, and displays the percentage on the Nokia 5110 LCD.

The code utilises the LCD graph Library, which you can find at: http://www.rinkydinkelectronics.com/library.php

This is a very well written library, is simple to use and looks great, I highly recommend it.

Setup

#include <LCD5110_Graph.h>
LCD5110 myGLCD(8, 9, 10, 13, 11);// SCLK=8, MOSI=9, DC=10, RST=13, CS=11,
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];
const int analogInPin = A0; 
const int analogOutPin = 6; 
int sensorValue = 0; 
int outputValue = 0; 
int percent = 0;
void setup() {
  Serial.begin(9600); // initialize serial communications at 9600 bps:
  myGLCD.InitLCD(); //initialize LCD with default contrast of 70
  myGLCD.setFont(SmallFont); // Set default font size. tinyFont 4x6, smallFont 6x8, mediumNumber 12x16, bigNumbers 14x24
  myGLCD.clrScr();
  myGLCD.print("Soldering",CENTER,0);
  myGLCD.print("Iron",CENTER,12);
  myGLCD.print("Johann Wyss",CENTER,40);
  myGLCD.update(); 
  delay(2000);
}

Loop

void loop() {
  sensorValue = analogRead(analogInPin);
  outputValue = map
(sensorValue, 0, 1023, 0, 255);
  percent = map(sensorValue, 0, 1023, 0, 100);
  analogWrite(analogOutPin, outputValue);
  Serial.print("t output = ");
  Serial.println(outputValue);
  myGLCD.clrScr();
  myGLCD.print("DIYODE",CENTER,1); 
  myGLCD.drawLine(0, 9, 84, 9);
  myGLCD.drawLine(0, 10, 84, 10);
  myGLCD.setFont(BigNumbers); 
  myGLCD.printNumF(percent, 0,20,18);
  myGLCD.setFont(SmallFont);
  qmyGLCD.print("%",65,15);
  myGLCD.update();
}

Testing

To get an idea of how the device would perform I opted to graph the actual relationship alongside a completely linear guideline.

performance graph

I simply took a measurement of the soldering iron tip temperature for each 10% duty cycle increment. The result is a fairly linear response. If you wanted, say 360˚C at the tip, you could with a degree of accuracy (using the graph above) predict a duty cycle of around 68%. When I did this, it did indeed measure to be 360˚C.

Of course, your device may not work quite as precisely using this chart. It would depend entirely on the device you use to power the soldering iron, and also the resistance of the tip itself (mine has a resistance of 3.8Ω). This is why I opted to only show the duty cycle percentage and not the power or approximate temperature. Buying a second soldering iron from Jaycar, which had a significantly lower resistance of 2.9Ω, confirmed this decision was a wise one.

However, given the fairly linear relationship between the duty cycle and the temperature, you can always be assured that a 50% duty cycle will always be about 20% cooler than a 70% duty cycle, etc. Thus giving you fairly fine control of temperature.

Thermal Capacity and Temperature Stability

During testing, it became obvious that the combination of small tip and low overall output power impacted the thermal capacity of the iron greatly. To overcome this the engineers designed the iron to run much hotter than one would usually like.

My circuit essentially reduces the output power to reduce the temperature, and as such, the thermal capacity is also reduced. For the most part, a hobbyist soldering a kit or small project together isn’t likely to be affected by this severely.

However, if you find that when soldering components to large ground planes, heatsinks or larger components in general that the soldering iron cools too quickly. I encourage you to turn the power up a little more to overcome the low thermal capacity of the iron.

Where to from here?

There is plenty of room to develop this circuit further. You could include a Hall Effect sensor and magnet to detect when the soldering iron is placed in the holder.

You could then program the microcontroller to turn down the power to the iron to a specific range like 30% when returning the iron to the holder. This would also reduce the power wasted when using a battery bank, and ensure that the soldering iron tip lasts significantly longer.

Another idea would be to include a Thermocouple to monitor temperature so you could select the desired temperature. The microcontroller would read the desired temp, read the actual temp and if the actual temp is lower than the desired temp pull the gate of the MOSFET high, else pull the gate low.

This would be an easy way to make this power controlled soldering iron into an actual temperature controlled one. It would also stand as a way to overcome the lower thermal mass, as the device would detect the drop in temperature and increase the power as needed.