College of Sciences Bachelor of Engineering Technology 216.323 Final Year Project
Hardware Draft
1 | Page
Table of Contents 1.0
OVERVIEW..................................................................................................3
2.0
LED INDICATORS..........................................................................................4
3.0
RS-232 PORTS.............................................................................................6
4.0
SWITCHES..................................................................................................7
5.0
UP/DOWN CONVERTERS................................................................................8
6.0
MICROCONTROLLER.....................................................................................9
7.0
POWER SUPPLY.........................................................................................10
8.0
DRAFT CIRCUIT..........................................................................................11
2 | Page
1.0
OVERVIEW
This document outlines a detailed draft plan of the Serial Multiplexer Device. From a hardware perspective, the device requires: -
1 x power supply (~5V);
-
4 x RS-232 ports;
-
1 x microcontroller (C8051F020 has been decided);
-
2 x Up/down conversion chips for RS-232/TTL conversion;
-
8 x LEDS (4 ok, and 4 error for each port);
-
2 x 3 pin switches (to change baud rate).
Below is a functional flow diagram of how the hardware will interact (Figure 1).
Figure 1 – Function diagram
This document will now outline each of the components shown in the diagram above in detail, and present a final draft schematic at the end. 3 | Page
2.0
LED INDICATORS
Each IO port on the device will have two LED’s associated with it. These are used to visually show that the port is either operating or idle. One will be green, and the other will be red. They will all be 3mm, to keep the lighting at a minimum. These will be driven by the microcontroller via transistors (to limit the drain on the microcontroller). Note that the microcontroller can handle a 100mA output on one pin, and 50mA on any addition pins. The BC337is an NPN Epitaxial Silicon Transistor, commonly used for switching and amplifier applications. Its base emitter on voltage is 1.2V, which will work fine with the microcontroller’s logic high/low values. The LED’s will operate at 20mA. The calculations for the components are: R = Vs – Vd / I Where: Vs = Supply voltage Vd = LED voltage R = Resistor size R = 5 – 1.7V (typical) / 20mA R = 165 ohms (ideal) R = 150 ohms (closest value)
4 | Page
No protection is required between the transistor and microcontroller pin, because the F020 has internal protection. Below is a circuit diagram of the LED component (Figure 2).
VCC (5V)
LED
R 150
BC337
F020 IO pin
GND Figure 2 – LED component
Total cost for these components is approximately $5.00 (for a one off prototype). 5 | Page
3.0
RS-232 PORTS
The four RS-232 ports are the critical link between the SMD microcontroller and the external peripherals that are sending the serial data. Below is a diagram of a typical RS-232 D type connector (Figure 3). Only three of the pins need to be used because there will be no hardware level handshaking between communicating devices.
Figure 3 – RS-232 connection (techpubs.sgi.com)
The pins to be used are: -
Pin 3, Rx;
-
Pin 2, Tx;
-
Pin 6, GND.
The IO pins will be connected to the cross-bar configured ports of the microcontroller (more on this later), and the ground pin will go straight to ground. Total cost for these components is approximately $4.00 (for a one off prototype). 6 | Page
4.0
SWITCHES
The switches will be used to change the communication baud rate between the SMD and GPS, and also the SMD and weather station. The switches have three pins, and two states. One pin will be connected to 5V. The other two will be connected to two microcontroller IO pins. Each pin will indicate a baud rate, if a particular pin goes high, then its respective baud rate will be set. There will also be a switch, open by default, that when pressed (driven low) will cause the chip to reset.
7 | Page
5.0
UP/DOWN CONVERTERS
Because the microcontroller only accepts TTL signals (pins are 5V tolerant), RS-232 signals need to be scaled down so the pins are not overloaded. The standard was of doing this is using a MAX-232 (Figure 4). This is a chip which belongs to the Maxim family of line drivers/receivers, and is intended for all EIA/TIA232E and V.28/V.24 communication interfaces, particularly applications where +/-12V is not available. The MAX232 requires five 0.1uF capacitors to work. These capacitors are required to be polarised. The Tx and Rx pins of the RS-232 ports will be directly connected to their respective pins of the MAX232.
Figure 4 – MAX232 pin outs
8 | Page
6.0
MICROCONTROLLER
The microcontroller 64 general purpose IO pins. The chips internal digital crossbar must be configured to allow use of the hardware UARTS. The UARTS require preset IO pins. The reset switch must be open circuit by default (active high). Below is a pin out diagram of the microcontroller (Figure 5).
100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76
DAC0 DAC1 P4.0 P4.1 P4.2 P4.3 P4.4 ALE/P4.5 /RD/P4.6 /WR/P4.7 VDD DGND A8/P5.0 A9/P5.1 A10/P5.2 A11/P5.3 A12/P5.4 A13/P5.5 A14/P5.6 A15/P5.7 A8M/A0/P6.0 A9M/A1/P6.1 A10M/A2/P6.2 A11M/A3/P6.3 A12M/A4/P6.4
2.7/3.6V GND
C8051F020
75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
A13M/A5/P6.5 A14M/A6/P6.6 A15M/A7/P6.7 AD0/D0/P7.0 AD1/D1/P7.1 AD2/D2/P7.2 AD3/D3/P7.3 AD4/D4/P7.4 AD5/D5/P7.5 AD6/D6/P7.6 AD7/D7/P7.7 VDD DGND P0.0 P0.1 P0.2 P0.3 P0.4 ALE/P0.5 /RD/P0.6 /WR/P0.7 AD0/D0/P3.0 AD1/D1/P3.1 AD2/D2/P3.2 AD3/D3/P3.3
GLED0 GLED1 GLED2 GLED3 RLED0 RLED1 RLED2 RLED3 2.7/3.6V GND TX0 RX0 TX2 RX2 TX1 TX3 RX3 Baud Switch 1 Baud Switch 2
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
XTAL1 XTAL2 MONEN AIN1.7/A15/P1.7 AIN1.6/A14/P1.6 AIN1.5/A13/P1.5 AIN1.4/A12/P1.4 AIN1.3/A11/P1.3 AIN1.2/A10/P1.2 AIN1.1/A9/P1.1 AIN1.0/A8/P1.0 VDD DGND A15M/A7/P2.7 A14M/A6/P2.6 A13M/A5/P2.5 A12M/A4/P2.4 A11M/A3/P2.3 A10M/A2/P2.2 A9M/A1/P2.1 A8M/A0/P2.0 AD7/D7/P3.7/IE7 AD6/D6/P3.6/IE6 AD5/D5/P3.5 AD4/D4/P3.4
Reset Switch
TMS TCK TDI TDO /RST CP1CP1+ CP0CP0+ AGND AV+ VREF AGND AV+ VREFD VREF0 VREF1 AIN0.0 AIN0.1 AIN0.2 AIN0.3 AIN0.4 AIN0.5 AIN0.6 AIN0.7
RX1 2.7/3.6V GND
Figure 5 – C8051F020 pin outs
9 | Page
7.0
POWER SUPPLY
It is important for the power supply to be reliable.
The SMD will be operating in
electrical noisy environments for long periods of time. Below is the schematic diagram of the power supply that will be used (Figure 6). The design is a full-wave bridge rectifier. A 1A fuse has been added to protect from any current spikes. To limit the effects of any brownouts, the input voltage has been slightly increased from the standard 12V, to 15V. A large 2000uF smoothing capacitor will effectively act as a short term UPS. The smoothed waveform will then be regulated by a 7805 voltage regulator, which will result in a 5V output. The 5V will then be run through a voltage divider. The final output from the power supply will be approximately 3V (after voltage divider) and 5V (before voltage divider). The transformer will require a turn ratio of 5000/312, to output a voltage of 15V. The voltage regulator has a line peak current of 2A, which is more than enough to power the microcontroller, line drivers/receivers and associated LEDs.
7805 Vin
R1
Vout GND
6.8K
4 x IN4004 240/15V
1A C1 2000uF
C2 0.1uF
C3 0.1uF
R2 10K
GND
Figure 6 – Power supply
10 | P a g e
8.0
DRAFT CIRCUIT
A full size circuit diagram can be found at http://www.wellingtonrowing.org.nz/project/circuit.bmp
11 | P a g e