Gas station without pumps

2017 January 2

LM2903 open-collector comparator characterization

Filed under: Circuits course — gasstationwithoutpumps @ 18:02
Tags: , , , ,

In Last power-amp lecture, I posted an I-vs-V plot for the LM2903 comparator’s open-collector output, which I had made sometime in 2013, I think:

There are two regions of operation for the open-collector output of the LM2903. In the saturation region, the current goes up slowly with voltage (as about V^0.15, while in the "linear" region, it goes up as about V^1.5). The transition occurs when VOL is about 0.25 V, so we are almost always in the saturation region.

There are two regions of operation for the open-collector output of the LM2903. In the saturation region, the current goes up slowly with voltage (as about V^0.15, while in the “linear” region, it goes up as about V^1.5). The transition occurs when VOL is about 0.25 V, so we are almost always in the saturation region.

I decided to redo the plot using the Analog Discovery~2, as I now include the open-collector curve in the textbook (in an optional section, since we no longer use open-collector comparators). I used a 12V wall-wart and both the function generator and oscilloscope functions. I used the “custom channel” and XY plot features to get the I-vs-V plot on the screen (though I saved the data and replotted with gnuplot, to superimpose different runs). I also averaged 10 sweeps to reduce noise.

R1 was 56Ω for testing high voltages and currents, and R1 was 2.2kΩ for testing low voltages and low currents.

R1 was 56Ω for testing high voltages and currents, and R1 was 2.2kΩ for testing low voltages and low currents.

The triangle-wave generator and the nFET makes a variable load for the comparator, from slightly more than R1 up to about 1MΩ.

Even up to 11V, the LM2903 collector stays below the 20mA maximum current, but I'd want to make sure that there was some current-limiting resistor for any power-supply voltage above 12V.

Even up to 11V, the LM2903 collector stays below the 20mA maximum current, but I’d want to make sure that there was some current-limiting resistor for any power-supply voltage above 12V.

The results with the Analog Discovery 2 are much cleaner than my old results, which were most likely done with an Arduino, which has a very low resolution ADC.

Advertisements

2015 September 16

Class-D power amp lab revamp

Filed under: Circuits course — gasstationwithoutpumps @ 11:06
Tags: , ,

I’ve been struggling all summer with half-baked ideas to try to improve the class-D power amp lab in the applied electronics course.  Since the first run of the course, there have been too many concepts packed into that one week, and too much stuff to do for students to understand it all.  It also has been the one that been most difficult to convert to a home-lab exercise, because it used a triple power supply.

One idea that I have implemented, though I’m a bit worried about whether it will work, is to make the first amplifier lab, the microphone pre-amplifier, require soldering, so that the class-D lab can use the microphone pre-amp as a pre-built module, without having to rebuild it. I’ll need to think about the possibility of reordering the labs, to do a breadboard lab before the soldered pre-amplifier.  Perhaps the transimpedance amplifier can come before the microphone amplifier??

The other idea I’ve been toying with, and that I’ll have to build and test this week, is to use a single power supply and an H-bridge for the loudspeaker.  That way I could keep the voltage down to 6V (in spec for the op-amp in the preamplifier) and still get enough power to the speaker (4.5W for an 8Ω speaker).  Because the voltage range is now ok for many cMOS parts, I can eliminate the open-collector output comparators, and use a rail-to-rail comparator like the TLC3702.  I’ll need an inverter for controlling the two sides of the H-bridge, so I could use a hex inverter package and use a separate inverter as a driver for each of the four FETs.  I could even have students get a second 74HC14N Schmitt trigger chip, as they have the same drive capability as 74HCU04 inverter chips, and increasing the number lowers the cost below buying one of each for the students. I estimate that the gate rise and fall times will be faster than what we’ve been getting with the open-collector designs, so shoot-through current should not be a major problem.

H-bridges are probably more useful to the bioengineers than open-collector circuits, because many of them will be taking the mechatronics class and building motor controllers. Having seen and designed H-bridges before will make their motor control seem more natural.

For the argument in favor of open-collector circuits: Many students will be learning how to do I2C interfacing in the sensors class, which uses open-collector (or open-drain) wiring, but the reasoning for the pullups needed in those designs is somewhat different from what is needed in the class-D amplifier anyway.

I’ve drawn up a schematic for a possible design and will try building it tonight or tomorrow.  The last time I tried using a TLC3702 comparator in a class-D amplifier, I did not have much success, but I was trying to swing a much larger voltage then and did not have inverters as extra amplifiers for each gate—the inverters seem to have about twice the drive capability of the TLC3702 output.  The combination of smaller voltage swing and greater current should make the transitions on the gates fast enough that shoot-through current should not be a problem (fingers crossed).

