Computerized Reflow Oven

advertisement
Reflow Oven
Yutun Tseng
Dec 12, 2007
Goal:
The goal of this project was to refine the design from previous semester of Reflow
Oven. It will focus on enhancing the performance for the dsPIC, the transmission speed
and stability for the LCD 9-bit SPI, and the issue I had from the AC Power part.
Introduction:
I decided to focus on enhancement of the LCD transmission protocol first. I have
gone through various methods and made many attempts to speed up the non-standard SPI
transmission. However, most of the attempts failed and forced me to build a transceiver
myself. Then I started to simplify the code to increase the performance on the controlling
unit so that it utilizes the 9-bit transceiver and waste no time on it. The last part of this
project was to solve the issue of LCD resetting and creating a board for the whole
circuitry.
This project was originally going on-board. However, due to the complex
connections for transceiver, the resulting board had too many vias which made it really
hard to solder each via one by one. And a better board design should definitely be used in
the future.
Main Descriptions: (Hardware + brief overall description)
Main components:
The Main Control Unit
Temperature Sensor
AC/DC Power Compartment
LCD and the Multi-Bit(1-16bit) Transceiver
The Main Control Unit:
-The main control unit is composed of one dsPic30F3014 chip and some buttons.
dsPIC30F3014
Reference:http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335
&dDocName=en010344
-The heart of this reflow project. All control signals are generated by the dsPIC.
-It is configured to run at 120MHz (30MHz due to 4 instructions/cycle).
The control unit started off consuming a lot of current due to the fact that it was using external clock.
After making several tries, the configuration using internal oscillator and 16x PLL seems to work the best
and runs at 120MHz. However, the program inside was not quite optimized and has a lot of redundant code
segments. And also, due to the fact of using General Purpose I/Os to manipulate the transmission between
LCD and dsPIC, the control unit wasted most of its time on setting the signals rather than actual work.
Hence, after the new 9-Bit Parallel Load Transceiver was built, some parts of the program was
rewritten to accommodate the change and to increase its performance. Due to the new transceiver, the
program now can run at around 10 times faster than what it was. And this allows better response to buttons
and temperature readings.
The control unit now connects to the converter for the thermocouple, the new 9-bit transceiver, the
relays for oven lights/heater, and five buttons. The most apparent change on the control unit interface is that
it no longer connects to the LCD directly and no longer inputs from the external clock. One other important
change made on control unit was to take off the UART debugging codes.
The program functions’ functionalities and their inputs/outputs remained unchanged. However, a lot
of the lower level functions are re-written to enhance its performance so that it does not waste any time for
waiting for the completion of the LCD transmission. The Interrupts Priority are also reordered and
simplified to ensure that there are no long Interrupts which used to cause the control unit to miss important
update or missing transmission data.
Temperature Sensor:
-The main control unit is composed of one dsPic30F3014 chip and some buttons.
Type-K Thermocouple
(SparksFun Electronics: http://www.sparkfun.com/commerce/product_info.php?products_id=251)
-It is capable of detecting temperature from -270 to 1372 degree Celsius.
-With glass braid insulation, it’s range is -73 to 260 degree Celsius.
Digital Thermocouple Amplifier MAX6675
(Datashee: http://www.sparkfun.com/datasheets/IC/MAX6675.pdf)
The MAX6675 A/D converter uses the 16-bit Serial Peripheral Interface to communicate with the
dsPic control unit. 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. However, the data is accessible at all time that if
the conversion unit is still running, it will simply send off the older set of data.
In the current dsPIC configuration, the data is obtained by the timer module once every second.
The converted result of MAX6675 is in the range from 0 to 4095 which maps into the range of 0~1024
Celsius. Hence, after some data manipulation, the value is good to be used and stored. The lower two bit
representing quarter of a degree Celsius is simply ignored by the control unit for optimal performance.
AC/DC Power Compartment:
-It takes 110~120V 50~60Hz alternating current.
-It is composed of one transformer and 5 LM317.
-It generates a ~14 VDC initially, and then provides 3 VDC, 5 VDC, and 6~7 VDC afterward.
OptoCoupler (MCT2 x2)
(Home Http: http://www.ortodoxism.ro/datasheets/fairchild/MCT2.pdf)
The Optocouplers were not correctly used in the previous design. It was used in a way that it
provides no benefits due to erroneous ground connections. This issue was resolved in the later design so
that the relays are isolated from the control unit in case there are any odd feed-back from relay due to
mechanical switch.
P&B T77S1D10-05 Relays x2
(Datasheet: http://catalog.tycoelectronics.com/TE/bin/TE.Connect?C=1&M=BYPN&PN=T77S1D10-05)
Relays are used for switching the Oven Light and Heat-Lamp. The Heat-Lamp draws around
10~11 Amps while the Light draws 1 or so. There is an extra chip used to provide extra current for the relay
due to its switching characteristic of 50mA. (The control unit can only provide 20mA. Further more, if it is
provided by the control unit, it will not be isolated.)
LM317 3-Terminal Adjustable Regulator x5
(Datasheet: http://www.angelfire.com/electronic/hayles/downloads/lm317.pdf)
The LM317’s configuration remained the same in this project. The DC Power Module.
Both IC1 and IC2 need a large size heat-sink.
All ICs are LM317.
R1 needs a high Wattage Rating.
LCD and the Multi-Bit(1-16bit) Transceiver:
-The LCD is a Nokia Knock-Off using Epson Controller.
-The final version of the Multi-Bit Transceiver is composed of many 7400 chips.
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 Peripheral Interface.
-It is capable running 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)
-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.
The LCD is now connected to the buffered output of the Multi-bit (9-bit) Transceiver. Between the
connection with the Buffer, there are two Zener Diode placed in reverse direction. The two Zener Diodes
are used to drop the Output Logic Level after the Buffer from 5 VDC to 3.3 VDC.
Multi-Bit (1-16bit) Parallel-Load Serial Peripheral Interface Transceiver
-It is composed one clock input and 16 parallel input and a set signal.
-It runs at half the speed of the clock input.
-The Chip-Select for SPI interface is automatically generated by this transceiver
The transceiver uses two J-K flip-flops for clock manipulation and uses one J-K flip-flop to
generate the Chip-Select bit. Most of the inputs on the transceiver are after some logics and carefully
manipulated. Its design is not standard and uses gated clocks, delayed signals, chip enable/disable, and also
gated load signals. The main reason for such is that the Control Unit runs on its own 120MHz (30MHz
actual speed) and does not output any clock signal, which made it hard for the transceiver to synchronize
with the control unit. Hence, the transceiver had to take its own clock signal and uses asynchronous load
and reset from the control unit. In order to simplify the control signal output generation for the Control
Unit, I decided to make this transceiver take in only one signal. Upon receiving this one-clock active high
signal, the transceiver does an asynchronous Reset on its counting/transmission mechanism, and Loads the
parallel inputs to its registers. And then, right after that, the transceiver starts transferring its signals based
upon the clock input. The following is the schematic.
Two 8-bit parallel load shift registers were used. Each parallel load input is connected to the
corresponding bit in reverse order due to that SPI transmits the highest bit first and descends in order. The
lower shift register’s shift input is connected to the higher shift register. And the output of lower shift
register is connected to the output buffer chip. The buffer chip is used to ensure that signals are as nice as
they can be and to output better square waves so that when the transmission is running at its maximum
speed (20MHz), the LCD could still take the input.
There was also a four-bit counter implemented to limit the transmission length. When the
transmission length is reached, the logic control signal is then generated based on the output of the counter.
This control signal then disables the whole transceiver so that nothing more will be sent and the transceiver
will be in halting state.
The generated logic control signal is also used to generate the corresponding SPI clock. This
generated clock can be tweaked around by changing its generating logic to fit any form of clock. In this
project, an active low rising edge triggered clock is generated. (When the clock is high, the LCD takes in
no command. The LCD also requires the data to be steady before and after the rising edge.) The clock and
its proper edge position are generated by gate-delaying the clock signals from J-K flip-flop to its desired
place.
This Multi-Bit Parallel-Load Serial-Peripheral-Interface Transceiver I designed is capable of
sending different length with different speed. (For different bit-length: change the counter configuration.
For faster clock: change the clock input and adjust the delay on the clock/data/enable signal accordingly.)
Most importantly, it takes in very simple control signal and generates desired SPI interface transmission
and it is also capable of generating a feed-back signal for control unit. (In case of slow clock-input, so that
control unit will not overwrite its on-going transmission.)
The Transceiver
Other Failed SPI Transceiver Attempts
I have tried various attempts to speed up the SPI transmission. My First approach was to switch
back to use built-in SPI interface by using 16-bit SPI and sends 16 commands at once. This attempt failed
due to Interrupt Priority Issue which caused either missed transmissions or halts on transmission. This
approach was not much better even if it worked perfectly because it takes a lot of commands to bit-mask all
the bits and to manipulate 9-bit SPI from 16-bit. This could only achieve the speed of at most two times
faster due to the long code segments for bit-masking. (The transmission runs at full speed, yet takes a lot of
time to process what to send.)
My one other attempt was to use dsPic18 and use the extended 9-bit UART. There existed the
problem that UART’s bit-configuration is in reverse order of SPI. Hence, it is impossible to communicate
the dsPic18 with dsPic30 by SPI interface. The only possible way for this is to use parallel load and send
the data over to LCD with extended UART. However, this would require some code delay at the dsPic18
which is running a slower clock already.
As a result, the need to build a transceiver is apparent.
Third-Overtone Oscillator
I attempted to use Oscillators to be the source for clock input on transceiver. However there were
many implementation issues for building a third-overtone especially on the proto-board where weird
instances of capacitance and feed-backs are picked up from other components.
Third Overtone Implementation
Program Reference:
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.
Parallel-Load 9-bit SPI-Transceiver
Sets the lower 9 bit of LatB register and sends out a 1-bit active high signal for only 1 clock cycle
to set and load the new transceiver.
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.
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 character drawing. It demonstrates the vector fonts with
different size of 1,3,5,7. It is mainly used for debug purpose.
Download