Computerized Reflow Oven Yutun Tseng & Buck Golemon May 09, 2007 Overview: The goal of this project was to redesign the controlling circuit of small-sized household ovens into a reflow oven. We decided to give the oven some “modern” taste by adding a small-sized color LCD. Originally, we were going to use the AC-power module from the old oven. However, reverse engineering of the module seemed not quite possible and useful because it was designed to save cost on parts which made it hard to figure out the control signals. Hence, in the later part of the semester, I designed a new AC power module with 2-relays. Main Descriptions: (Hardware + brief overall description) Main components: dsPIC30F3014 Reference:http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335 &dDocName=en010344 -The heart of this reflow project. All signals are controlled and integrated inside the dsPIC. -It is configured to run at 120MHz (30MHz due to 4 instructions/cycle) in order to increase the graphing speed (pixels/second) for the LCD. Running at this speed causes the dsPic to consume a lot of current which becomes one of the ‘possible improvements’ for the future. The standard SPI interface(8-bit) was not suitable for the color LCD(9-bit). Hence, the controlling signal / clock / select bit / reset signal are all programmed to use the General Purpose outputs. -The dsPIC’s built-in SPI interface is used to communicate with the Analog/Digital converter (MAX6675) to obtain the converted temperature value. -2 other General Purpose outputs are used to control the oven light and heat lamp. Each of these two pins are connected to the Optocoupler so that the output is not connected directly to the relay’s controlling module.(A solution proposed to solve the ‘blank out’ problem of color LCD, even though it did not seem to solve the problem. However, it should be better in this way.) -5 debounced input buttons are proposed to provide control over the graphical interface and all other function. -Vector Fonts Implemented (A-Z , 0-9, “: . “). -Timer Module used. -dsPic is used to provide Graphical features. It calculates points, vectors, and everything else. Color LCD 128x128 Nokia Knock-Off (From SparksFun Electronics: http://www.sparkfun.com/commerce/product_info.php?products_id=569) -It uses a 9-bit Serial Interface. -By using the current dsPIC configuration and programming, it is now running at 4MHz. According to its documentation, it should be able to run at 20MHz. -Valid pixels: 130x130 (code segment of 0-129, page segment of 2-131) -Capable of displaying 4096 colors. Although it is capable of displaying 4096 colors, it is only capable of indexing 256 colors at a time.(RRRGGGBB) -Have sleep mode / energy save mode. Not used in this project. Having the capability of turning into power-save mode is significant and is definitely is the “possible improvements” for the future. -Capable of adjusting brightness by using the Volume Control signal with the alpha ratio value. -Does not have to be drawn frame by frame. The drawing can start at any place for any desired area with defined size in pixels. Such a feature is useful when the background need not to be cleared and also useful for drawing points, vector lines, arcs, and many other. -uses RD8 for /RESET -uses RA11 for /CS -uses RD9 for clock signal -uses RD3 for data Thermocouple: Thermocouple Type-K Glass Braid Insulated (SparksFun Electronics: http://www.sparkfun.com/commerce/product_info.php?products_id=251) K-type Thermocouple is capable of detecting and standing the temperature from 0 to 120 Celsius. Such advantages are very useful for oven environment. Digital Thermocouple Amplifier MAX6675 (Datashee: http://www.sparkfun.com/datasheets/IC/MAX6675.pdf) The MAX6675 A/D converter uses the Serial Peripheral Interface to communicate with other chips(dsPIC.) This chip’s clock tops off around 4 MHz and is currently running at 3.75Mhz. It takes about 0.24 second to finish each conversion calculation. In the current dsPIC configuration, the data is obtained by the timer module once every second. The converted result of MAX6675 is from 0 to 4095 which maps into the range of 0~1024 Celsius. Hence, after some right-shifting, the value is good to be used and stored. Miscellaneous: OptoCoupler (MCT2) x2 (Home Http: http://www.ortodoxism.ro/datasheets/fairchild/MCT2.pdf) The Optocouplers were not used in the original design. However, in order to decrease the instantaneous drawing of current, and to make the controlling circuits and the relays to be isolated from each other, two optocoupler were used in between the control signal and the signal intake for the relay modules. P&B T77S1D10-05 Relays x2 (Datasheet: http://catalog.tycoelectronics.com/TE/bin/TE.Connect?C=1&M=BYPN&PN=T77S1D10-05 Configuration/Package: http://www.mouser.com/catalog/629/1419.pdf) Relays are used because that the minimum current value along the relay need to be greater than 50mA. Due to that the current provided by dsPic tops off around 20mA, the current needs to be amplified and should be isolated from the main dsPic’s DC source. LM317 3-Terminal Adjustable Regulator x5 (Datasheet: http://www.angelfire.com/electronic/hayles/downloads/lm317.pdf) LM317 is one of the most commonly used components in this project. One of the LM317(1) is used as Current-Limiter so that while shorted, it will not cause any surge of current and shall not damage the dsPic. It’s effective Current Limit is calculated by dividing 1.25V by the resistance applied across the adjust and the output. In this case, the resistor is a 3.6Ohm with 5Watt rating, and will provide a Current Limit of 0.35A. One of the LM317(2) is used to regulate the power from about 14V(the DC voltage of the transformer after rectification) down to 6~7 V. The output voltage can be changed by turning the knob of variable resistor of a range from 0~100 Ohm. The LCD seemed to display nicely when the LCD backlight Voltage is at 6.5V. Two of the LM317(3,4) are used to regulate and provide two 5V voltage sources. One of the two(3) is used to provide the power for dsPIC and all other modules on the proto-board. This source is also the voltage source for the 3.3V LM317(5) circuit. Due to these load, this particular LM317 heats up very fast and is, therefore, having a big heat-sink attached onto it. The other one of LM317(4) providing 5V is used in the relay controlling circuit so that the relays are controlled by a different source and could possibly decrease the chance of blanking out the color LCD. Although it did not help much for the Color LCD, it helped lessening the load for the other 5V LM317 regulator. The last one of the LM317 is used to regulate 5V(from 3) down to 3.3V, the specified LCD logic power source. Program Description: Type FIFO The data type used to store first-in-first-out data. It was mainly used for debugging purpose. For instance, all the inputs from the Serial Terminal (UART) and all the output to the Terminal are all stored and cached by calling FIFO. Because the UART and the SPI are both transferring much slower than the actual processing speed of the dsPIC, the data for them are needed to be buffered by FIFO. fifo_init(*f) – Initialize the the FIFO fifo_put(*f, char) – FIFO Function for storing character fifo_puts(*f, char *s) – FIFO function for storing string fifo_get(*f, char *c) – FIFO function for getting the data from FIFO Type gType The gType stands for graphical type. According to the current configuration, it is set to store 150 data points. Besides the x-y coordinates, this class also stores the maximum and minimum values of both x-coordinate(the Time) and the y-coordinate(the Temperature). It uses these two max and min to calculate proper scaling when the scaling function is called. Hence, this graph type is capable of auto-scaling. One other notable implementation for this gType is that it trims itself. With the implemented algorithm, it will automatically truncate the un-needed points and does not lose any critical point nor lose any accuracy. gType_init(*g) – the Initialization function for the gType gType_set(*g, x0, x, y0, y) – sets the default x-min and x-max for scaling of x, and sets the default y-min and y-max for scaling of y. gType_setwh(*g, display-width, display-height) - trivial function and is taken care in the LCD_graph function. gType_inc(*g, x, y) – adds new point to the graph. gType_dec(*g, index) – take the indexed point off the array and re-sort the array gType_x(*g, index) – returns the scaled x for x[index] gType_y(*g, index) – returns the scaled y for y[index] gType_trim(*g) – trims the graph *g and take out un-needed points. Type Clock The real time clock type for storing real time elapsed seconds since program start and the real time temperature reading. Timer1 Timer type I is used. It is operating with a period of 50000 counts of clock. Once the period is reached, the Timer will tick. When desired ticks are collected (585 is used), the Second of the Type Clock is then increased by one. SPI Set to run at 3.75MHz and with proper clock edge and sampling configuration. The SPI is solely used for communication between the MAX6675 and dsPIC. In order to initiate a transmission, Latch D8 needs to be set to low (triggering the MAX6675) and a “WriteSPI1(0);” need to be called to start the clock. UART The UART is set to operate at 115200. The UART is mainly used for debugging purpose and to demonstrate and draw the vector characters. LCD commands: LCD_put (command, data) Command = 1/0. If command, the first bit of 9-bit will be a 1, else it’s a 0. The function used to transfer 9-bit data for the LCD. This function handles the chip select, clock, data, and the timing as well. LCD_command(data) Identical to LCD_put(1,data) LCD_data(unsigned int data) Identical to LCD_put(0,data) LCD_clr() Clears the LCD. Fills the whole screen with black. LCD_put_pixel(c, p, color) Put a single pixel at (code segment, page segment) with Color LCD_square(cs, ps, w, h, color) Starting the (code segment, page segment), with a width of w and height of h, fill the whole block with Color. LCD_line(cs, ps, w, h, color) Draw a line starting (code segment, page segment) along the specified width and height and fill it with the color. LCD_bline(cs, ps, w, h, b, color, d) Draws a bolded line from starting point (code segment, page segment) with specified width and height, and then fills it with color. D is the direction parameter (0 or 1) for the direction of which way to bold. The bold follows the gradual one of slope x/y and y/x. LCD_graph(*g, cs, ps, w, h, color, bgcolor) Plot the points from gType. Starting (code segment, page segment) allocate w and h for the graph use. (w should equal to “desired x-axis width” + 10, y should equal to “desired y-axis width” + 10) and fill the line with color and bgcolor for the background LCD_arc(cs, ps, ra, op, color) Draw a circular arc from (code segment, page segment) with radius ra along the quadrant I, II, III, and IV (the op) with color. LCD_barc(cs, ps, ra, op, b, color) Draw bolded circular arc with LCD_arc(cs, ps, ra, op, color) and bold inward. LCD_char(cs, ps, char, size, color) Draw sized vector character at destination (code segment, page segment) with color. The font occupies size*7pix space. LCD_swatch() Draw the swatch-like screen of a full screen size. It was originally coded for color-picking, although the controlling interface was not finished. Now it’s used as background for UART character drawing. LCD_str(cs, ps, *char[], align, size, color) Draw string of characters at (code segment, page segment) with assigned color. The font occupies size*7pix space. Align: 0=Left 1=Right LCDinit() Initialization function for the LCD display. draw_char() Draw Char is the custom function for the UART character drawing. It demonstrates the vector fonts with different size of 1,3,5,7. Main Loop: At the beginning of the main loop, it checks for the FIFO of UART to see if there’s any data left. If so, it will draw the characters. After drawing out all the characters in FIFO, it will then proceeds to the time checker. The codes inside the time checker will only be active every *set* time. In this case it is set to 1 second. Hence, the bottom panel (the real time seconds and the real time temperature) of the Screen will be redrawn every 1 second. With in this time checker, there’s another time checker made for temperature and time sampling. It will only be sampled by the *set* time and adds the new coordinate into the gType as well as redrawing the Temperature vs. Time graph. the control signals are also verified in the same period. If the Program One is active (prog1 = 1), it is set to follow a general heating curve. In Program One the first period is the pre-heat region, which is set to follow a heating slope of (prog1t1 / prog1p1) slope. Once reaching over the designated period, it enters the second period of soaking zone which is a plateau of *prog1t2* Celsius of * prog1p2* seconds. The third phase (Re-Flow) is a simple heat up to * prog1t3* Celsius and then it will be off right after reaching the peak. After the time-specific codes are being processed, the dsPIC will start to de-bounce the switches. Every button has its corresponding signal and value. Once the button is being pressed and held, such value with stay 1 as long as the button is being pressed. Multiple buttons can be held at the same time and all the corresponding value will all turn high. However, the button event (falling edge of the first button press) can only be triggered when no button is being pressed. (only the first one will be detected, all following button press are ignored if multiple buttons are pressed) Currently, the Program One start event is set to Button 3. The Oven Light and Heat Lamp are connected to the corresponding value of Button 1 and Button 2. And this means they can be turned on by manual over-riding (pressing Button 1 or Button 2) simultaneously. However, only one button event will be detected and only for once. The AC Power Module IC1=LM317, IC2=Toshiba ULN2803A, C1=1000micro-Ferid Relays=P&B T77S1D10-05 x 2 The secondary voltage after the transformer is +18.5V, 0V, and -18.5V (With nothing connected) Since only the +18.5V and 0V are used, I decided to put the graph with only 1 secondary part. The actual Voltage if the + ends up 14V. The DC Power Module for the Proto-Board (dsPic, MAX6675, LCD, optocoupler, and some others). Both IC1 and IC2 are attached with a large size heat-sink. All ICs are LM317. R1 needs to have a higher Watt. (5 W or above) The Main Schematics (the Proto-Board) (All LEDs and Miscellaneous stuff are not shown.) IC1=dsPIC30F4013, IC2=MAX6675, OK1=OK2=MCT2 MAX6675 could not be found, hence using a MAX543 in place …. The actual Pin configuration should be as follow: MAX6675 GND 1 8 NC V+ 2 7 Serial Data V3 6 Chip Select Vpower 4 5 Serial Clock The Zener Diodes are used to create 1.5 V drop across the 5 V logic to fit for the 3.3V LCD Logic Input Level.