Gas station without pumps

2018 April 15

Rapid delivery

Filed under: Circuits course — gasstationwithoutpumps @ 09:37
Tags: , ,

I made a serious mistake in putting together the parts list for my Applied Electronics course this quarter—I forgot to include a potentiometer on the list. I think what happened is that in previous years I had put the trimpot on the first quarter list, but we didn’t use it until the second quarter. I had a note to move it from the first-quarter list to the second-quarter list, but the move only happened half way (it was removed from the first list, but not added to the second one).

The mistake was pointed out to me be students in my Thursday office hours (they were asking where the potentiometer they were to use was).

Late Thursday night (after the evening labs were ordered), I ordered 85 25-turn 10kΩ trimpots from DigiKey, and they arrived Saturday morning (at 36 hours, about the fastest delivery I’ve ever had for anything other than pizza—particularly good for a delivery from Minnesota to California).  The Post Office package delivery gives good service here (now that they are no longer short-staffed as they were in December).

Because the lab course fee for the Applied Electronics course has all been spent on parts and tools already, I probably won’t be able to get reimbursed for these parts. The $76.52 they cost is probably the price I’ll have to pay for my mistake. (It isn’t my most expensive mistake in the last year—I forgot to pay my first installment of property taxes on time, which cost me a couple hundred dollars in penalties.)

Although I’m very happy with DigiKey’s rapid service, I might still specify trimpots from AliExpress next year, since 100 trimpots would cost only about $12 with shipping (ePacket, not the unreliable China Post).

2014 June 10

Digi-key end-of-life notification for IR emitter

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

One of the things I like about dealing with Digi-key as a supplier for electronics parts is that they treat me like an important customer, even though I order only small numbers of parts.  For example, they automatically send out notifications whenever a manufacturer informs them that a part is being discontinued—like the notice I got today:

Part Life Notification

Dear Valued Digi-Key Customer,

You have purchased the following part number from Digi-Key within the last two years. The manufacturer has announced an update to the part status.

Part Affected
Manufacturer OSRAM OPTO SEMICONDUCTORS INC
Description LED IR EMITTER 950NM
Manufacturer Part Number SFH 4512
Digi-Key Part Number 475-2943-ND
Customer Reference Number IR EMITTER
Status End Of Life
Last Time Buy Date 12/01/2014
Substitutes Please click here

It used to be that only big industrial customers got that sort of service—now even hobbyists, students, and professors can be kept informed about the parts they use. Digi-key doesn’t have to spend a lot to do individual notifications (it’s all automated), but it probably took them a fair amount of time to set up the system to do so, and this sort of attention to customer service is one of the things that has made me a loyal (though small) customer.

I’ll drop the IR emitter from next year’s class part list (we didn’t do much with it this year anyway).

I’ll also change the red LED from LED red diffuse 3mm 625nm WP710A10ID to WP3A8HD whose peak emission is at 700nm (where the molar extinction coefficient for oxyhemoglobin is only 290 cm-1/M, rather than ~683 cm-1/M for the 627nm peak of the WP710A10ID we used this year). Ideal would be a 686nm peak, where oxyhemoglobin is most transparent (272.8 cm-1/M), but there’s not much available between 700nm and 660nm (some more expensive ones at 697nm, which makes little difference from 700nm), and 700nm is better than 660nm.

2013 August 13

MPX2053DP pressure sensor being discontinued

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

I just got notice today that Freescale is discontinuing the MPX2053DP pressure sensor that I used for the pressure sensor lab in the Applied Circuits course. DigiKey sent me an “end-of-life” notice with a “last time buy date” of 02/22/2014. It is service like this that makes me glad to buy from Digikey.

I don’t see any indication of the end of life status for the MPX2053DP on the Freescale website, which either means that Freescale is very poor at maintaining their website, or that Digikey has made a mistake here.  I’m betting on incompetent web maintenance at Freescale.

I’m wondering whether I should order some spares (I still have 8 breakout boards). I have 12 that I soldered to breakout boards for the lab (which UCSC reimbursed me for), plus one that I made for myself. Eight spares would cost $110.56, and 10 spares $125.60 (plus tax and shipping in both cases). I should probably check with the lab manager to find out what their recommended policy is for spare parts on discontinued items.

It may not be that important, since the MPX2050DP is still available, and it has essentially the same specs (except somewhat better linearity) and is actually slightly cheaper.  If we need more, we can get the MPX2050DP instead.

2013 July 18

Improved rectifier with Schottky diodes

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 22:32
Tags: , , , ,

In the Improved rectifier post, I gave the following circuit for an inverting rectifier and showed traces of its performance using diode-connected S9018 NPN transistors as diodes:

Only one of D1 and D2 can be conducting.

Only one of D1 and D2 can be conducting.

With a constant amplitude triangle wave input (about 2.6v peak-to-peak),  the circuit had some pretty serious glitches:

frequency positive glitch negative glitch
3kHz 40mV 40mv
10kHz 80mV 80mv
20kHz 120mV 100mv
30kHz 160mV 140mv
40kHz 200mV 180mv
50kHz 220mV 210mv
60kHz 250mV 260mv
70kHz 260mV 300mv

I claimed that I could reduce the glitches  by replacing the NPN transistors with 1N5817 Schottky diodes.  The diodes arrived today, and I tried them out with the same 10kΩ resistors and 30kHz triangle wave as before:

With the 1N5817 Schottky diodes, the glitches at 30kHz are much reduced—only about 68mV of overshoot.

(click to embiggen) With the 1N5817 Schottky diodes, the glitches at 30kHz are much reduced—only about 68mV of overshoot when turning off, which is half of the glitch with the S9018 NPN transistors as diodes.

I noticed that there was a bit of phase shift for the 30kHz signal, as well as the small overshoot. I tried adding capacitors in parallel with the resistors to improve the performance at 30 kHz (both to correct the phase shift and to keep the gain at -1).

This circuit works well up to 30kHz, and is still somewhat functional at 100kHz, though the "corners" have gotten soft enough that the clipping to the threshold voltage is no longer very precise at 80kHz.

This circuit works well up to 30kHz, and is still somewhat functional at 100kHz

C2 seems to adjust the overshoot, and C1 then needs to be set to fix the phase and gain.  I had the best results at 30kHz with C1=330pF and C2=220pF:

With capacitors in parallel with the feedback resistors, the phase shift is mostly corrected and there is less than 20mV of overshoot—the turn-on and turn-off corners are softened somewhat.

(click to embiggen) With capacitors in parallel with the feedback resistors, the phase shift is mostly corrected and there is less than 20mV of overshoot—the turn-on and turn-off corners are softened somewhat.

Unfortunately, there is no easy way in the BitScope software to set the offset of the traces precisely. You can do a lot of range changing and clicking the left or right sides of buttons (and start all over if you accidentally hit the middle of the button), but the offset is only displayed to 2 decimal points, but can be adjusted somewhat finer, making it hard to guess exactly what it is set to. As result, I’ve not been able to measure the overshoot or undershoot when it is less than 10mV—I’m never sure exactly what I’m measuring with respect to, and visually similar settings result in ±10mV in the estimate. In any event, the errors in this version of the improved rectifier are at least 5× better than in the version with the S9018 diode-connected transistors.

The circuit works well throughout the audio range, and can be pushed to 100kHz, though the “corners” have gotten soft enough that clipping to the threshold voltage is no longer very precise at (about 60mV off @ 80kHz—undershoot, not overshoot). At 100kHz, the output signal is still pretty good, but there is about an 85mV error in the threshold, and the corners are so rounded that the output almost looks like a sine wave:

Waveform at 100kHZ (sine wave input), showing the soft corners at that frequency.  The output doe snot get down to the threshold voltage, but only to about 85mV above threshold.

(click to embiggen) Waveform at 100kHZ (sine wave input), showing the soft corners at that frequency. The output does not get down to the threshold voltage, but only to about 85mV above threshold.

I can get better performance at 100kHz with smaller capacitors (100pF and 220pF, instead of 220pF and 330pF), but at the cost of some overshoot at 20kHz and 30kHz.  I suspect that the right values for the capacitors depend heavily on what op amp is used (especially its slew rate), but since I only have MCP6002 (and the equivalent MCP6004) op amps, I’ve not tested this suspicion.

2013 July 17

Improved rectifier

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 00:54
Tags: , , ,

In the Precision rectifier post, I gave the simplest circuit for making a precision rectifier:

This circuit is both a log amplifier and a precision rectifier.  If Vb is set to a constant voltage, then Vout1-Vb varies as log(Vb-a).  Vout2 is max(Va,Vb).

This circuit is both a log amplifier and a precision rectifier. If Vb is set to a constant voltage, then Vout1 varies as log(Vb–Va). Vout2 is max(Va,Vb). 
The diode can be connected in the opposite direction, to get Vout2=min(Va,Vb) and Vout1 varying with log(Va–Vb).

And I showed the problem with this circuit at “high” frequency, as the slew rate limitations of the op amp limit the turn-on time (to about 8 µs):

The S9018 NPN transistor with a 10kΩ resistor and a 15kHz input signal.  The overshoot as the rectifier turns off is about 50mV, and the turn-on delay is about 8µsec.  The turn-on delay does not vary much with the input resistance, unlike the turn-off overshoot.

(click to embiggen) The S9018 NPN transistor with a 10kΩ resistor and a 15kHz input signal. The overshoot as the rectifier turns off is about 50mV, and the turn-on delay is about 8µsec. The turn-on delay does not vary much with the input resistance, unlike the turn-off overshoot.

I also promised, “There are standard solutions that limit the voltage swing, but I think I’ll leave that for a later blog post.”  This is that post.

The textbook standard solution is to add another diode and resistor, and to configure the rectifier as an inverting amplifier (rather than a unity-gain one) when it is following the input:

