Gas station without pumps

2014 February 23

Soldering headers on a Freedom board

Filed under: Circuits course — gasstationwithoutpumps @ 16:14
Tags: , , ,

Because I decided to switch to the Freedom KL25Z boards this year for the circuits class, rather than Arduino boards, I have a bit of a scheduling problem.  The KL25Z boards come without headers, but the students can’t do much with them until headers have been soldered on. That means that I need to teach the students to solder on the first day of lab, rather than halfway through the course.

Because students will need instruction, I’ve tried to put together a tutorial on soldering specifically for this purpose.  Because I don’t have a KL25Z board without headers, but do have a KL26Z board (which uses identical headers), I’ve taken pictures of soldering on the headers.

There are 4 female headers to assemble—here they are shown next to the holes they need to go through. The headers themselves should go on the component side of the board.

Place the headers in the holes and flip the board over onto the bench. Sometimes it is easier to put the headers pins-up on the bench and put the board down over them.
Make sure that all the headers are flat on the bench and that the board is level on the headers. Using 2×n headers (rather than 1×n as the Arduino boards use) makes aligning the headers easy.
Make sure that the board has the feet up, so that the headers are soldered on the correct side of the board.

To solder a pin to the board, touch both the pin and the copper ring around the hole with the soldering iron for about 3 seconds to heat both.

The touch the solder to the pin and the soldering iron and hold it there until the solder melts and flows onto the pin. Remove the solder but leave the iron in contact with the pin for another second.

I find it best to tack down each of the headers by soldering one or two pins first, so that I don’t have to worry about the headers shifting around as I solder.

After every few solder points, it is a good idea to wipe off the tip of the iron on a wet sponge, to keep the tip clean. Otherwise burnt residue of the rosin flux builds up on the iron and makes good thermal contact difficult.

I should also warn the students not to touch the rubber feet with the soldering iron. Arranging the board so that the long edge is closest to the hand holding the soldering iron (rather than the short edge as shown here) probably makes this easier. Rotating the board to solder the other side, rather than reaching across, is also a good idea.

We will be using tin-lead solder (since it is easier to work with than lead-free solders), but the lead is not a serious hazard.  A bigger problem is the smoke from heating the rosin-core flux, as the electronics lab is not as well ventilated as it should be.  I can warn the students not to breathe the smoke, and to take a 5-minute break in another room after soldering.  If we were doing a lot of soldering, we’d have to get some fans with filter units to remove the smoke from the work area.

One common problem is a “solder bridge” where too much solder was applied and two adjacent pins are shorted.
Solder bridges can be fixed in two ways:
1) sometimes just reheating the solder with the iron will cause it to reflow onto the two pads separately.
2) If there is too much solder for reflow to fix the problem, the solder can be melted with the soldering iron and sucked away with a “solder sucker”, or wicked away through capillary action with “solder wick”.

Sometimes there is not enough solder, and bare copper or voids can be seen. In that case, reheat the pin, and add a tiny bit more solder.

Pin 1 (the rightmost pin in the top row) shows another soldering flaw—there is enough solder, but it hasn’t flowed onto the pad completely. Such “cold-solder” joints can be fixed by reheating the pin and pad, without adding more solder.
Some of the other pins in this picture also show cold-solder joints, though less severely. Whenever bare copper appears on the pad, the joint needs to be reheated. (See pin 14 to the right of pin 16, for example.)

I’m a little worried about students’ first soldering projects being with a \$13 KL25Z board, rather than the 50¢ hysteresis-oscillator board, and needing 64 solder points, rather than 42, but I think that they can handle it. The ease of putting the board face down on the headers and tacking them all down (compared to inserting varying size and shape headers, capacitors, DIP, and resistor on the hysteresis-oscillator board) may make the KL25Z a better choice as a first solder project.

2014 February 22

Diode-connected nFET characterisitics

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 19:20
Tags: , , , ,

