Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Interfacing with C plus plus-programing communication with microcontrolers (K. Bentley, 2006)

.pdf
Скачиваний:
192
Добавлен:
12.08.2013
Размер:
3.18 Mб
Скачать

468 APPENDIX A - HARDWARE

measured using the ADC (or the VCO if its transfer function has been measured).

ii)NiCad Battery Charger - fit the battery across terminal block J4 with correct polarity and charge with an appropriate level of current for a suitable period of time (or until the battery has been charged to the required voltage).

iii)Transistor or Diode tester (plot characteristic curve) - connect the component being tested to terminal block J4 with correct polarity. Then control the current through the device while measuring the voltage generated across it.

To test this circuit, fit the resistors across each terminal block – try using a 390: resistor for Rcurr and a 470 : resistor across terminal block J4.

First test the voltage at both op-amp power supply pins (U11 and U9, pin 8). The voltage should be approximately +12V when using a +12V powerpack or +12V power supply. The negative voltage supply pins (U11 and U9, pin 4) should be approximately –8V.

Connect either 0V or +5V as the input voltage Vin Curr (described above using VDAC) and move through each stage, testing the input voltage and then the corresponding output voltage of that stage. Note that the op-amp +ve and –ve input terminals will be at the same voltage (within a few microvolts) if the op-amp is functioning properly.

Remembering that effectively zero current passes through the op-amp –ve input (and +ve input), the current through Rcurr will flow down and branch into the emitter of darlington transistor Q9. Zero volts connected to Vin Curr will generate 4V across Rcurr (390 :) and produce a current through Rcurr of approximately 10mA. Nearly all of this current will flow down through terminal block J4 (470 :) to generate slightly less than 4.7V across it. The very small amount of current that does not pass through the terminal block (470 :) passes through the emitter of the darlington transistor Q9 to the output of op-amp U9A. This current is used to drive the emitter voltage to match that voltage present on the op-amp +ve input pin.

If any faults are detected, check:

+12V power supply, -8V power supply (9V battery), incorrect IC and transistor orientation, incorrect components, faulty soldering, shortcircuits, open-circuits, faulty IC socket connections or faulty components.

Voltage Buffer Circuit (High Current)

Assembly

Fit and solder all the components listed in Table A-11 into their position as marked on the pcb overlay and as shown in Figure A-28 and Figure A-29.

APPENDIX A - HARDWARE 469

Table A-11 Voltage Buffer (High Current) - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

1

10K resistor

¼ W

R23

1

BD649 npn darlington transistor (or

TO-220

Q7

 

equivalent)

 

 

1

LM358 IC

DIL8

U9

1

IC socket

8 pin

 

1

Heatsink 12θC/W

 

HS3

2

Pcb pin, 0.9 - 1.0 mm diameter

 

 

1M3 screw 6-10 mm long (or equivalent)

1

M3 nut

1

M3 locking washer

Testing

Figure A-32 shows the schematic for the voltage buffer circuitry.

Figure A-32 Voltage Buffer Circuit (High Current) - schematic diagram.

This circuit takes an input voltage signal having low current drive capacity (say a few milliamps) and produces a matching output voltage capable of providing up to 0.5A of current.

The circuit uses op-amp U9B to drive an npn darlington transistor (Q7) such that the emitter (shown with an arrow) voltage matches the input voltage at the +ve input terminal. Resistor R23 is used to generate the feedback voltage and allow proper circuit operation. The op-amp automatically adjusts the drive current to the transistor to maintain a constant output voltage as changes in current draw take place at the output.

First test the voltage at both op-amp power supply pins. These voltages should be approximately +12V (pin 8) and approximately –8V (pin 4). Connect a resistive

470 APPENDIX A - HARDWARE

load (say a 100: resistor) across the output pin (VADJ) to GND. With the input voltage Vin at 0V, the output voltage VADJ should also be at 0V. Apply fixed DC voltages (up to a maximum of +5V) to the input, Vin. The output voltage (VADJ) should match the input voltage being applied. The Potentiometer is ideal for generating various voltages up to +5V.

Note: op-amp U9 uses the –8V power supply. Therefore, ensure the components listed in Table A-5 that make up the –8V supply are fitted, and a usable 9V battery is connected.

If any faults are detected, check:

+12V power supply and –8V power supply (9V battery), incorrect IC and transistor orientation, faulty soldering, short-circuits, open-circuits, faulty IC socket connections, and faulty components.

Charge/Discharge RC Circuit

Assembly

Fit and solder all the components listed in Table A-12 into their position as marked on the pcb overlay and as shown in Figure A-28 and Figure A-29.

Table A-12 Charge/Discharge RC Circuit - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

1

1ΠF, τ 16V tantalum electrolitic capacitor

0.2 inch

C15

2

4K7 resistor

¼ W

R36, 37

1

100K resistor

¼ W

R12

1

470K resistor

¼ W

R38

1

BC547 npn transistor

TO-92

Q3

1

BC557 pnp transistor

TO-92

Q12

3

Pcb pin, 0.9 - 1.0 mm diameter

 

 

This circuitry is shown in Figure A-33 and is used to demonstrate the charging/discharging characteristics of a resistor/capacitor (RC) circuit. The ADC circuit can digitise the output signal produced by this circuit and then a waveform can be plotted.

Charging takes place when the /Charge input signal is activated by driving it from a high logic level to a low logic level while the Discharge input signal is kept inactive at low logic level. The voltage across capacitor C15 will increase during the charging process. The pnp transistor (Q12) controlled by /Charge, conducts when its base terminal (connected to R36) voltage drops at least approximately 0.7V lower than the emitter terminal (shown with an arrow). This allows current to flow through charging resistor R12 and charge up capacitor C15 to +5V.

APPENDIX A - HARDWARE 471

Testing

Figure A-33 Charge/Discharge RC Circuit - schematic diagram.

The npn transistor (Q3) is controlled by Discharge and will only conduct when its base terminal is at a voltage at least approximately 0.7V above its emitter terminal (connected to GND).

Discharging occurs when the /Charge input is driven to its inactive state (> 4.3V ensuring transistor Q12 will not conduct) and the Discharge input signal is activated using a logic-HIGH level. This causes transistor Q3 to conduct and allow charge stored on the capacitor to flow as a current through the discharge resistor (R38) and transistor (Q3) to GND. The voltage across the capacitor (C15) will drop to zero volts by the end of this process. Note that the discharge resistor (R38) is approximately five times the resistance value of the charge resistor (R12), producing different charge and discharge time constants (see Figure 13-6).

First test the voltage at the charge transistor (Q12) emitter pin (connected to the thick track on the pcb) - it should be equal to +5V. If not so, check:

+5V power supply, incorrect transistor or capacitor orientation, faulty soldering, short-circuits, open-circuits, and faulty components.

Connect the /Charge and Discharge inputs as described above and observe circuit function. If the output voltages are not as described, check:

Incorrect transistor or capacitor orientation, faulty soldering, shortcircuits, open-circuits, and faulty components and/or drive signals used for /Charge and Discharge inputs that cannot supply the required voltages.

LED and Photodiode/Phototransistor Pair Circuit

Assembly

Fit and solder all the components listed in Table A-13 into their position as marked on the pcb overlay and as shown in Figure A-28 and Figure A-29.

472 APPENDIX A - HARDWARE

Table A-13 LED and Photodiode/Phototransistor Pair - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

1

0.1ΠF ceramic monolithic capacitor

0.2 inch

C21

2

150: resistor

¼ W

R14, 54

2

LED (red or infrared)

 

LED9, 10

1

Photodiode (suit type of LED)

 

D9

1

Phototransistor (suit type of LED)

 

Q11

1

4093 CMOS IC

DIL14

U5

1

IC socket

14 pin

U5

2

2 way terminal block

5 mm pitch

J3, 15

4

Pcb pin, 0.9 - 1.0 mm diameter

 

 

Testing

Figure A-34 shows the schematic for the circuirtry associated with the LED and photodiode/phototransistor pair. These circuits can be used to measure light level, as proximity sensors, for optical communication and for detecting rotational and linear position/speed.

Fit appropriate value resistors across terminal blocks J3 and J15 to bias (allow desired operation) the photodetectors, being either photodiodes or phototransistors. The value of these resistors will need to be determined through repeated trials. Note that the phototransistor can be replaced by a second photodiode. Try increasing resistor values by powers of ten, starting from 100R. Then fine tune for the most suitable value.

Figure A-34 LED and Photodiode/Phototransistor Pair - schematic diagram.

