<<

T-411-MECH Mechatronics 1

Lab 3: and

Authors: Instructors: Árni Þorvaldsson Joseph Timothy Foley Hannes Rúnar Herbertsson Björgvin Rúnar Þórhallson

November 22, 2012 Contents

1 Introduction 2 1.1 Background ...... 2 1.1.1 Diodes ...... 2 1.1.2 Transistors ...... 2 1.2 BJT properties ...... 3 1.3 MOSFET properties ...... 3

2 Material and Equipment 4

3 Procedure 5 3.1 rectication ...... 5 3.2 Bipolar Junction ...... 8 3.3 MOSFET ...... 9

4 Results and Discussion 10

5 Conclusion 14

A Appendix 16

1 1 Introduction

For Lab 3 the objective is to get familiar with various properties of like diodes and transistors. We will be using diodes to generate half and full bridge rectier. MOSFET,s and Bipolar Junction Transistors (BJT) will then be implemented as a . In the nal part of this exercise we will combine these properties with an Arduino microcontroller [4] and write a program that will vary a brightness of a Led with two buttons and a MOSFET. First button will decrease the brightness of the while the second button will increase the brightness of the LED.

1.1 Background The rst eect is recorded by Michael Faraday in 1833, while investigating silver sulde he noticed increased electrical conductivity with increased temperature which is the opposite of temperature eect on metals [6]. Semiconductors are the foundation of electric devices as we know them today. In this exercise we will be using Diodes, Transistors and which are all semiconducting devices.

1.1.1 Diodes Semiconductor device in its simplest form, allows current to ow only in one direction. No current ows through the diode when higher potential is at than , when reversed and higher potential is at anode than cathode the current ows.

1.1.2 Transistors Transistors is key component in all modern . Semiconductor devices replaced vacuum tubes in digital computers during the 1950s. In 1950s the rst transistor was made by chemist Morris Tanenbaum in 1954, Texas Instrument claimed credit for his breakthrough and started manufacturing silicon transistors [1]. The transistors BJT (Bipolar Junction Transistor) and MOSFET (Metal Oxide Semiconductor Field-Eect Transistor) can be used as a amplier or for switching applications, spite their dierence in characteristics. The dierence between the two is that the BJT is current controlled while the Mosfet is controlled.

Figure 1: Bipolar Junction Transistor with the three terminals, base, emitter and collector.

2 1.2 BJT properties The BJT is semi-conducting device and has three terminals emitter, base and collector. The three terminals are shown in Fig. 1. In Figure 2 is the dierence between NPN and PNP transistors shown for physical construction, as a two diode analogy and as a circuit symbol. The main dierence between NPN and PNP is the base voltage. For the NPN the base voltage needs to be 0.6V above the emitter voltage but the base voltage needs to be 0.6V below the emitter voltage for the PNP transistor [5].

Figure 2: (a) Shows the physical construction for the NPN and PNP transistors. (b) Shows the two diode analogy for NPN and PNP transistors (c) Shows the circuit symbol for the NPN and PNP transistors. [2]

1.3 MOSFET properties The metal oxide semiconductor eld eect transistor (MOSFET) is the second major type used in this exercise. The MOSFET has four terminals, drain, gate, source and one body terminal that is always connected to source (see Fig. 3). The MOSFET can either be a N-channel device or a P channel device as is shown in Fig. 4. The main dierence between them is that the N-channel MOSFET is turned on when the gate voltage is more positive than the source voltage while the P-channel MOSFET is turned on when the gate source is more negative than the source voltage [5].

Figure 3: Shows a MOSFET and the terminals Drain, Gate and Source [8].

3 Figure 4: Shows a MOSFET and the terminals Drain, Gate and Source [3].

2 Material and Equipment

In this section we sum up all material and equipment needed to perform this exercise. In Tables 1 and 2 can the components be seen that were used in this exercise. In Table 1 is the quantity for each component specied along with the size for the component. In Table 2 can we also see how many components are needed for each item along with their type number. Material that were not included in tables were , crocodile clips and a breadboard. Table 3 shows the devices that were used to perform the exercise.

Material Item Quantity Size 1 1kΩ Resistor 1 10kΩ 2 10µF Light Emitting Diode 9 Breadboard 1 Short solid core wires 10 leads 2

Table 1: Material used in this exercise.

Material Item Quantity Type number Diode 4 1N4148 P-type Mosfet 1 IRFD9110 N-type Mosfet 1 IRFD110 BJT 1 BC547 Reset switch 2 DIP A

Table 2: Material used in this exercise.

4 Equipment Device Serial number Laptop computer W894103B66J NI Elvis 12CCD4B Digital MultiMeter (DMM NI 77) 56802578 Arduino Uno 011RU94V-0

Table 3: Equipment used in this exercise. 3 Procedure

3.1 Diode rectication In gure 5 is shown the circuit for the half bridge rectier. In the circuit a diode is used as a rectier producing a half bridge rectier, with this we want to observe a DC voltage when the AC voltage is negative.

Figure 5: Diode-based circuit without capacitor, to obtain the half bridge rectier.

Figure 6: Here can be observed the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS.

5 Next step was to add a capacitor to the circuit by connecting the capacitor parallel to the resistor(see Fig.7) to convert AC to DC. With eq.1 we can determine the size of the capacitor for the 50Hz and the resistor R = 10kΩ. 1 τ = = RC (1) f The calculations were as follows:

τ = 20[ms] and

C = 20µF Since the 20µF capacitor was nowhere to be found in the electronics lab, therefore we needed to connect two 10µF parallel to the resistor (see Fig. 7) to obtain the 20µF capacitance. The connected circuit can be seen in Fig. 8 were all components are carefully marked.

Figure 7: The Diode-based circuit with capacitor, to convert AC to DC

Figure 8: Our half bridge rectier circuit.

6 The circuit that was used to build the full bridge rectier can be seen in Fig. 9. In the circuit we connect the four diodes together in a closed loop, forming a bridge. The circuit has two diodes connected in series to form a bridge for the positive output voltage. The other two diodes are also connected together in series forming a positive bridge from the negative output voltage, this and the expected result can be seen in Fig 10.

Figure 9: The full bridge rectier, Multisim drawing. Magnitude on Y-axis and time in seconds on X-axis.

Figure 10: The full bridge rectier, using circuit and oscilloscope from Multisim.

7 3.2 Bipolar Junction Transistor In this section we connected the BJT(type BC547) circuit shown in Fig. 11 by using the

Rb=10kΩ and Rc=1kΩ. With this circuit, we can control the amount of current that ows through the BJT in proportion to the voltage over the base terminal and therefore acting as a switch. To practise this we controlled the input voltage using NI ELVIS to obtain the output voltage around 7V. Then a total of 9 measurements were made for both the input and output where the output voltage was varying from 2 to 12V.

Figure 11: The BJT circuit build in Multisim

8 3.3 MOSFET In this part of the project a switch was generated to control Light emitting diode (LED), Arduino is used as a gate on a N-type MOSFET, the 15V source voltage is connected from NI ELVIS. The circuit from Fig. 12 with P-type MOSFET was built and a blink program from Arduino example library was used to test the circuit. The circuit was then connected and a program written to vary the brightness of the LED by using two buttons that were used to control the brightness. Our circuit and pinout can be seen in Fig 13.

Figure 12: Here can be observed the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS.

Figure 13: Here can be observed the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS.

9 4 Results and Discussion

The function of the half bridge rectier can be observe in Fig. 14, there can be seen how the half bridge rectier blocks the negative output peak voltage and passes through the positive output peak voltage, therefore is the half bridge rectier converting the negative output to DC voltage while the positive output is AC voltage (see Fig. 14). By connecting the capacitor parallel to the resistor, a change is made to the output voltage. When the capacitor gets a pulse it charges until it reaches the peak voltage. Then the capacitor begins to discharge, when the next pulse hits the capacitor it starts charging again resulting a DC voltage (Fig. 15). The results of the DC voltage in Fig 15 is shifted and does not reach the peak value. This is due to resistor in the diode (diode 1N4148). By using the peak voltage values from Fig 15 we can calculate the inertia from the diode. The calculations are performed using eq.2.

V V = in − V (2) diode 2 out 2, 662[V ] V = − 0, 724[V ] diode 2 Vdiode = 0, 607V

For the 20ms period the output voltage is 0.113V (see Output voltage value in Fig. 16). The expeted result should be a DC voltage but we can still observe AC voltage from the input. This can be because the capacitor does not fully discharge before the capacitor gets the next pulse. In gure 17 we can see the full bridge rectier, were the negative input voltage is converted to positive output forming the full bridge rectier.

Figure 14: Here we can observe the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS. Magnitude on Y-axis and time in seconds on X-axis.

10 Figure 15: Here we can be observe the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS. Magnitude on Y-axis and time in seconds on X-axis.

Figure 16: Here we can be observe the input and output voltage of the full bridge rectier, using oscilloscope in NI ELVIS. Magnitude on Y-axis and time in seconds on X-axis.

Figure 17: Here can be observed the input and output voltage of the half bridge rectier, using oscilloscope in NI ELVIS. Magnitude on Y-axis and time in seconds on X-axis.

11 By changing the input in BJT circuit shown on Fig. 11 we can control the output voltage, to get the desired 7V voltage the input had to be 1.04V. Total of nine measurements were done on input resulting output voltage to vary from 2-12V and can be seen in table 4. From the measurements we could then calculate the eective current gain or β (eq.3 to 5) given that the BJT is in saturation (to calculate BJT not in saturation we would have to have done measurements on the current IBE). β as a function of input and output can be seen in Fig.18. To fulll the requirements for saturation β would have to be 10, emitter VCE = 0.2V and collector diode drop VBE = 0.6V [7]. Those requirements are not met since we are not getting β lower than 160, by changing the we could get closer to saturation.

Vin − VBE IB = (3) Rb

VCC − VCE IC = (4) Rc I β = CE (5) IBE

Vin [V] Vout [V] Beta ICE [mA] IBE[mA] 1.50 1.92 163.5 0.13 0.0131 1.40 3.00 171.4 0.12 0.0120 1.30 4.22 179.7 0.11 0.0108 1.20 5.523 189.6 0.10 0.0095 1.10 6.89 202.7 0.09 0.0081 1.00 8.26 224.3 0.08 0.0061 0.90 9.71 264.5 0.07 0.0053 0.80 11.18 316.0 0.06 0.0032 0.70 12.68 Inf 0.05 0.0023

Vout Table 4: Measured values for Vin, Vout and gain ( ) Vin

12 beta as a function of Vin 350

300

250 Beta

200

150 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 Vin

beta as a function of Vout 350

300

250 Beta

200

150 0 2 4 6 8 10 12 14 Vout

Figure 18: Plots of Beta for various Vin and Vout

For P-type MOSFET circuit (Fig. 12) we calculated the size of the resistor by ohms law (Eq. 6) to be greater than 300Ω to get current less than 50 mA running through the diode. To be safe we used 330 ohm resistor. Testing the P-type MOSFET circuit we found out that we did not control the LED, it lit up and did not go o. The reason for that is that the source voltage is too high and the gate could not reach that voltage to close the gate. To x that we can switch the source and gate terminals. In N-type MOSFET this is not a problem since the source is connected to the and the voltage dierence between gate and source is either 0 (open switch) or 5 volts (closed switch). For N-type MOSFET circuit we wrote an program on Arduino that controls the brightness of a LED by using two buttons, pseudo code of the loop can be seen in Fig. 19. We started out by using Fading example in Arduino but found that it can be implemented in much simpler way so we used button example to get them functional and then used two if sentences to change the brightness.