Test circuit for determining I-vs-V curves for a diode-connected nFET. The shunt resistor R2 was chosen from 0.5Ω to 680kΩ, and R3 was selected to keep E23 above 0 (0.5Ω to 150Ω).

In More mess in the the FET modeling lab, I showed I-vs-V plots for NTD5867NL nFETs, both with a fixed power supply and load resistor, and diode connected (Vgs=Vds).  But this year, the NTD5867NL FETs were not available from Digikey, so we are getting AOI518 nFETs instead.  I decided to try characterizing these with the KL25Z board.  If I power the test off the KL25Z board’s 3.3v supply, I can take fairly high currents, as the board uses a NCP1117ST33T3G LDO regulator, which can the spec sheet claims can deliver up to 1A (800mA, if we limit the dropout to 1.2v). I’m only limited by the USB current limit (500mA), to keep the laptop from shutting off the USB port.

I used essentially the same circuit for testing a diode-connected AOI518 nFET as I used for testing the Schottky diodes, but I did not put a capacitor across the FET.  (Well, initially I left the 4.7µF capacitor there, but I was noticing changing values that looked like RC charging when I was testing at small currents, so I removed the capacitor.)

Because the 3.3v supply droops if too much current is taken from it, I used the internal 1V bandgap reference to determine the scaling of the analog-to-digital converter on each reading.  The voltage VDS is (E20-E21)/(BANDGAP), and the current IDS is (E22-E23)/(R2*BANDGAP).

Voltage vs current for diode-connected nFET. The model that fits the data (above 1µA) is that of subthreshold conduction, even when the current is over 100mA. (click to embiggen)

I get a very good fit to the data (above 1µA) with the subthreshold conduction model (essentially the same as a junction diode, but using n VT instead of VT, where n is determined by the size and shape of the FET).  The value of n for this FET seems to be around 830mV/26mV = 32. The circuit models I’ve seen on the web seem to claim that I should be using a saturation-current model for a diode-connected FET, but that model doesn’t fit the data at all.

There is a very clear thermal shift in the curve for the high-current tests.  As the transistor warms up the current increases for a given voltage.  This is equivalent to the threshold voltage Vthr dropping with temperature.  This is consistent with the data sheet, which shows a lower threshold voltage but higher on-resistance (at 10A) at 125° C than at 25° C.

I’m not seeing any evidence of the weird negative resistance that I saw on the NTD5867NL nFETs. (I tried checking the NTD5867NL nFET with the same testing setup as for the AOI518, and it definitely still shows weird behavior between 10 and 30 mA.)

Because large nFETs are often used to switch inductive loads (motors, loudspeakers, inductors in switching regulators, …), they incorporate a “flyback” diode in the FET.  Normally, this diode is back-biased and does not conduct, but if an inductive load needs a current and there are no transistors that are on to provide the current, the diode conducts and keeps the output voltage from going too far below ground.

nMOS and pMOS transistors with flyback diodes. If both transistors are off, but the inductor L1 still wants current, it has to come through one of the flyback diodes D1 or D2. They keep the output voltage from going too far outside the rails.

I characterized the flyback diode on the AOI518 nFET the same way as before, now connecting the gate and the source to the higher voltage, and the drain to the lower voltage.

Below about 0.66 V, the flyback diode has a fairly normal exponential current with voltage, but above that it seems to have a linear relationship between current and voltage, with a dynamic resistance of about 180mΩ.
click to embiggen

The red points with the 0.5Ω shunt go up to an amp, which warms the FET enough to change its characteristics—the lower set of points are the warmer set.

I can also use the measurements of the flyback diode with the ½Ω shunt to characterize the LDO voltage regulator on the Freedom KL25Z board:

For currents up to 400mA, the LDO voltage regulator behaves like a 3.332 V source in series with a 55mΩ resistor.
click to embiggen

The data sheet claims that there should only be a 10mV drop in voltage for an 800mA current, and I’m seeing a 290mV drop.  The extra drop is not from the LDO misbehaving, but from the USB voltage dropping—one is only supposed to take up to 500mA from a USB supply and the MacBook Pro apparently has a soft knee at 500mA, rather than an abrupt shutoff.  I suspect that if I took the full amp for very long, the laptop would shut down the USB port, as it does if the USB 5V is accidentally shorted.

2014 February 18

Still better I-V plot for Schottky diodes

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

Last weekend I posted a voltage-versus-current curve for a 1N5817 Schottky diode, to confirm the theoretical formula $V = V_{T} \ln \left ( 1+ \frac{I_{C}}{I_{S}}\right)$, where IS is the saturation current of the diode, using the following setup

and measuring the results with an Arduino Leonardo.  I claimed that the resulting data fits the model well for over six decades (> 120dB):

Fitting over a wide range of currents is more robust than fitting over the narrower range that I can get with just one value for R2.
There is quantization error still on the voltages, but the overlapping current ranges give good data for most of the range. VT is now 26.1mV and IS is 0.91µA.
click to embiggen

I was a little dissatisfied at the low end, because of the low resolution of the Arduino analog-to-digital converter (only 10 bits).  This weekend I decided to repeat the measurements, but using a Freedom KL25Z board, which has a 16-bit ADC.  Of course, it doesn’t really get 16 bits of accuracy—the data sheet claims that when you use the hardware averaging of 32 samples in 16-bit differential mode (the most accurate) you get at least 12.8 equivalent bits and typically 14.5 equivalent bits. (For single-ended 16-bit, the effective number of bits is only guaranteed to be 12.2, and the typical is 13.9 bits.)  They claim a ±6.8LSB total unadjusted error.

My son helped me get the bare metal ARM system set up on my laptop, along with ADC and UART routines, so that I could write my own single-purpose data logger for this problem (he’s working on getting the KL25Z board integrated into the Arduino Data Logger, but it isn’t close to being ready yet).  My program used the longest sample times and hardware averaging of 32 samples, to get the most accurate conversions possible from the 16-bit ADC.  The first version of the program used differential inputs for the voltage across the diode (E20-E21), but single-ended readings (E21) for the voltage across the resistor.  I had to reduce the voltage for the test from 5v to 3.3v, because the KL25Z runs on 3.3v, not 5v. I got some rather weird results:

Two runs of measurement with R2=100Ω. The low-current measurements seem to be all noise.
click to embiggen

I could get decent measurement in the low-current range by using a larger resistor, so the problem was not noise in the measurement fixture or problems reading low differential voltages on the diode, but just with the small single-ended read for the current. It is pretty clear to me that the ADC does not work well when the input voltage results in less than about 50 counts.  (Note, that means that at the low end of the voltage range you only have about a 9.4-bit equivalent ADC.)

I modified the circuit to allow differential reading away from 0 for both the voltage across the diode and the voltage across the shunt resistor:

Adding an extra resistor ensured that the lowest voltage did not get too close to ground and I could use differential reads for both voltage (E20-E21) and current (E22-E23)/R2

This gave me a much cleaner reading, with problems only once the differential counts got below about 20:

Differential measurement with R2=100Ω. The low-current measurements have problems when the counts get small, but not nearly as severely as with the single-ended measurements.
click to embiggen

I replaced the 100Ω R2 resistor with a 15.56kΩ resistor (nominally 15kΩ), to extend to lower currents despite the noise in the ADC:

This plot extends the fit down to about 0.1µA, but only by adding an extra term—an offset to the voltage. I thought at first that overshoot to –11mV is an error in the analog-to-digital converter on the KL25Z, as I couldn’t see how my circuit could be back-biasing the diode.
Click to embiggen

I tried using larger resistors, but was unable to get any better data using them—I seem to be limited by the differential voltage measurement of the diode at the low end. I thought I might be able to improve the measurements by adding an instrumentation amp to increase the signal for low voltages.  But first I tried just hooking up a voltmeter, with no ADC or instrumentation amp connections.  When the voltage across R2 (100kΩ) is 0.31mV, the voltage across the diode plus R2 is only 0.05V, so there is -0.26mV across the diode.  The backwards voltage across the diode was not an artifact of the ADC!

I then tried looking at the voltage across the diode with my oscilloscope.  There is about 20mV of AC noise, independent of the DC voltage, until the diode has about 50mV across it (with the 15.5kΩ resistor for R2), by which time the noise has dropped to about 10mV (the Bitscope oscilloscope with the differential probe has a noise floor of about 3mV, if the two leads are connected together, so this is not just oscilloscope noise).  This noise seems to be white noise, not 60Hz hum pickup, so is probably coming from the diode.  This AC noise signal limits how accurately we can measure the DC current, and rectifying the noise could be the source of the mysterious “backwards” bias.

To reduce the noise, I put a 4.7µF ceramic capacitor in parallel with the diode, and redid all the measurements with 100Ω, 15.5kΩ, and 100kΩ resistors for R2.

Modified measurement circuit, adding a bypass capacitor to reduce AC noise on the diode and allow better DC measurement.

Now the signals are very clean down to nanoamp levels. I no longer need to add an offset to the voltage, as it is 0 to within the measurement repeatability. The noise from very small voltage differences for the 100Ω shunt resistor is still a bit of a problem, but that region is well covered by 15.5kΩ data. The curve was fit using just the 15.5kΩ and 100kΩ data, to avoid having to trim out the noise from the 100Ω data.
Click to embiggen

Lessons learned today:

• Higher-resolution ADCs do give smoother curves, with less digitization noise, but they aren’t a panacea for measurement problems. To get most of the resolution, I had to set the ADC to use long sample times and do a lot of averaging. I understand that Freescale Kinetis M series include 24-bit sigma-delta converters for higher precision at much lower speed (24 bits is 7 decimal digits), as well as the high-speed 16-bit successive-approximation converters. Unfortunately, they don’t have a low-cost development board for this series.
• Stay away from the bottom end of the ADC range on the KL25Z.  Scale single-ended inputs to have values at least 50, and differential inputs to have values at least 20.  There may be similar problems at the top end of the range, but I did not test for them.
I wondered if the problem may be switching from the large value for the voltage across the diode to the small voltage across the shunt resistor that was the problem. I tried putting in a dummy read between the voltage and the current reads, but that didn’t help at all. At first I thought that the low-count readings were good with the large shunt resistors, but this is probably an illusion: errors in the current measurement for small currents aren’t visible on the plot, because the voltage across the diode is not changing, and so large horizontal errors in the plot are not visible there.
• Watch out for AC noise when trying to measure DC parameters.  If there are semiconductor junctions around, the noise may be rectified to produce an unwanted DC signal.
• The differential ADC settings have a range of ±VDDA, not ±VDDA/2. This means that the least-significant bit step size is twice as big for differential inputs as for single-ended inputs. For some reason the Freescale documentation never bothers to express what the differential range is.
• Serial USB connections are a bit flakey—the Arduino serial monitor missed a byte about every 200–300 lines.  I looked for anomalous points on the plot, then commented out the lines that produced them—they were almost all explainable by one character having been missed by the serial monitor; e.g., I commented out “662401069     86      19″ right after “660001069       865     17″,  because the last digit of the voltage (the second field) was missing.  The fields were a timestamp (in 24MHz ticks), voltage across the diode (in ADC units), and voltage across the shunt resistance (in ADC units).  [Actually, this was not a new lesson for me—I've had to do the same on almost all files collected from the Arduino serial monitor.  My son's data logger code is better at not losing data, but it is still worthwhile to check for anomalies.]
• The 3.3v supply from the Freedom board is much cleaner than the 5v USB supply that I get from the Arduino (unless I use an external power supply with the Arduino), but I can only take about 10mA from the 3.3v supply before it begins to droop.  If I want  more than that, I’d better provide my own power supply (or at least my own LDO regulator from the USB 5v supply).

2014 February 15

Freedom KL26Z board

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

I bought a Freedom KL26Z board this week, because I wanted another Freedom board, and the KL26Z has somewhat nicer peripherals (added magnetometer, light sensor, I2S interface) and only costs a a couple of bucks more. It should be fairly easy to add the KL26Z to the Data Logger software, once the KL25Z board is working with it.  We may have both working in time for the Spring Applied Circuits course.

Unfortunately, the board came with the same incompetently designed bootloader (by P&E Microcomputer Systems) as the KL25Z—you can’t load programs from Mac OS X, only from Windows machines (and not Windows 8, only Windows 7). They claim that this problem was fixed last year with a newer version of the OpenSDA software, but the board I just bought from DigiKey certainly doesn’t work with Mac OS X:

Board Name is: FRDM-KL26Z
MicroBoot Kernel Version is: 1.05
Application Version is: 0.00

You still need a Windows machine to load the OpenSDA software, so it is not that great a “fix” (if it even works). I’ll have to make a special trip up to campus to find an ancient Windows machine. When I do that, I might put on the MBED.org download software, which was working with Mac OS X (on the KL25Z boards) months before P&E claimed to have a fix. I’m assuming that the SDA interface is the same on the KL25Z and KL26Z boards, but I’m not certain of it (mbed has different download software for the KL46Z board, which makes me concerned that there are some board-specific differences).  I could try downloading the latest P&E Microcomputer Systems software and see if it works on the KL25Z board—if not I can go back to the mbed software on that board and wait for mbed to release KL26Z software.

I’m planning to use the bare-metal ARM software development kit, with the gnu gcc compiler, for future development on the KL25Z and KL26Z boards, rather than the mbed.org development tools, because the compiled code can be much smaller (less extra junk added in).  I’ve got the code installed on my Mac, but I’ve not tried running it yet. My son, who has gotten a few small programs working with the bare-metal ARM system using the KL25Z board, was going to help me set up my Makefiles this weekend (including a loader script that removes a lot of the stdio package if you aren’t using it—the default bare-metal ARM setup includes some fairly useless “assert” statements that add many kbytes to the downloaded programs). Unfortunately, there are a lot of different viruses circulating in Santa Cruz this winter, and he’s running a fever this weekend, so we’ll probably have to delay my getting bare-metal ARM working.

2014 February 9

I-vs-V plots for base-emitter diodes

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

Earlier today I posted a voltage-versus-current curve for a 1N5817 Schottky diode, to confirm the theoretical formula $V = V_{T} \ln \left ( 1+ \frac{I_{C}}{I_{S}}\right)$, where IS is the saturation current of the diode:

Fitting over a wide range of currents is more robust than fitting over the narrower range that I can get with just one value for R2.
There is quantization error still on the voltages, but the overlapping current ranges give good data for most of the range. VT is now 26.1mV and IS is 0.91µA.

I also said that I should characterize the base-emitter junction of a PNP and an NPN transistor this way also, for setting the appropriate resistances for the log amplifier in the loudness circuit.  I did that this evening for the S9012 PNP and S9013 NPN transistors:

Base-emitter diode for the S9012 PNP transistor (collector and base connected together). VT is 25.3mV and ISO is 13.4fA.

Characteristics for the base-emitter diode of the S9013 NPN transistor (collector and base connected together). VT is 25.5mV and ISO is 8.85fA.

For both transistors, the region where the logarithmic fit is good is from about 0.5µA to about 50mA (maybe only 35mA for the NPN transistor). That gives about a 100dB working range for a log amplifier, if the largest current corresponds to 50mA. Of course, the op amps that are driving the input of the log amplifier don’t have that much drive capability, and we are probably limited to about 20mA—only a 90dB dynamic range on the log amplifier.

Next Page »