Only one of D1 and D2 can be conducting.

Only one of D1 and D2 can be conducting.

This circuit has an input impedance of R1 (not the very high input impedance of the previous circuit). In this circuit, if Vin is more than Vthreshold, the output of the op amp goes low until diode D1 conducts and the negative input of the op amp is held at Vthreshold, as is Vout (with an output impdeance of R2).  If Vin is less than Vthreshold, the output of the op amp rises until D2 conducts, and the feedback circuit makes an inverting amplifier with V_{out} -V_{threshold} = \frac{-R_{2}}{R_{1}}(V_{in} - V_{threshold}).  The output impedance is very low.  Note that the difference in the output impedance for the two states is similar to the situation for the simpler circuit, and can cause problems if the output of the rectifier is fed directly to an RC filter, unless the R value for the RC filter is much larger than R2.  For the loudness circuit, we want a very large RC time constant to smooth out the ripples of the rectifier, so a large R value is not a problem.

We expect this circuit to have problems when neither D1 nor D2 is conducting—that is, as the circuit makes transitions between the rectifier being on or off.  The simple rectifier circuit only had problems with turning on (as the op amp had to slew from a rail to a diode-drop past Vthreshold), but this improved circuit has to swing two diode drops when turning on or when turning off.  The two-diode-drop swing is smaller than the

Here is an example of the output with a 30kHz clock, using S9018 transistors as diodes and R1 and R2 both at 10kΩ:

    (click to embiggen) Output (yellow) for the improved rectifier with a 30kHz triangle wave as input (green). The glitches are about 300mV and last for about 4 µsec.

(click to embiggen) Output (yellow) for the improved rectifier with a 30kHz triangle wave as input (green). The glitches are about 140mV–160mV and last for about 4 µsec.

The duration of the glitches is always about 4µs, but the magnitude of the glitches depend very much on frequency.  With a 2kHz triangle wave signal, I can’t see the glitches with the BitScope USB oscilloscope (so less than about 20mV).  The magnitude of the glitch seems to be proportional to the input magnitude. Using a constant amplitude triangle wave input (about 2.6v peak-to-peak),  I measured the glitches for some higher frequencies:

frequency positive glitch negative glitch
3kHz 40mV 40mv
10kHz 80mV 80mv
20kHz 120mV 100mv
30kHz 160mV 140mv
40kHz 200mV 180mv
50kHz 220mV 210mv
60kHz 250mV 260mv
70kHz 260mV 300mv

To understand where the glitches come from, it helps to look at the op-amp output and the negative feedback input:

The output of the op amp (green) is either a diode drop above or a diode drop below the output of the rectifier circuit.  The transitions between these states are limited by the op amp slew rate.  I measured about 600 mV/µsec, which is what the MCP6002 op amp I'm using is specified to have as a slew rate (I measured before looking it up, to keep from being biased by the correct answer).

(click to embiggen) The output of the op amp (green) is either a diode drop above or a diode drop below the output of the rectifier circuit (yellow) depending which diode is conducting.  The transitions between these states are limited by the op amp slew rate.  I measured about 600 mV/µsec, which is what the MCP6002 op amp I’m using is specified to have as a slew rate (I measured before looking it up, to keep from being biased by the “correct” answer).

 The negative input of the op amp, which the feedback circuit is trying to keep at Vthreshold, has glitches when the op amp output is ramping between its two states.

(clcik to embiggen) The negative input of the op amp (green), which the feedback circuit is trying to keep at Vthreshold, has glitches when the op amp output (yellow) is ramping between its two states.

The glitches in the improved circuit are smaller than for the simpler circuit, and can be further reduced by using Schottky diodes (to reduce the size of the diode drop, and hence how far the op amp must swing to change states) or a faster op amp (to reduce how long the op amp takes to slew the two diode drops).  I expect that with the Schottky diodes, the glitches should be reduced to 2(450mV)/(600 mV/µs)=1.5µs.  Since the glitches are basically triangular pulses, reducing the duration by a factor of 2–3 should reduce the amplitude by as much, and the total energy by 8–27.

To test the rectifier circuit with better diodes, I’ve ordered some 1N5817 Schottky diodes from Digi-key. I like dealing with that company, as they have a lot of components I need, are always very fast in processing orders, and have not yet messed up an order.  They were once out of stock on something that I had ordered, and called me up to apologize profusely for the mistake in their inventory database (normally they notify you before you order if something is out of stock).  For today’s order, they sent me notice that they had shipped the order less than an hour and a half after I had placed the order.  Because they offer first-class US mail as a shipping option, their shipping charges tend to be much less than most of the places I deal with.  (UPS ground is cheaper for big things, but no one is beating the Post Office prices on small lightweight objects.)

Disclaimer: neither Digi-key nor the Post Office has offered me anything for my endorsement—I’m just feeling pleased with them right now.

%d bloggers like this: