With the mechanical side of the soldering robot well underway the next stage was to begin work on the electronics that will control it. In a previous post, I wrote about our decision to use the Antex TCS230 soldering iron elements and the discovery that they were thermistor based rather than thermocouple based as Antex mentions on their website. Once we knew how to measure the temperature of the soldering iron element and worked out a profile for the temperature vs resistance we started working out the best way to design a temperature controller.
The first job was to reverse engineer the Antex TCS230 controller that is fitted inside the soldering iron handle and work out how it works. After tracing out the PCB tracks and converting them into a schematic we found that they use a relatively simple comparator circuit that compares the resistance of the element against a potentiometer and uses that to turn a triac on and off to keep the correct temperature.
For our controller, we wanted to have the ability to monitor and change the temperature using the tablet PC that will be fitted to the front of the robot so instead of a potentiometer we decided to use a microcontroller which would read the voltage from the soldering iron thermistor and calculate the temperature of the heating element. The microcontroller would then compare that temperature against one that has been programmed from the tablet PC and if the element is colder it then turns on a triac via an optoisolator. Once the element reaches the target temperature it is switched off.
To get the temperature from the element we used a precision 4.096V voltage reference MCP1541T to provide a constant voltage source, this was then passed through a 10K resistor, the thermistor and another 10K resistor connected to ground. The voltage was then measured across the thermistor to calculate its resistance. The voltage was then fed into a low offset op-amp with a gain of 30 to bring the voltage up to a level that would be easier to measure with an analogue to digital converter. A gain of 30 was selected as this would give a voltage of around 2V at 600°C. Precision 0.1% resistors were used throughout to sensing circuit to maximise the precision of the measurements.
By placing the thermistor between two resistors the measured voltage was biased to 2.048 volts above ground allowing us to power the op-amp directly from the 3.3V supply. If the input was not positively biased we would have needed to supply the op-amp with a negative voltage lower than ground in order for it to operate properly which would have added to the complexity of the circuit.
For the op-amp, we chose an OPA4330 from Texas Instruments. The OPA4330 is a quad-precision amplifier with zero drift and a voltage offset of just 50µV. Using a precision op-amp would increase the accuracy of the temperature measurements and the quad channels would allow us to measure two soldering iron elements with a single device. The op-amp was split into two channels with the first op-amp used to provide the gain and the second used as a filter to remove any 50Hz noise that may have been picked up between the element and the control board. With the voltage from the thermistor amplified and filtered the next stage was to measure it.
The PIC24FJ128GC006 16-bit microcontroller from Microchip was selected for controlling the temperature controller. The PIC24FJ128GC006 contains two 16-bit delta-sigma ADC converters which have a sample rate of 1000 samples per second. It also has the ability to route most of the peripherals like UART and I2C to almost any pin making the PCB layout easier. An external 8MHz crystal provided the clock source for the microcontroller and an LM413 2.048V voltage reference is used to supply a reference for the internal ADCs.
The software for the microcontroller is fairly simple. We used Microchips Code Configurator to generate the basic structure of the software. Code Configurator allows you to set up the IOs, peripherals and interrupts quickly and is easier than digging through the datasheet trying to find out which registers need to be set to make everything work.
One of the internal timers is used to trigger an interrupt every 100ms. When the interrupt is triggered the two ADC channels are read to get the voltage from the soldering irons, a few calculations are made to work out the temperature of the elements and they are compared against the target temperatures. If the element temperature is lower than the target a GPIO pin is set to high, otherwise, it is set to low. The GPIO pin drives an NPN transistor which in turn drives a MOC3052 optoisolator. The MOC3052 is a triac driver optoisolator and this in turn drives a 2N6073A triac. When the triac is turned on the mains voltage flows to the soldering iron element heating it up.
Remote control for the temperature controller is done through an RS485 interface. An SN65HVD1474 RS485 driver connects to one of the PICs UART ports and a command protocol was designed that allows us to read the temperatures and controller status as a comma-separated string using a single command or read or set the temperatures using several other commands. A second UART port was used as a debug port so we could output text to a terminal window on the computer via a UART to USB converter.
An RJ12 connector was fitted to the PCB to provide a 5V power supply to the controller as well as the RS485 communication. The 5V supply was dropped down to 3.3V with a linear regulator to provide power for the microcontroller.
We also decided to add a USB port, several buttons and an LCD port for a Nokia 5110 LCD module. These are not needed for the soldering robot but it does mean we could use the board as a standalone two iron temperature controlled soldering station controlled either from a computer or directly using the buttons and LCD.
We haven’t added the code into the firmware for the LCD or USB stack yet but that will probably be done in the future once the soldering robot is finished.
The schematic, PCB layout and firmware for the temperature controller can be downloaded from our Git Hub page at github.com/briandorey/Soldering-Robot-Project/