First, test the supply voltage VCC (+5V) at all four resistors. If the voltage is not correct, check:

+5V power supply, faulty soldering, short-circuits, open-circuits and faulty components.

Test the photo-response of the two photo-transceiver pairs by directing the LED light sources at the photo-detectors and observing the voltage increase at their pcb

APPENDIX A - HARDWARE 473

pin terminals as the light is blocked. Note that infra-red light is not blocked by paper. If these tests fail, check:

incorrect LED or photodetector orientation, faulty soldering, shortcircuits, open-circuits and faulty components.

The NAND gates (NOT AND) are used to produce digital signals from the analog voltages generated by the photodetectors. They have in-built hysteresis indicated by the symbol inside their outline. This hysteresis prevents the NAND gate output fluctuating with small changes of light level.

Switch Interface, Potentiometer, Diode, Zener Diode

and Transistor Circuits

Assembly

Fit and solder all the components listed in Table A-14 into their position as marked on the pcb overlay and as shown in Figure A-28 and Figure A-29.

Table A-14 Switch Interface, Potentiometer, Diode, Zener Diode

and Transistor Circuits - Bill of Materials.

 

 

Lead Spacing

 

Quantity

Component Description

or Footprint

Designator

Switch Interface:

 

 

1

2K7 resistor

¼ W

R8

1

SPST normally open keyboard pushbutton

5 mm pitch

SW1

 

switch (or equivalent)

 

 

1

Pcb pin, 0.9 - 1.0 mm diameter

 

 

Potentiometer:

 

 

1

Knob for potentiometer

 

 

1

1K 16 mm potentiometer

0.2W

POT1

1

Pcb pin, 0.9 - 1.0 mm diameter

 

 

1

Fabricate POT right angle support bracket

 

 

Semiconductor circuits:

 

 

2

1K resistor

¼ W

R32, 33

1

Resistor (test with a range of values, from

¼ W

R42

 

100: to 10K)

 

 

1

1N4148 diode

 

D4

1

3V3 zener diode

1W

ZD3

1

BC547 npn transistor

TO-92

Q4

6

Pcb pin, 0.9 - 1.0 mm diameter

 

 

474 APPENDIX A - HARDWARE

Testing

Figure A-35 shows the schematic for the switch interface, potentiometer, diode, zener diode, and transistor circuitry.

Switch Interface:

When the switch is open the output will be low. Conversely, when the switch is closed the output will be high.

If the switch interface circuit does not function correctly, check:

Faulty soldering, short-circuits, open-circuits, incorrect switch orientation, and faulty components.

Note: This switch circuit will need to be altered if it is to interface with TTL logic devices. TTL logic circuits require much greater current flow in and out of their input pins than do CMOS circuits. Should you use this circuit with TTL devices, lower the value of resistor R8 to approximately 330:.

Figure A-35 Switch Interface, Potentiometer, Diode, Zener Diode, and Transistor Circuits - schematic diagram.

Potentiometer:

Ensure that the wiper terminal of the potentiometer is not connected to another circuit. As the knob of the potentiometer is rotated through its range, the output of its wiper terminal should produce voltages ranging from 0V to +5V.

APPENDIX A - HARDWARE 475

Semiconductor circuits:

These circuits are used to observe the electrical characteristics of diodes, zener diodes, and bipolar transistors.

Diode D4 is driven by either an adjustable voltage source or current source while the voltage at its anode is measured to observe its basic electrical characteristics.

Zener diode ZD3 is also driven by an adjustable voltage source or current source while the voltage at its anode is measured to observe its basic electrical characteristics.

Bipolar npn transistor Q4 is driven by the adjustable current source (0 to 1mA using Rcurr at 3K9) while the voltage at its base (B) and collector (C) are measured to observe basic electrical characteristics. It can also be driven by a voltage source using a series connected resistor placed between the voltage source and the base pin.

Two sockets from an IC socket strip can be used to provide a socket at each end of resistor R42. This will ease the process of trialling different values of this resistor.

Note: the adjustable current source can be controlled using the output of the potentiometer POT1 connected to the input of the adjustable current source (Vin Curr).

476 APPENDIX A - HARDWARE

Interface Board Bill of Materials

 

 

Lead Spacing

PCB

Quantity

Component Description

or Footprint

Designator

1

150 pF ceramic capacitor

0.2 inch

C17

1

10 nF ceramic monolithic capacitor

0.2 inch

C16

14

0.1ΠF ceramic monolithic capacitor

0.2 inch

C2-11, 19-23

1

1ΠF ceramic monolithic capacitor

0.2 inch

C18

3

1ΠF, τ 16V tantalum electrolitic capacitor

0.2 inch

C13-15

1

4700 ΠF, τ16V electrolytic capacitor

RB 0.5 or

C1

 

 

0.35 inch

 

1

100 : resistor

¼ W

R69

2

150: resistor

¼ W

R14, 54

8

330: resistor

¼ W

R1,...,R10 not incl.

4

470 : resistor

¼ W

R29, 30, 43, 44

3

1K resistor

¼ W

R32, 33, 94

1

1K8 resistor

¼ W

R52

1

2K7 resistor

¼ W

R8

1

3K resistor

¼ W

R67

6

4K7 resistor

¼ W

R34-37, 51, 53

59

10K resistor

¼ W

R9, 15-17, 18-21, 23-

 

 

 

28, 39-41, 45-50, 55-

 

 

 

66, 70-93

1

12K resistor

¼ W

R68

1

20K resistor

¼ W

R22

2

100K resistor

¼ W

R11, 12

1

470K resistor

¼ W

R38

1

1M resistor

¼ W

R13

1

100K to 470K resistor (suit thermistor)

 

R31

1

resistor (range of values, say 100: to 10K)

¼ W

R42

1

1K 16 mm potentiometer

0.2W

POT1

1

Knob for potentiometer

 

 

1

Thermistor

 

RT1

1

1N4148 diode

 

D4

12

1N4004 diode

 

D1-3, 5-8, 10-14

1

3V3 zener diode

1W

ZD3

4

24V zener diode

1W

ZD1, 2, 4, 5

8

Red LED 3mm

 

LED1-8

2

LED (red or infrared)

 

LED9, 10

1

Photodiode (suit type of LED)

 

D9

1

Phototransistor (suit type of LED)

 

Q11

6

BC547 npn transistor

TO-92

Q1-4, 13, 14

APPENDIX A - HARDWARE 477

1

BC557 pnp transistor

TO-92

Q12

5

BD649 npn darlington transistor (or equivalent)

TO-220

Q5-7, 15, 16

5

BD650 pnp darlington transistor (or equivalent)

TO-220

Q8-10, 17, 18

 

 

 

 

1

4046 CMOS IC

DIL16

U4

1

4093 CMOS IC

DIL14

U5

1

74HC157 CMOS IC

DIL16

U12

2

74HC245 CMOS IC

DIL20

U6, 13

1

DAC0800 CMOS IC

DIL16

U8

3

LM358 IC

DIL8

U9, 10, 11

1

ADC0804 CMOS IC

DIL20

U7

1

LM7805CT

TO-220

U1

1

LM7809CT

TO-220

U2

1

ULN2803A transistor array

DIL18

U3

 

 

 

 

3

IC socket

20 pin

 

1

IC socket

18 pin

 

3

IC socket

16 pin

 

2

IC socket

14 pin

 

3

IC socket

8 pin

 

2

2 pin header

0.1 inch

LINK1, LINK2

1

Jumper (across header)

0.1 inch

LINK1 or LINK2

12

2 way terminal block

5mm pitch

J2-4, 7-10, 12-16

2

4 way terminal block

5 mm pitch

J6, 11

1

9V battery clip

 

 

1

SPST normally open keyboard pushbutton switch

5 mm pitch

SW1

 

(or similar)

 

 

1

D25 female right angle connector

 

J1

1

D25 Male to D25 Male, one to one cable

 

 

50

Pcb pin socket, suit pin 0.9 – 1.0 mm

 

 

111

Pcb pin, 0.9 - 1.0 mm diameter

 

 

7 m

Hookup wire (for interconnect cables)

 

 

1m

Heatshrink tubing, 2.5 - 3 mm diameter

 

 

4

Heatsink 12θC/W

 

HS1-4

8

Heatsink 20θC/W

 

HS5-12

1

Heatsink paste

 

 

12M3 screw 6-10 mm long (or equivalent), nut, locking washer

4 Pcb rubber stick-on feet

1 Power pack; +12V DC, 1A

1 Fabricated right angle support bracket (POT)