2015 May 28

Power amps working

Filed under: Circuits course — gasstationwithoutpumps @ 21:34
Tags: , , , ,

The power-amp lab went quite smoothly today—just about everybody got a class-D power amp working and a couple of groups wired their sup to a headphone plug and played music from their cell phones.  They were impressed at how loud the amplifiers were (though they were only producing about 4W of music, and their speakers could go to 10W or 15W, depending which model they got).

The biggest problems I saw in helping students debug was careless wiring—often because students had not bothered to make complete schematics including pin numbers and every power connection.  Connecting power up incorrectly was common.  Another common problem for students who did multi-sheet schematics (not recommended for such a small circuit), was having discrepancies at the boundaries between the sheets (like leaving out the high-pass filter needed for recentering the output of the pre-amplifier at the same voltage as the triangle wave).  A number of students got confused between the lowest power rail and ground (especially since the LM2903 data sheet calls the low power voltage to it GND, even though in the student schematics it was connected to the lowest power rail.

Despite my rather awkward lectures on the class-D power-amp, I think that the building and testing went smoother this year—perhaps because I tried having them do a crude-approximation-and-test approach to sizing the pull-up resistors.  I think that few groups ended up using the resistor sizes they started with.  Most had to make the nFET gate’s pull-up larger and the pFET gate’s pull-up smaller, to make the transistors turn off fast enough.  I’ll have to see if I can come up with some design guidance that will make the initial estimates closer, without complicating the design process.

I have to correct something I said yesterday in Last power-amp lecture—I did include a current-vs-voltage graph for the LM2903 comparator!  I need to rewrite the prelab to have them use that figure to compute their open-collector pull-up resistors: choose a desired low output voltage, figure out the current at that voltage, then use the voltage drop across the pull-up resistor to size the resistor.

I tried using the digital scope in lab today to get Miller plateau pictures without slowing down the transitions, and I recorded a few with the lower power rail at –6V, the upper power rail at +6V and a 330Ω pull-up resistor to 0V on the open-collector output:

Rising edge for the gate voltage with a 330Ω pullup to 0V from –6v.

Rising edge for the gate voltage with a 330Ω pullup to 0V from –6v.

Falling edge for the gate voltage with no load on the FET, from 0v down to –6v.

Falling edge for the gate voltage with no load on the FET, from 0v down to –6v.

With an 8Ω loudspeaker as a load, turning off the nFET (gate voltage in blue) causes a large inductive spike on the drain (yellow).

With an 8Ω loudspeaker as a load, turning off the nFET (gate voltage in blue) causes a large inductive spike on the drain (yellow).

Here is a detail of turning off the nFET, showing both the Miller plateau on the gate voltage (blue) and a large inductive spike on the drain (yellow).

Here is a detail of turning off the nFET, showing both the Miller plateau on the gate voltage (blue) and a large inductive spike on the drain (yellow).

The on-transition of the nFET shows the Miller plateau clearly in the gate voltage (blue), with a smooth transition in the drain voltage (yellow).

The on-transition of the nFET shows the Miller plateau clearly in the gate voltage (blue), with a smooth transition in the drain voltage (yellow).

Unfortunately, these tiny little images were all the scope recorded, and they are too low quality as images to put in the book.  I’ll have to do it again sometime, with the scope downloading the data for me to plot properly.  Unfortunately, the download format is a 3.8Mbyte CSV file, which takes a long time for the scope to download to a flash drive (slow USB 1 speeds, I fear). I did not have the patience to do that today, together with writing scripts to ignore the meta data and plot just the real data.  I saved one file, which I’ll use for script writing, and some time later go back and record the transitions again.

 

2015 May 27

Last power-amp lecture

Filed under: Circuits course — gasstationwithoutpumps @ 21:20
Tags: , , , , ,

I gave the last of the lectures on class-D power amps today, starting by answering a question about how they could hook up a phone or iPOD to the power amp.  Basically, the line output replaces the microphone and preamp circuit, before the high-pass filter that recenters the voltage, which is convenient, as they have mostly been building the preamp on a separate breadboard, with only two wires over to the class-D power stage. I also had the students figure out how to combine a left and right signal into a single monaural signal (as with most of the questions in the class, the answer is a voltage divider).

For most of the lecture I talked about how to decide whether the pull-up resistors for the open-collector comparators outputs needed to be bigger or smaller. I gave up on doing anything mathematical, and went for more cut-and-try approach (many, but not all, of the students already made mathematical estimates in the prelab, sometimes reasonably, sometimes off by moderate amounts).

The basic idea is simple: look at the output high voltage and the output low voltage. The output high voltage is whatever the other end of the resistor is connected to—for the pFET gate this is the same power rail as the pFET source is connected to, so it guaranteed to be high enough to turn the pFET off, while for the nFET gate this can be either ground or the positive power rail, which are guaranteed to turn the nFET on, as long as the power supply voltages are high enough. The output low voltage results from the voltage drop across the pull-up resistor, so is V_{hi} - R I_{sat} if that voltage is enough above the bottom power rail for the comparator output transistor to be saturated. The saturation current for the LM2903 they are using is guaranteed to be at least 6mA on the data sheet, but in practice is typically larger.

One thing I did not do was include a current-vs-voltage graph for the LM2903 comparator, though I had created one two years ago—I’ll have to put it in the book!

There are two regions of operation for the open-collector output of the LM2903.  In the saturation region, the current goes up slowly with voltage (as about V^0.15, while in the "linear" region, it goes up as about V^1.5).  The transition occurs when VOL is about 0.25 V, so we are almost always in the saturation region.

There are two regions of operation for the open-collector output of the LM2903. In the saturation region, the current goes up slowly with voltage (as about V^0.15, while in the “linear” region, it goes up as about V^1.5). The transition occurs when VOL is about 0.25 V, so we are almost always in the saturation region.

I probably should have presented this graph (I’d forgotten I had made it) and then justified using a saturation current of 10–16mA (maybe 12mA for the nFET driver where we want the low output to be well below the nFET threshold voltage and 16mA for the pFET driver, where we may not need to get anywhere near the lower power rail).

So the main constraint on the pull-up resistors is that they must be large enough to make the VOL voltages low enough to turn on the pFET, -I_{sat} R < V_{th(p)}, and turn off the nFET, V_{OH}-I_{sat}R < V_{-supply} + V_{th(n)}.

But making the resistors large slows down the upward transitions, making the pFET turn off slowly and the nFET turn on slowly, so we really want to make the resistors about as small as we can while reliably turning the pFET on or the nFET off. (This is an oversimplification, because the on-resistance of the FETs drops as we turn them on more firmly, so there is an incentive not to use the smallest possible values—but that tradeoff gets complicated without either measuring actual power consumption or doing extensive simulation.)

I then showed the students how to get the turn-on or turn-off time by looking at the gate voltage of the FET when the FET was switching a load (using the loudspeaker as a load, since they don’t have 8Ω 10W resistors). The time is from when the gate starts to change until the end of the Miller plateau, and I showed them the slowed down transition plots that I made for the book:

Here are the gate and drain voltages for an AOI518 nFET, slowed down by adding a series resistor to the gate signal and a large capacitor between the gate and drain.  I slowed it down so that I could record on my low-speed BitScope USB oscilloscope—students can see high-speed traces on the digital oscilloscopes in the lab.  The Miller plateaus are the almost flat spots on the gate voltage that arise from the negative feedback of the drain-voltage current back through the gate-drain capacitance.

Here are the gate and drain voltages for an AOI518 nFET, slowed down by adding a series resistor to the gate signal and a large capacitor between the gate and drain. I slowed it down so that I could record on my low-speed BitScope USB oscilloscope—students can see high-speed traces on the digital oscilloscopes in the lab. The Miller plateaus are the almost flat spots on the gate voltage that arise from the negative feedback of the drain-voltage current back through the gate-drain capacitance.

I should probably take some of the 9–10 hours I’ll be spending in the lab tomorrow to try to make plots without the slowdown, using the high-speed digital oscilloscopes in the classroom. The oscilloscopes can save screen images onto flash drives with a single button push, but I’ve not yet figured out how to get data off of them in a usable format—I guess I’ll need to look in the manual (there is a copy cabled down in the lab).

I also mentioned the problem of overshoot when using only one FET (rather than the cMOS arrangement) to switch an inductive load, and showed how to use a flyback diode to provide a return path for the current that continues to flow from the inductor.  With the cMOS arrangement, the built-in body diodes of the FETs provide good flyback diodes, with each FET’s body diode protecting against the overshoot when the other FET turns off.  I should probably have some plots of that overshoot also for the book.

One thing I did not get enough time for in class is talking much about the LC filter design for removing the high-frequency PWM signal and delivering just the audio signal to the loudspeaker.  I showed them the basic idea, and pointed them to the gnuplot script I’d written for them (where they need to plug in their own loudspeaker model), but I did not get a chance to demo it.  I think that only the top third of the class got enough to be able to choose the capacitor (I only have one size of inductor available—I should probably buy a few other sizes). I covered the LC filter better last year (see post on that lecture), but I did a little better with real power this year.

Overall, it was not a great lecture—too much material and too sloppily done, so that I’m not sure that any of it got through clearly.  Being so short on sleep for the past couple of weeks has really been killing my performance.  Still, I think it was a little better than last Monday’s lecture, which was probably the worst of the quarter.

2014 May 24

Class-D amplifier lecture 2

Filed under: Circuits course — gasstationwithoutpumps @ 17:41
Tags: , , , , ,

Yesterday, in the last lecture before the long weekend (hence before they start wiring their Class-D power amplifiers), I covered three topics:

  • open-collector outputs.  I had hoped to avoid that this year by switching to the TLC3702 comparators, but I couldn’t get the TLC3702 comparators to work with the FETs, so I went back to using the LM2903 comparators that the students got in their parts kits.  Because I had already cut the open-collector information from the lab handout, I had to cover it in lecture, and I’ll have to write an addendum to the handout today.
  • LC filters for the loudspeaker.  This was a pretty rushed job.  I didn’t even have time to get them to derive the LC filter behavior with no load (the standard voltage divider formula \frac{Z_{down}}{Z_{up}+Z_{down}} becomes \frac{1/(j \omega C)}{j\omega L + 1/(j \omega C)}=\frac{1}{1-\omega^2 LC}, which goes to infinity at \omega=1/\sqrt{LC} and 0 at DC and infinite frequency.  Instead I pointed them to a gnuplot script that they needtomodify to see how much power the LC filter delivers to the loudspeaker at different frequencies, with different choices of capacitor (no choices for them on the inductor—it is a 220µH 0.252Ω AIUR-06-221 inductor).
    LC filter and loudspeaker model used for sizing the capacitor in the gnuplot script.  The students need to replace the loudspeaker model with the one that they created in an earlier lab.  I think that next year I may use a much simpler loudspeaker model in the script, so that I can tell whether the students have replaced the model or not.

    LC filter and loudspeaker model used for sizing the capacitor in the gnuplot script. The students need to replace the loudspeaker model with the one that they created in an earlier lab. I think that next year I may use a much simpler loudspeaker model in the script, so that I can tell whether the students have replaced the model or not.

    The output of the gnuplot script looks something like this:

    Output of the gnuplot script, note that too small a capacitor results in a spike near 61kHz, and nowhere near enough suppression of their 50kHz–100kHz PWM frequency. Too large a capacitor results in a big boost in gain around 3.8kHz, which would a different sort of problem.

    Output of the gnuplot script. Note that too small a capacitor results in a spike near 61kHz and nowhere near enough suppression of the 50kHz–100kHz PWM frequency. Too large a capacitor results in a big boost in gain around 3.8kHz, which would a different sort of problem. Click
    here for a PDF version of this plot.

  • Block diagram for the class-D amplifier.  I had originally planned to spend almost the entire lecture having the students develop the block diagram, but the addition of almost 45 minutes on open-collector outputs and review of the FET driver stage left me with little time for the block diagram. I did get some participation from the class in developing the diagram, but almost entirely from one student.  I felt bad about presenting, rather than getting them to participate in creating the block diagram, but they had to have a block diagram to do their more detailed design over the weekend.One important point I that I emphasized, based on common problems on the second quiz, is that a block diagram is not a simple pipeline, but can have merging and splitting.  The class-D amplifier has merging of voltage generators for DC bias with the signal path and merging of the triangle wave generator with the signal path.
    One good thing came out of the block diagram discussion: in putting together the design they had the output of the preamp centered at 3v but the input of the comparators centered a 0v.  I could point out that putting range information on the signal lines allowed them to catch this error early (before even doing the schematic).  Most of the class was able to come up with the standard solution for changing the C bias: adding a high-pass RC filter.  I don’t know whether they can choose a corner frequency appropriately, but we’ll see that on Tuesday.

I didn’t get a chance to teach them about real power, either, which the LC script computes.  I’ll have to go over that next Wednesday, between the two halves of the lab.  There is a writeup of the concept in the lab handout, but my experience has been that students in this class don’t learn from written material.

I’ve also told the students that they need to get all their required “REDO” assignments turned in by Wednesday.  It seems that this year’s class does not have the time-management skills to handle open deadlines—they keep putting off redoing the assignments.  Given that they sometimes don’t fix the assignments sufficiently when they turn them in again, leaving the assignments to the last week is really dangerous.  Next year I’ll have to make one-week deadlines for redoing the assignments, though I can be generous about extending deadlines on request.

Overall, the lecture was way too rushed, because of the extra coverage needed for open collectors. Next year I’ll have to make sure to allow 3 lectures for the class-D power amp, which means not having it on the week with Memorial Day.  I’ll probably want to move Quiz 2 a little earlier also, so that it isn’t the week before the class-D power amp.

Next Page »

Create a free website or blog at WordPress.com.

%d bloggers like this: