12.07.2015 Views

download - Nuts & Volts Magazine

download - Nuts & Volts Magazine

download - Nuts & Volts Magazine

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OvenFlow 1.0A Program to Control SMDSoldering Using a Toaster OvenEver want to try SMD (surface-mountdevice) soldering without using amagnifying glass and super steadyhands? Production houses use ovens whichcost thousands, but it’s possible to do areasonable job with a regular toaster oven.You just need to control it correctly. Enter theSparkFun Electronics Reflow Toaster Controller.by Kit RyanThis controller looked like a great project for experimentingwith reflow soldering SMD devices at home, but it camewith only rudimentary software. As a learning project,it had many features to explore, including a PIC16F88 MPU,thermocouple temperature sensor using the A/D converter,control buttons for inputs, an LCD readout, and a serial portwith boot loader for quick program changes. A personal goalwas to get back to low level (near assembly code) programmingafter decades of being out of touch. Many months and 1,500lines of C code later, this little controller can really do a lot,including programmed modes and data logging to your PC.Getting StartedThe controller hardware kit is a snap to build — wellpackaged components and no SMDs (!). It even includes apower supply. All you need is a serial cable to hook it up toyour PC for programming as shown in Figure 1. A featureof this kit is that the PIC16F88 already comes loaded witha boot loader so a real programmer isn’t immediatelyneeded — but more on that later. The kit powers up withthe LED flashing and the LCD readout showing “SparkFun.” Very reassuring that everything works.The circuit, shown in the schematic in Figure 2, isdesigned to control a relay that can switch 120 VAC forregulating the temperature of an ordinary toaster oven.How it works is that the thermocouple output is amplifiedand linearized by the Analog Devices AD849 IC to within±2 degrees F. No adjustment is needed and I found it tobe within one degree of the reading compared to roomSAFETY NOTICES1) This project involves line voltageconnections which are potentiallyfatal if mishandled. Double-check allwires before applying line voltages.FIGURE 1. Completed controller project.2) Using the Controller for reflowsoldering can result in operating atoaster oven at extremely hightemperatures, which can burnfingers or cause fires.3) Solder materials, whether leadbasedor lead-free, can be toxic ifingested. The toaster oven youuse for this project should bepermanently dedicated to electronicsand no longer used for heating foodproducts.PLEASE USE CAUTION WHENOPERATING THIS CONTROLLER.June 2008 67


OvenFlow 1.0thermometers. The analog signal is between the rangeof 0 to +5 volts and fed to one of the PIC port pins tobe sampled and converted to a 10-bit digital value. Theresult is converted into a three-digit display and sent to theLCD readout.Board buttons labelled “Up,” “Down,” and “Select”are sensed by other PIC port pins and are used by thesoftware to control the relay, temperature, and timerfunctions. One helpful feature of the 16F88 is that youcan turn on “weak pull-ups” on its ports. This means thebutton inputs will read five volts when not pushed andzero volts when pushed without having to put extra“pull-up” resistors to the five volt supply. It’s no wonderthe board looks so simple! The power supply regulates thefive volts for all the ICs. A MAX232 IC converts the 0 to+5 volt digital signals to and from the PIC to the standard±12 volt RS-232 levels for interfacing to the PC.Something not supplied with the kit is the AC outletbox seen in the picture. The relay wires are run to this boxto switch the hot side of the outlets. An alternative thatyou may consider safer is to not mount the relay on thecircuit board but put it inside the outlet box itself and justrun the low voltage control signal back to the controllerboard. A significant amount of additional information onthe hardware, the build kit, and boot loader software isavailable from the SparkFun website [1].Simple is Okay; Complicated is More FunToaster ovens can get up to over 500 degrees F — hotenough for SMD soldering. But heat alone is not enough.It takes the right time/temperature profile to melt thesolder without destroying the parts or getting solderbridges in the process. A typical SMD heating profile isshown in Figure 3 (courtesy of Kester solder systems).Having a required profile was what drove the need for a“programmed mode.” Since the PIC16F88 can write itsown internal EEPROM memory to store a program, allthe pieces were there for a really capable circuit!The schematic is reproduced with permission fromSparkFun Electronics. The BoostC header file is providedwith permission from BoostSource Technologies. (TheJP112Temp-IN+INStatus_LEDR1330D2LG1LogoLOGOJ1DC PowerR1D11N4004R2PowerS1RAW1C1100uFU1VinGND2Vout78053VCCC2100uFJC1RS232+IN5948372611234567U3IN++C+TCOM-T-CV-AD595VCCGNDRX1INTX1OUT-IN-ALM+ALMV+COMPVOFBC80.1uFVCCStatusVCC16VCCGND13451110129VCCTXRXR610KS2ResetD6 1D7 2Temp 3VPP 4GNDCS156CS2 7RX 8Status_LED 9Relay_ControlC610uFC710uFR7U210KPIC16F88VCCRAWD31N4148Q1NPNC90.1uF181716151413121110D5D4ER/WVCCCS3RSTXRelay_Control2x Quick-Connect Solder Lug Connection to ToasterREL1SPST-NOR210KVCCVCCContrastCS1S3UpCS2S4DownGND 1VCC 2Contrast 3RS 4R/W 5E 678910D4 11D5 12D6 13D4D7 1415GND 161N4148CS3S5SelectLCD1RA2/AN2/VREF- RA1/AN1RA3/AN3/VREF+ RA0/AN0RA4/AN4 RA7/OSC1RA5/VPP/MCLR RA6/OSC2VSSVDDRB0/INT RB7/AN6/PGDRB1 RB6/AN5/PGCRB2/RXRB5/TXRB3RB414 -IN1312111098 TempC10VCC0.1uFVCCC4U4 MAX23210uF 2Vs+ C1+6Vs- C1-C5C2+C2-10uFTX1OUT 14T1Out T1In7T2Out T2InRX1IN 13R1In R1Out8R2In R2OutGNDVCCVEERSR/WED0D1D2D3D4D5D6D7BL+BL-LCD 16x215FIGURE 2. Controller schematic.68 June 2008


author is not affiliated in any waywith either company.)Controller SoftwareThe software was developedto be more flexible than justcontrolling a toaster oven, shouldyou want to apply it to otherthings. The original SparkFunsoftware — which does have manyuseful basic code examples in it —has been heavily modified andexpanded to get the resulting codedescribed here.The 4K memory limit of thePIC makes life really tough forgetting sophisticated with theprogram. Every “extra” feature orline of code was scrutinized. Heavyuse of functions (subroutines) wasrequired to eliminate redundantcode. The fact that only 200memory locations are left out of 4096 is an indicationof how tight it is. The user interface is further hinderedhaving only 2x16 characters on the display and just threecontrol buttons (there is a fourth button for reset only),however, a lot can still be done as seen in Figures 4 and 5.The top line contains the settings for the currentmode of operation and the second line shows thefunctions for the three buttons, marked “up,” “down,” and“select” on the PC board. Each button canhave two functions, depending onwhether a short push or long push(greater than two seconds) has beenmade. The slash mark “/” separatesshort/long functions.A User Manual has been preparedwhich details all the capabilities andoperating procedures. The modes aredescribed briefly as follows:1) Main Menu: This comes up first afterthe splash screen and allows the user toselect one of the five operating modes.This is the basic “home” screen andalways available when exiting one of theother modes. The only way to exit theMain Menu is to turn off the unit!2) Manual: Has a stop watch andrelay control plus displays the currenttemperature. The user can manuallystart/stop/reset the stop watch and turnthe relay on or off directly. This mode isFIGURE 5. Program Mode LCD screen.FIGURE 3. Standardreflow solder profile.“Main Menu” Screen:Current mode:MM = Main Menu“up” button function:x = none“Program” Screen:Step NumberP1 = Program1P2 = Program2“up” button function:R = run (short)S = stop (short)/R = reset timer (long)OvenFlow 1.0useful for calibrating the oven (or making toast).3) Semi-Automatic: The user can set a temperature andthe oven will track this temperature and turn the relayon and off automatically. This can be used for very longoperations, such as chemical bath (e.g., etchant)temperature control for several hours.Mode: ManualMM x x Nx/Sel“down” button function:x = noneTimer Program temperature (C or F)0 000s 000C 000CP1 R/R Jmp Ed/Ex“down” button function:Jmp = jump to next step(short or long)FIGURE 4. Main Menu LCD screen.Top line – Mode Select:ManualSemi-AutoProgram 1Program 2Setup“select” button function:Nx = next mode (short push)/Sel = select this mode(long push)Actual temperature(C or F)“select” button function:Ed = Go to edit mode (short)/Ex = exit back to MainMenu (long)June 2008 69


OvenFlow 1.04) Program 1 and 2: This is the most capable mode of thesoftware, permitting the controller to follow a time/temperature profile with up to 10 steps. Each step isprogrammable by the user and both the setting and theactual temperatures are displayed in real time. Thesoftware comes with a built-in profile similar to the Kestersolder curve to make getting started easier. It can, ofcourse, be modified. A nice feature of the programmer isthat the steps for up to two programs are retained in theEEPROM on the onboard PIC16F88 after the unit isturned off. The LCD display for this mode shows howmuch information can be crammed into just 32 characters.5) Setup: Five variables can be modified to tailor thecontroller to user preferences, including:• Temperature units (Celsius or Fahrenheit).• Time/temperature increment (during programming,the amount of change for each button push can bevaried between one and 10 seconds or degrees).• LED on with relay (gives a visual indication that therelay has been switched on; kind-of a safety feature).• Clock calibration (allows a ± 2% change to thebuilt-in system clock to get the one second timeras accurate as desired).• Time constant (helps the control system compensatefor the lag time in heating up the oven elements).In addition, the controller program has a data loggerfunction which will output the time, set temperature,actual temperature, and relay on/off conditions to your PC.Data points are sent once per second. It uses the built-inserial port on the board (a nice to have feature!) and isdirectly readable by HyperTerminal or similar programs.The data can be easily copied into Excel and analyzed orplotted, as seen in some of the plots in this article.Software Tools Selection300250200150100500Every programmer has to select tools and it’s never aneasy choice. Cost, complexity (including the learningcurve), and capability are all factors. In selecting BoostCover CC5X — which seems to be the standard compiler inmost articles — the cost differential of many $100s wasimportant. As this was my first PIC programming effort,and not knowing whether I would like it or be successfulor ever want to do it again, I opted for a very low costentry into the process. It turns out that this compilerbehaves very well, the cost is incredibly low, and there isexcellent user support through the forums. I could oftenget a response to a question back in 24 hours from thecreator of the compiler. I didn’t come across a singlebug either, although a few features could be improved,such as error messages. It also integrates right into theMicrochip MPLAB IDE, too, for a consistent programmingenvironment. For those of you who want to tweak thecode with another compiler, there are several things whichmust be changed globally, including: using small letters forall the register names; changing the way binary numbersare entered; and, of course, pragma usage.The boot loader from SparkFun proved to be moreproblematic. It worked perfectly over the serial port duringthe early days of program development, when I wasmaking tons of stupid mistakes during the learningprocess. However, when the program size became largerthan 2K (which is half of what the PIC16F88 canaccommodate), the process went “tilt.” There are somepeculiarities in the way the PIC programs jump to addressesabove 2K that are incompatible with the SparkFun bootloading scheme. Luckily, by that point, my programmingskills had improved and I could use my ICD2 clone todirectly burn-in the program changes to the PIC. It was notas onerous as I had originally thought, taking only about30 seconds for a complete remove/burn/re-install cycle.Cooking Right AlongTo start, I suggest trying out the oven in Manual Mode;just switching the relay on and leaving it there for perhapsfour minutes. Use HyperTerminal to collect the serial dataoutput and plot the heatingcharacteristic. First try, I ran into aproblem before the temperaturehad peaked — the oven’s thermalcutout safety switch clicked outat 220°C, just enough for regularsolder to melt but not for lead-freeRoHS work. I found that byadjusting the little metal tab onthe temperature dial inside theoven cabinet, I could raise thelimit to 250°C, which is enough.Of course, unplug the ovenbefore taking screwdriver in hand!The second attempt then0 50 100 150 200 250 FIGURE 6. Toaster oven heatingcurve — Manual Mode.70 June 2008


OvenFlow 1.0to work with a little effort.Do It YourselfThe hardware is obtainable fromSparkFun Electronics and saves a lotof time compared to assembling yourown circuit from scratch. If you do goit alone, just be sure to follow theschematic exactly and absolutely usea PIC16F88 MPU because every PICis slightly different and the softwarewill likely not work with anotherMPU. Add the outlet box and then<strong>download</strong> the software from the SparkFun site. I’ve included two versions ofthe program there for your enjoyment:a .hex file that can be burned directlyinto the MPU using a programmer,and a C file and associated headerfiles in case you want to play aroundwith the program yourself. Do asearch for “reflow” to find thecontroller info and files. Sorry, butthere’s no easy way around using aprogrammer unless someone comesup with a tiny bootloader that’scompatible with the large programsize. This particular MPU is actuallydesigned for in-circuit programmingbut that feature is not built into theSparkFun kit and will probablyrequire some circuit modifications tomake it work. Even so, a programmerwould still be required.Also posted on the SparkFunwebsite is a complete User Manualfor the program that explains all thescreens and control functions. Thatmanual includes a more in-depthdiscussion of the software, too. Beaware that the PIC16F88 has only4K of program memory and theprogram described in this article uses95% of it! If you want to add morefeatures, you’ll likely have to cutsomething out. NVREFERENCES[1] SparkFun Electronics controller& software (sparkfun.com)[2] Kester SMD solderingtime/temp profile (kester.com)[3] BoostC C compiler (sourceboost.com)72 June 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!