GOAL PreLab 7: LED Blinker (Due Oct 30) The overall goal of Lab 7 is to demonstrate a two-led blinker with adjustable frequency. This is a two-week lab. The first week involves designing and testing a breadboard prototype. The second week involves soldering a take-home version of your LED blinker! INTRODUCTION Fig. 1: High brightness LED. Blinking LEDs have lots of applications. How to make them blink? A microcontroller (e.g. Arduino Uno) gives you the most flexibility. However, many situations are fine with a purely hardware-based approach that is more compact and doesn t require programming. A blinking LED needs some kind of an oscillator. The classic 555 timer chip is often what comes to mind and is a perfectly reasonable approach. In astable mode, the 555 timer is basically a relaxation oscillator, where the LTP and UTP are 1/3V CC and 2/3V CC, respectively. The oscillation frequency depends on the charging and discharging time of an external capacitor. In this lab, we will instead use an op amp to make a relaxation oscillator with adjustable frequency. In class, we discussed a relaxation oscillator with an op amp powered by SPLIT supplies (Fig. 2a). The capacitor voltage rises and falls between +V TH and V TH, while the oscillator output alternates between +V SAT and -V SAT. In this lab, we will make a SINGLE supply circuit for battery-powered operation. In particular, R1 is connected to a voltage reference V REF instead of ground (Fig. 2b). Furthermore, the op amp output is now V SAT(+) and V SAT(-) instead of +V SAT and V SAT. The generalized formulas for the relaxation oscillator are now: (Eq. 1) 2 (Eq. 2) (Eq. 3) (Eq. 4) Fig. 2: Relaxation oscillator using an op amp powered by (a) split supplies (b) single supply. 1
DESIGN REQUIREMENTS The goal of Lab7 is to demonstrate a two-led blinker with adjustable frequency. The two LEDs alternate (i.e. LED1 = on, LED2 = off, then LED1 = off, LED2 = on) during each blinking period. The overall specifications are: 1) Powered by three AA batteries. V CC can be as high as 4.8V (fresh batteries) and as low as 3.9V (nearly dead batteries). 2) The two LEDs must be different colors (red, green, blue, or white) (see course website). When V CC = 4.8V, the LED current must be between 19 and 20 ma. 3) The oscillator frequency is adjustable by a factor of 100. The lowest frequency can be between 0.5 Hz and 1 Hz. The highest frequency can be between 50 Hz and 100 Hz. Your circuit will have two transistor switches (one for each LED). You must choose one of the following two options (either is fine): i. NMOS (low-side) and pnp (high-side) ii. npn (low-side) and PMOS (high-side) Fig. 3: The oscillator controls two LEDs via transistor switches made from (a) NMOS and pnp (b) npn and PMOS. Either approach is fine. RELAXATION OSCILLATOR DESIGN The op amp output Vout should be 0 and +V CC in order to fully turn off the low-side and high-side switches, respectively. In other words, we need an op amp with a rail-to-rail output! We will use the TLV2371 op amp (Texas Instruments). This 2
CMOS op amp is fairly inexpensive, can be operated with single-supply as low as 2.7V (that s really low!), and has railto-rail outputs AND inputs. Nice! TASK 1: Compute the appropriate value for Vref. o Keep in mind what rail-to-rail output means, then use Eq. (1) from this assignment. TASK 2: Look at the square wave oscillator circuit in Fig. 29 of the LM358 data sheet (see course website). Show that the circuit produces Vref= Vcc/2, B = 1/3, and f = 7.21 khz. o Although we are using a different op amp, the LM358 data sheet contains lots of useful examples for singlesupply circuits! o Carefully compare Fig. 29 in the LM358 data sheet with Fig. 2b of this assignment. Think about Thevenin! The V + in the data sheet is equal to V CC. o NOTE: The use of 100 kohm resistors ensures low power dissipation (< 1 mw) for long battery life! Obviously, the LM358 example circuit produces a frequency that is way too high for our application. That circuit uses a 1 nf capacitor that is charged/discharged through a 100 kohm resistor (R1 in the LM358 example circuit). The frequency can be easily reduced by using a much larger capacitor. The frequency can be made variable by using a variable resistor to charge/discharge the capacitor! Sounds like we re going to need a potentiometer in the oscillator circuit! Cool! TASK 3: Choose an appropriate capacitor. Some comments: o You must choose from a 1, 4.7, 10, 47, and 100 uf capacitor. o Decide whether the original 100 kohm charge/discharge resistor should produce the highest frequency (e.g. 75 Hz) or lowest frequency (e.g. 0.75 Hz) of your adjustable range. Keep in mind the following: We want the frequency to vary by a factor of 100. The capacitor value is constant, so this means we need the charge/discharge resistor to vary by a factor of 100. Do you want the 100 kohm resistance to go DOWN by 100x or UP by 100x? Hint: It s very easy to produce a 1 kohm resistance. It s more difficult to produce a 10 Mohm resistance. TASK 4: Sketch a circuit diagram of your oscillator showing how one resistor and a 100 kohm potentiometer can produce a charge/discharge resistance that varies from 1 kohm (minimum) to at least 100 kohm (maximum). o The R in Fig. 2b should be replaced with a variable resistor consisting of a 1 kohm resistor connected in some manner to a 100 kohm potentiometer. o Keep in mind that a potentiometer s resistance can go all the way down to 0 ohm. Therefore, a 100 kohm potentiometer should not be used by itself to charge/discharge the capacitor. 3
o Think about how to combine a 1 kohm resistor and a 100 kohm pot to make a resistance that can be 1 kohm (minimum) and at least 100 kohm (maximum). A maximum overall resistance of 101 kohm is fine. NOTE: We don t want the minimum resistance to be less than 1 kohm. Otherwise, the op amp output current will be excessive! o Keep in mind that a potentiometer has three terminals, so you must determine the appropriate connections for all three terminals! o In your sketch, just use V CC as the power supply. TASK 5: Simulate your circuit in Multisim at the lowest and highest oscillator frequency (i.e. 100k pot set to 100% and 0%). Some comments: o Use the TLV2371IP op amp and V CC = 4.8V. o Perform a Transient simulation with the following settings: For the lowest frequency, use: TSTART = 0 sec, TEND = 30 sec, TSTEP = 1e-3; For the highest frequency, use: TSTART = 0 sec, TEND = 0.5 sec, TSTEP = 1e-5; For both frequencies, measure max Vout, min Vout, and frequency. Do your frequency values satisfy the design specs? Save the output voltage waveforms (min and max frequency) to submit. Please use a white background to save toner! TRANSISTOR SWITCH DESIGN Unlike Lab 4, this lab will operate the LEDs with transistor switches. This means the LED current will depend on V CC, but that doesn t really matter for indicator applications. The BJT and MOSFET switches must be chosen from the following: o BJT: (npn) 2N3904, TIP31 (pnp) 2N3906, TIP32 o MOSFET: (NMOS) BS170, IRF520 (PMOS) ZVP3306, IRF9520 TASK 6: Design the BJT switch. o First, decide whether you want to use a npn or pnp switch (either is fine). o Assuming I LED = 20 ma and V CC = 4.8V, determine the appropriate BJT. You must consider max I C, V CE, and T J under typical BJT conditions! o Choose your LED color, then determine appropriate 5% resistors for R C and R B. Assume typical LED (e.g. V F ) and transistor (e.g. V CE and V BE ) parameters. For the base resistor, just use Vcc = 4.8V as the input voltage. 4
TASK 7: Design the MOSFET switch. o Your BJT design will determine the type of MOSFET switch (i.e. npn switch means PMOS switch). o Assuming I LED = 20 ma and V CC = 4.8V, determine the appropriate MOSFET. You must consider max I D, V D, V GS, V GS,TH, and T J under typical MOSFET conditions! o Choose your LED color (must be different from BJT switch), then determine the appropriate 5% resistor for R D. Assume typical LED (e.g. V F ) and transistor (e.g. R DS,ON ) parameters. TASK 8: Simulate your entire circuit (oscillator + LED switches) in Multisim. o Add your transistor switches to the output of the oscillator. Remember to flip vertically your pnp or PMOS transistor! Do NOT use the default LEDs in Multisim! Their forward voltages do not match our components. For a red LED, use three 1N4148 switching diodes in series (total V F = 2.1V @ 20 ma). For a green, blue, or white LED, use one 1N4728A zener (V Z = 3.2V @ 20 ma). o Start with V CC = 4.8V (simulate fresh batteries) for your transient simulation. For both min and max frequencies (e.g. make 100k pot 0% and 100%), measure the following: I C and I B for the BJT switch when its LED is on. If I C does not satisfy the design requirements, you MUST change R C! Make sure I C /I B is between 10 and 20. If not, you MUST change R B! I D for the MOSFET switch when its LED is on. If I D does not satisfy the design requirements, you MUST change R D! o OK, now your circuit design is complete! Do NOT change any resistor values. o Now make V CC = 3.9V to simulate nearly dead batteries. For both minimum and maximum frequencies, measure the following: I C and I B for the BJT switch when its LED is on. I D for the MOSFET switch when its LED is on. o Make a table showing all of your measurements from this task. Submit the following: o Answers to all TASKS (show all work!). o Your measurements and voltage waveforms from TASK 5 (please use white background to save toner). o Your Multisim circuit schematic and table of measurements from Task 8 (no waveforms). (End of PreLab 7) 5