V = I ∗ R (6) To be able to control a single LED we used the Arduino and skipped the MOSFET. Then we used the MOSFET as a switch to be able to control multiple LED,s and to have more voltage source. The logic-level MOSFET,s works really good with the Arduino since the device is fully turned on when the gate to source voltage is at 4.5 V and the Arduino generates pulses either at 0V or 5V. It is simpler to use a MOSFET instead of a BJT to control the LED,s, since it is controlled by using voltage and not current like the BJT. Therefore it is not required to have a base resistor. After getting the brightness program to work with one LED we did experiment on how many LED,s we could lit up connected in series. Having 15V input voltage we could control 8 LED,s but when adding the 9th LED, all of LED,s shut down. A voltage drop measured in each LED was 1.82V, for the total of 8 LED,s the voltage drops about 14.66V. By adding the 9th LED the voltage required goes over the input voltage.

13 Algorithm 4.1: Brightness(brightness, buttonState, buttonState1)

if buttonState = HIGH and brightness <= 255 then brightness = brightness + 5 else if buttonState1 = HIGH and brightness > 0 then brightness = brightness − 5 delay(100)

Figure 19: LED brightness control. 5 Conclusion

In the Lab 3 exercise we learned about properties of semiconducting devices. Diodes were used to make half and full bridge rectier and the output versus input studied and compared to expected theoretical values. Transistors were used as a switch and dierence between BJT and MOSFET claried, by combining Arduino microcontroller with MOSFET we were able to con- trol brightness of a single LED and up to eight connected in series. For BJT a measurements were done on input voltage and output voltage for better understanding of BJT acting as a switch. Values for β ranged from 163.5 to 316.0 which is higher than requirements for satura- tion. Few more measurements would had to be done for calculating saturation of the transistor. To compensate, calculations on β were done given that saturation requirements were met. Objectives for diodes were met, by building a functional half- and full-bridge rectier. Ob- jectives were also met, by controlling a brightness of a LED. We had to compensate for BJT circuit since not all of required measurements were done. It is useful to know the behaviour of BJT and MOSFET since they are used in many electrical devices like controlling a LED or a motor.

14 References

[1] Engineer Today, May 2003. Available from: http://www.todaysengineer.org/2003/May/ history.asp.

[2] [online]oktober 2012. Available from: http://www.electronics-tutorials.ws/ transistor/tran_1.html.

[3] [online]oktober 2012. Available from: http://www.electrotechservices.com/ electronics/metal_oxide_semiconductor_fets.html.

[4] Arduino webpage, Oktober 2012. Available from: www.arduino.cc.

[5] J. E. Carryer, R. M. Ohline, and T. W. Kenny. Introduction to Mechatronic Design. Pearson Education, 2011.

[6] M. Faraday. Experimental Researches in Electricity, volume 1. London: Richard and John Edward Taylor, 1839.

[7] J. Foley. Lab 3:Diodes and Transistors Instruction Packet. Reykjavik University, rev 54 edition, September 2012. Available from: http://afs.dev.ru.is/course/T-411-MECH/ Public/lab3-instructions.pdf.

[8] V. Siliconix. Power . Technical report, March 2012. Available from: http://www. vishay.com/docs/91127/sihfd110.pdf.

15 A Appendix const int buttonPin = 2; const int buttonPin2 = 7; const int ledPin = 9; int stada=0;

// variables will change: int buttonState = 0; int buttonState2 = 0; void setup() { Serial.begin(9600); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); pinMode(buttonPin2, INPUT); } void loop(){ buttonState = digitalRead(buttonPin); buttonState2 = digitalRead(buttonPin2);

if(buttonState==HIGH && stada<255){ stada=stada+5; } if(buttonState2==HIGH && stada>=0){ stada=stada-5; } analogWrite(ledPin,stada); delay(100); Serial.println(stada);

}

16