Thursday, August 27, 2015

7. Final thoughts

The last part of the series is finally here. Having used the soldering station for a few weeks now without any problems, it should be safe to build. I haven't noticed any problems with the hardware or with the software, but if you find any bug, please let me know.

As I promised in the last post, here's a little presentation video to show the driver in action:

Now that the project is finished, I gathered all the links to the articles as well as a price list for all the components on a separate page so it's easy to follow the instructions. I mostly used no-name or el-cheapo parts since these are  the only ones that the local electronic parts shop keeps, so depending on your part supplier and the brands you choose, the final cost for your build might be a bit bigger than mine.

Complete project page

Happy soldering!

Thursday, August 13, 2015

6. Putting it all together

Now that all the components are ready, it's time to put them all together. There is no way one can work with this wirey mess:

The power module, main board and button board

For this purpose I bought a nice ABS case from TME that seems to be big enough to hold eveything in. A metal case would have been better because it would have made the device more solid and it would have helped with the cooling (not there's much heat). If you find a metal case instead of plastic, go with that instead (especially if you have tools to cut the ports). Also, try to get a case that has vent holes in it to decrease the possibility of overheating.

The case as received from TME

From another angle

After measuring the front panel of the case, I used the GIMP to create a design for it then had it printed on an A4 piece of paper. This step is important from an usability point of view so make sure you arrange the ports in such way that the screen will be easy to read, the buttons easy to press with one hand and the soldering iron cord doesn't get in the way. After settling on a design the next step is to laminate the printed page so that it's nice and shiny (and not so easy to destroy):

The laminated page cut to the size of the front panel of the case

This laminated sheet will be glued to the panel, but first the ports for the screen, buttons and soldering iron conenctor need to be cut:

First the outlines were traced with a marker

Then the holes were cut in the plastic

Before glueing the face to the panel, we need to add some protection for the LCD. It's not a good idea to have it exposed directly to the exterior, especially when working with molten metal around it. For this, I used a thin piece of transparent plastic since that's all I had at the time:

Any protection is better than none at all (TM)

The protection screen was glued directly under the face mask

A better idea would be to use a piece of plexiglass since it would offer much better protection and it's easy to cut to shape. After the protection screen was installed, the face was finally glued in place:

A bit rough on the edges, but otherwise it's okay

Next up is installing the components on the front panel. Great care must be taken with the LCD installation since it's ESD and shock sensitive. Try to use some anti-ESD gloves if you have. To make things easy I soldered some pin headers to the LCD and connected the corresponding connector to a piece of ribbon wire:

One ribbon cable, 2 x 6 pin connectors and their counterparts, some heatshrink tubing and the LCD

Ready to install

Make sure to carefully think where to mount each component inside the case. If your transformer has the tendency to get warm, it should be mounted close to the vent holes and far from the power board since the electrolytic capacitors are sensitive to heat. For the same reason, it's a good idea to mount the transformer on some cardboard washers especially if you're using a plastic case so that the heads of the mounting screws don't melt through the material (sorry for the picture, I am really bad at drawing):

The washers will offer some basic protection against heat

Another thing to watch out for is mains voltage. Please double check that the cord of the device is NOT INSERTED in the mains before attaching it to the device or when working on the mains connection of the transformer! After finishing the connections, check them thoroughly then insulate them with heat shrink tubing or high quality electrical tape. Also, don't forget to connect the earth wire of the power cord to the metal bracket of the transformer, to the ESD discharge wire of the soldering iron (if it has one) and to the case (especially important if you use a metal case) to prevent electric shock in case something goes bad. A quick-reacting fuse is also required for safety and can be attached on the exterior of the case in a covered plastic holder for easy access.

After installing all the components and adding some hot glue here'n'there, my version of the soldering station looks like this:

Everything installed in the case (except for the MCU)

Note the ground connection and the connections of fuse holder in the picture (highlighted with the 2 red circles).

Well that's about it, in the next post I'll show a demo video of the station in action, so stay tuned.

Wednesday, August 12, 2015

5. The firmware

After having spent quite some time thinking about the best way to implement the tip temperature calculation, I came to the conclusion that the most elegant approach would be to make an universal solution that can be adjusted with a calibration menu. The user could then measure the temperatures of the soldering iron tip in regard to the reported (heater) temperature then enter the obtained values in the menu.

Internally, the firmware will then take these values and use them to make some virtual segments, each having a length of 25 degrees C. All these segments taken together form the temperature curve. The reason for using multiple segments to form a curve is that not all soldering irons have the same thermal characteristics. If you have look at the graph from the previous post, you'll see that the soldering iron I currently use has ~61% efficiency at 250 degrees C. The rest of the heat is lost to the environment or simply doesn't reach the tip due to the poor design or machining of the tip sleeve. You on the other hand might have a more efficient soldering iron that has lower losses. If a simple calibration constant would be used, the calculated temperature might be correct on a piece of the curve and incorrect on another. This approach involves quite a bit of math but the AVR was up to the task and I didn't notice any slowdowns in the tests.

The programming language

Having some prior experience with BASIC programming, I have chosen to write the firmware in GCBasic, a great compiler for AVR and PIC MCUs with a syntax similar to QBasic. It is very easy to learn and best of all, it's free and open source, not to mention it has a friendly community around it. The only apparent minus of GCBasic is the lack of floating point maths, but there are a few tricks that can be done to overcome this problem.

GCBasic's excellent IDE (SynWrite) running in Debian under Wine

How to use the firmware

The firmware currently has 3 screens:

The work screen is the mode in which the temperatures are shown. To increase the heating temperature, press Up and to decrease it press Down (short or long). Pressing Stand-by briefly will enter the Stand-by mode. Pressing Stand-by for more than 1 second then releasing it will enter the calibration menu. Pressing the Preset button short will go to the preset value (150 degrees C by default) while pressing it long and then releasing it will set the current temperature as the preset.
To enable or disable the beep made when reaching the desired temperature, press the Stand-by and Preset buttons at the same time briefly. The beep is symbolized by a bell that appears in the lower right position on the screen.
The main screen of the soldering station

The Stand-by screen is shown when the station is not in active use. The heater is still active, but the temperature is maintained at 150 degrees C. To go back to the work screen, press Stand-by short.

The stand-by screen

The calibration menu is used to enter the values needed for calculating the tip temperature:

The calibration menu

How to calibrate the soldering station:

1. By default, the firmware assumes 100% efficiency for the soldering iron. This means that the temperature reported by the thermocouple is assumed to be the same at the iron's tip. Of course, this won't be the case even with the most expensive handles out there.  

2. Set the soldering temperature to 300 degrees C. After the temperature stabilizes (about 1 minute), melt some solder and carefully measure the temperature of the tip with your multimeter's thermocouple by inserting it in the molten solder blob. Wait for some seconds until the temperature remains fixed. If the temperature reported by the multimeter / thermometer is lower than 300 degrees, carefully increase the temperature from the station until it reaches 300 degrees C. Make sure to do this in small increments so the temperature won't overshoot. After the temperature is stable, write down the value from the station's screen. To make things easy you can make a table that contains all the required temperature points:

Example calibration table

3. Lower the temperature until it is 25 degrees smaller on the multimeter (e.g. from 300 to 275), wait for stabilization then write down the temperature reported by the station's screen in the table.

4. Repeat step 3 until you reach the minimum temperature. You should now have all the values from the thermometer in 25 degree increments starting at 150 degrees up to 300 degrees.

5. To calculate the rest of the values, we must approximate the temperature of the thermocouple when the tip has 500 degrees C. To do this, take  the temperature reported by the station at 300 degrees C, substract 300 from it then add 530 to it. For example, if the difference between the tip and the heater temperature at 300 degrees C is 150 degrees, the approximated value will be 530 + 150 = 675 degrees. Now we need to enter this value in the calibration menu so that the station will be able to supply enough power to reach 500 deg. C at the tip. To enter the calibration menu, hold the stand-by button pressed for 2-3 seconds then release it. Then navigate to the 500 deg. C. item with the help of the Preset button and use the Up and Down buttons to set the value to the approximated one. Hold the stand-by button pressed for 2-3 seconds to exit the calibration menu. The station will restart.

6. Increase the temperature to 500 degrees C. Carefully tweak the temperature with the Up and Down buttons so that the tip temperature measured by the multimeter / thermometer reaches a stable 500 degrees. Write the temperature from the soldering station screen in the table.

7. Repeat step 3 until you reach 325 degrees C. You should now have all the values from the thermometer in 25 degree increments starting at 150 degrees up to 500 degrees. Proceed to enter all the values from the table in the soldering station calibration screen as shown in step 5.

8. Test the temperature at 250 degrees C. The value reported by the station should be very close to the one at the tip (reported by the thermometer).

Download firmware

I decided to make the firmware source code available under the BSD license so anyone can add new features or fix bugs. The file below contains both the sources and the HEX and EEPROM files to be written on Atmega168 or Atmega328P.

Download firmware v1.2

Writing the firmware on the AVR

To write the firmware I used the excellent USBASP programmer and avrdude. If you don't like using command-line tools, have a look at AVR8 Burn-O-Mat, it's open source and works on both Windows and Linux:

AVR-Burn-O-Mat - GUI for avrdude on Debian Linux

If you don't want to write the provided EEPROM file manually, after switching on the soldering station briefly press the power button.  This will reset the EEPROM to the factory parameters.

In the next post I'll talk about putting all the components together to form the final product. Please let me know if you find any problems with the software.

Thursday, August 6, 2015

4. Problems: Measuring temperature and soldering iron efficiency

I've been working on the firmware for the soldering station for quite some time now, but I seem to have completely underestimated the complexity of the temperature calculation mechanism. Currently, the software reads the ADC of the MCU, and knowing the 10 bit ADC takes values from 0 to 1024 and that the reference voltage is 5 volts, it calculates the voltage coming in from the op-amp. Based on this value, the temperature of the thermocouple can be calculated and shown on the screen. Simple, right? Not really, since this temperature doesn't seem to be the same at tip of the soldering iron.

This might sound a bit confusing, but it's true. I've hurried with the design of the station and I completely ignored the fact that there are many types of irons out there made by a myriad of companies, each having its own efficiency.

The design, materials and thermocouple positioning inside are so different between the brands that there would be impossible to make an universal formula to correctly deduce the tip temperature. For example, here's how a Gordak-clone ceramic heater looks like:

Gordak clone soldering iron
As you can see, the sensor is very close to the heater coil which means that it will heat up very fast. The tip on the other hand, having a much greater mass than the ceramic capsule will heat up more slowly. It is also safe to say that the tip will not actually reach the same temperature as the heater because of the various losses (the contact with the air and other surfaces, the external sleeve, etc.).

For a universal, do-it-yourself soldering station like the one here, this poses a significant problem in calculating the exact tip temperature. For a company (like Weller or Hakko), this is not an issue because as a manufacturer, they know the exact technical parameters and temperature curves of the soldering iron. So what is to be done?

As quitting is not a solution, the first thing that comes to mind is to somehow compensate for the losses from the firmware, a huge advantage of using a microcontroller. Ideally, the temperature measured by the thermocouple should also be at the tip, but this is not the case. What we actually have are two temperature curves, one for the heater and one for the tip. These two are proportional, but one is linear (the tip) and the other one is not. In order to see what's going on and how they relate to each other I made measurements of the tip in 25 degree C increments, starting at 150 and up to 450 degrees C. At the same time, I also noted the temperatures reported by the thermocouple. The experiments were done on a Solomon-type soldering iron (for use on ZD-929C stations):

Soldering iron for the ZD929C stations

The values were put in a table as seen below:

Table containing the 2 temperature value sets

As you can see, the tip temperature is much lower than the one reported by the thermocouple. To see how big these differences are, take a look at this graph:

The 2 temperature curves

So to get 250 degrees C at the tip, the heater must be at a whopping 405 degrees C. This is not very efficient...

Now the quest is to implement a calibration mode that will allow the microcontroller to calculate the correct tip temperature based on the data above. This will ensure that no matter what soldering iron will be used, after calibration the temperature will be diplayed correctly.

Another subject I'd like to touch is the power supply. Initially I wanted to use an old, soviet era transformer that was lying around:

Old transformer

It could only supply a maximum of 1.5 amps. This was well below the needed 48 watts the iron required and it got hot in just a few minutes. To counter any problems, I bought a new 3 amp transformer:

New 3000 mA transformer

This one can work for about an hour before it needs to cool down a bit, but that's enough for general hobby use. In case you didn't yet buy a transformer, make sure it is up to the task when shopping for it. If you need to only make light work with the station, you can get a 24 volt, 3 amp center tapped (12-0-12) transformer, otherwise if you need to solder for larger periods of time, a 5 amp one will be a much better choice.

If everything goes well the firmware will be published soon :).