Saturday, 12 August 2017

Joule Thief

Every once in a while, I get the itch to do something analog but doesn't require a major investment in time. This eventually lead me to the following experiment:

What do you do when your supply voltage is lower than the target voltage needed? For example, when your solar lamp receives less than the voltage necessary to light the LED? You use a Joule Thief circuit!

The Joule thief circuit is small and simple enough that it can be assembled in about 15 minutes. You need:
  • Variable power supply (or 1.5V battery)
  • A toroid core
  • Solid wire
  • 1 Kohm resistor
  • 2N3904 transistor or substitute
  • An LED
For demonstration purposes, I used a blue LED because these require higher voltages than say a red one. Figure 1 shows a hastily drawn schematic.

Figure 1. Joule Thief circuit.

Pay attention to the dots on the toroid windings. To create the transformer, twist a pair of solid wires together (cordless drills work great for this). Then wind as many turns as you can around the core (about 20).

Figure 2 illustrates my test setup, though you need not use special equipment. A 1.5V battery can substitute for a power supply.

Figure 2. Test setup.

If you have the polarity of the windings correct, your circuit should work the first time. Figure 3 illustrates the wave forms when 0.55 volts were supplied:

Figure 3. Input supply is 0.55 volts.

With 0.55V supplied, the frequency of oscillation was about 21.3 kHz. The upper trace in yellow shows the voltage appearing across the LED, which was about 2.65V max. The lower trace shows the base voltage varying between +1.08V and -2.04V. The pulse width is narrow at this minimum startup level and the average current flow was about 8 mA.

Figure 4 illustrates the wave forms when the input supply is 1.5V.

Figure 4. Input supply voltage is 1.55V.

The voltage across the LED increases slightly to 3.47V in this trace. The output frequency drops to about 14.7 kHz at this level. The average current was about 39.9 mA at this operating point. 

Conclusion

The circuit presents a very simple way to boost the voltage up to a level suitable for current consumption by an LED. It's only disadvantage is the requirement of an inductor or transformer.  Pull a toroid out of your junk box and give it a try. Perhaps even an junk audio transformer can be used.

Find the lowest input voltage for your circuit. Mine came to life at about 0.55V. Yours may be higher or lower, depending upon the parts used.


Wednesday, 1 February 2017

Ramp Generator: Inverse Ramp

Introduction

Last time we saw how one opamp (IC3A) would take a voltage from the 555 timer circuit and then level shift it. Using a gain of 3, it also amplified it so that the ramp would proceed range from  0V to +5V.  Finally, I noted that I had discovered that I needed an inverted ramp for the Topward 8110 Function Generator because it generates high frequencies at low ramp voltages and low frequencies at the high end of the ramp. It is highly desirable that frequency response shows from low to high on the scope, as left to right.

Figure 1 shows an inverting opamp amplifier added to the circuit to invert the ramp signal generated by IC3A.

Figure 1. Inverting amplifier IC3B
The resistor divider R6 and R7 simply provide a 2.5V middle point of reference for IC3B, since we are operating the opamp from a single ended power supply. This reference is fed into the (+) input on pin 5, so that when the (-) goes above it, the output voltages will go below, producing an inverted signal.

Notice that the gain calculation and resistor values of R9 and R10 are trivial. Gain for the inverting amplifier is simply:

Av = Rf / Rin
Av = R10 / R9

which is obviously 1.  If you're building this circuit, you might choose a 10k trimpot for R6 and R7, so that you can more accurately center the output of this stage. For my purposes, these levels didn't need to be exact, so some shift was tolerable. I also found that by playing with R15 and adjusting the IC3A stage, it would adjust IC3B also and allow me to arrive at a comfortable compromise for both.

Figure 2 illustrates the inverted ramp output of IC3B from pin 7.

Figure 2. Inverted ramp from IC3B output on pin 7
Figure 3 illustrates the same inverted ramp combined with the sync signal.

Figure 3. Inverted ramp signal shown with the NE555 generated sync signal.

From these scope shots you can see that the output does not go all the way down to 0V as intended. If that is critical for you, then substitute a trimpot in place of R6 and R7 and adjust for that.

Full Circuit

I have included the full circuit in Figure 4 (you should be able to click on the image for the full sized view).

Figure 4. Ramp generator schematic
Resistor R11 at the output of IC3B is provided to provide a load to the opamp in case the signal is capacitively coupled. Resistors R12, R13 and R14 provide some opamp and NE555 output protection, if the outputs should be shorted for any reason.

Figure 5 illustrates my breadboard setup for testing this circuit.

Figure 5. Ramp generator breadboarded

Topward Test

Figure 6 shows the function generator output with the ramp signal fed into the VCF input of the Topward 8110. The frequency range was selected to be at the high end of 1 kHz for this example, which is low enough that you can see the frequency modulation.

Figure 6. Ramp generator with Topward FG generated sine wave signal
It is plain to see that for the Topward 8110, the frequency (channel 3, purple) is lowest when the VCF input ramp (channel 1, yellow) was at its highest voltage. Frequency increased as the ramp proceeded toward 0V.

Summary

The next step here is to create a pcb and build it into some permanent case (I'm not sure if I will blog that). However, this is a low frequency circuit, which will tolerate prototyping of almost any kind. So don't feel that you must use a pcb for this project. 

I used the MC33202 opamp which supports low voltage and rail-to-rail at modest prices. If you try to use LM358/LM324 type devices, be aware that these will only output up to 3.5V. These will go to ground but need 1.5V headroom at the top end. If you insist on using these, then you may need to downgrade the gain in IC3A to 2 or raise the regulated power voltage.

Thanks for reading.

Monday, 30 January 2017

Ramp Generator: Level Shift and Gain

Introduction

In the last blog entry I outlined the design of the ramp generator's oscillator, using the NE555 timer chip. Using a constant current source for charging the capacitor, a linear ramp was generated by the timer chip. We also noted that we need to level shift and change the range of VC1 for our use with the FG (Function Generator).

Since the entire circuit is operating from 5V, it is necessary to use a low voltage opamp. In order for the output signals to include ground and near +5V, it is necessary to use a low voltage rail-to-rail opamp. The MC33202 is a low cost opamp that will serve the purpose in this low frequency application.

The temptation to use opamps like the LM358/LM324 should be avoided since these can't go to the +5V rail. If you were determined to use these, it could be accomplished if you changed the 7805 regulator circuit to provide +6.5V (or more) because about 1.5V of headroom will be required. This can be done by adding two diodes in the ground leg of the 7805 circuit.

We'll assume the use of the MC33202 or equivalent rail-to-rail opamp and a supply of +5V. Figure 1 illustrates the circuit surrounding IC3A.

Figure 1. MC33202 Level Shift and Gain Opamp (IC3A)
The top of the pot (R15) is +5V, and the bottom of the same pot goes to ground. The middle wiper arm is adjusted to about 1/3VCC (1.67V) so that pin 2 of the opamp IC3A sees that as its reference voltage. Note that IC3A is operating in single ended mode with +5V and ground for power.

The input is VC1 from the 555 timer circuit, which is delivered through the 10k R5. With R5 and the high input impedance of IC3A in the non-inverting configuration, no disturbing effects are felt by the capacitor C1.

Level Shifting

Level shifting occurs when R15 is adjusted to match VC1 when the ramp is at its lowest point (1.67V). In this way, when VC1 and V15 (wiper) match, the output of IC3A will be ground (0V). Also, when VC1 is less than the wiper level, IC3A will also output 0V when R15 is misadjusted.

As VC1 rises above R15 (wiper), IC3A will see a rise above its comparing inverting input. This causes the IC3A output to rise also. The use of pot R15 and IC3A allows us to shift 1/3VCC down to ground level at the output. The high point of the IC3A output is determined by gain.

IC3A Gain

Normally the non-inverting opamp gain is simply determined by the formula:

Av = 1 + Rf / Rin

where:
  • Rf is the feedback resistor (R8 in figure 1)
  • Rin is the input resistor (R15 in figure 1)
  • Av is the opamp's gain
The slightly tricky part is to determine what to use for Rin in this particular circuit.

Normally, opamps are described using bipolar power supplies where you have:
  • +VCC
  • Ground
  • -VCC
and Rin is always shown with respect to ground.

It should be remembered that in bipolar supply circuits, that the ground connection is actually a low impedance path to the rails in the Thevenin sense. This allows single ended opamp circuits to work equally well as the bipolar supply circuit.

Thevenin Rin

So what is Rin in IC3A's case at pin 2? It's a little bit tricky because this first depends upon where the wiper arm of R15 is adjusted to. We know that VR15 (wiper) is adjusted to match VC1 at its minimum. VC1min should be 1/3VCC (1.67V). With R15 adjusted to match, its wiper should be at 1/3 of its range, or:

  10k / 3 => 3333 ohms

This means that the other side of the wiper has 10k - 3.333k => 6667 ohms. If we treat R15 adjusted to 1/3, then in the Thevevin sense, we need to know the parallel resistance of 3333 || 6667 ohms. This turns out to be 2.22k.

What this means is that IC3A's (-) input sees a Rin of about 2.22k.

Computing Rf

Since VC1 has a range of one third of the 5V, we know that we need a gain of 3 to maximize the output ramp range (0 to +5V). So what Rf do we need to achieve that? Some simple algebra can re-arrange the formula for gain so that we solve for Rf. But if your algebra is too rusty, you can call upon wolfram alpha to help:

Figure 2. Wolfram Alpha solves for Rf

Wolfram Alpha needs single letter variables, so we have used:
  • g = Av
  • a = Rf
  • b = Rin
  • and asked it to solve for Rf, which is a
The formula was solved as:

  Rf = Rin ( Av - 1 )

Plugging in:

  Rf = 2.22k ( 3 - 1 )
  = 4.44k

In figure 1, I chose the value 4.7k, which is the nearest E12 value for Rf. This value introduces about a 6.9% errror, which is close enough.

Once IC3A is added to the ramp generator circuit, we get the following scope trace from IC3A's output pin 1, in Figure 3:

Figure 3. Output of IC3A, with level adjusted and full gain
From the Rigol measurements, we see that the output has a minimum of 0.36V and rises to 4.76V, which represents nearly the full 5V range. We also notice that the 1/3VCC has been shifted down to the ground level (360 mV). 

Next Steps

At this point, I thought I was pretty much done. But I discovered that the Topward 8110 Function Generator requires an inverted ramp signal, if we are to generate low to high frequencies in a given sweep! Instead, the Topward generates high frequencies when the ramp was low and low frequencies at the high point!

Fortunately this isn't too much of a hardship, since we have IC3B available. This stage can invert the beautiful ramp that we have presently. That will be the topic of the next post.

Thanks for reading.




Saturday, 28 January 2017

Ramp Generator: Oscillator

Background

A while back, I purchased a Topward 8110 Function Generator from eBay at a pretty good price. The unit had a dent in the front panel and was marked as needing repair.   I was able to remove and then flatten the front panel. No other physical damage was found. I did have to replace two driver transistors to get the unit working. But at the end of it all, I was pleased with the unit. Figure 1 shows the front panel.

Figure 1. Topward 8110 Function Generator
One of the reasons I wanted this unit, was that it had a VCF input (Voltage Controlled Frequency). Using a ramp signal, the FG (Function Generator) could be made to sweep a range of frequencies (1000:1 range). Using a scope, it is possible to view a filter response as the frequency is swept through its range.

Some FGs provide this sweep capability as a built-in feature. But to use the Topward 8110 in this way, I needed a ramp generator circuit. So why not build it myself?

Oscillator Design

The Topward FG accepts a range of 0 to +5V in the VCF input. So I decided that the entire circuit would run from a regulated power source of +5V.

The sweep (ramp) frequency was chosen to be under 100 Hz. It didn't need to be high and there was no reason to make it higher. The requirements so far, allowed the use of a NE555 timer and some low voltage rail-to-rail opamps.

The ramp could be generated using opamps but I settled on the 555 timer in order to keep this project simple. This would be the main generator for the whole unit. The one feature of the 555 timer that I liked is that the timing capacitor is charged and discharged within a strict range of 1/3 to 2/3 VCC. Using a +5V supply, this means that the capacitor would operate within a 1.67V to 3.33V range.

The next design problem is that normally a capacitor charges according to an exponential curve. What I needed was a linear ramp. So a constant current source for the charging circuit would be necessary. Figure 2 shows the NE555 circuit.

Figure 2. NE555 Ramp Generator

The LED1 componentwas chosen to have a forward voltage drop of about 1.2 V at about 10 mA. Red LEDs usually have some of the lowest VF values, so a red one was used. In this circuit however, the VR1 turns out to be 3.28V due to the lower current flow (VF=1.72V). It would have been best if VR1 was 2/3VCC + Vbe or higher, but I found that it worked well enough (ideally VR1 >= 3.93V). Voltage at the emitter of Q1 was measured to be 3.38V, with its base at 3.32V.

The PNP transistor Q1, combined with the LED1/R1 divider forms a simple constant current source with the caveat that some loss of linearity occurs at the top of VC1. The remainder of the 555 timer circuit is your standard astable timer configuration. The output on pin 3 will provide a square sync pulse, while the ramp signal of interest forms across C1.

Figure 3. NE555 timer signals C1, and output Pin 3.
From figure 3 you can see the square sync output on the scope channel 2, which varies between ground and about 4.57V. The signal output goes high until the capacitor starts to discharge. At the end of the discharge cycle, the sync output returns high again.

The VC1 is the sought after ramp signal. It rises after the discharge cycle completes. The ramp is very linear except perhaps at the end. Any non-linearity appears unnoticable here. On average, the ramp ranges in voltage from 1.65V to 3.32V before being discharged.

Next Objective

This circuit is not usable yet. We can't feed VC1 into the FG until we:
  1. Buffer VC1
  2. Level shift it for greater range
The charging circuit would be disrupted if we tried sending VC1 to the FG directly. It needs some kind of a buffer circuit. Further, we desire the full 0 to 5V sweep range, rather than the limited 1/3 to 2/3VCC. This will allow a greater frequency sweep.

In the next instalment, we'll design the level shift and correct the voltage range.

Thanks for reading.

Monday, 2 January 2017

Panasonic SV-3700 Repair

I have this used Panasonic SV-3700 digital audio tape unit, which I've had for some time now. This was a unit that I really liked owning but the problem was that I hadn't used it in probably over a year.

The service manual is available from here: http://elektrotanya.com/panasonic_sv-3700_sm.pdf/download.html

I recently needed a source of digital audio so when I went to use it, the old adage became real - "If you don't use it, you lose it!". I could eject and insert a new tape cassette but attempting to play or record only caused the unit to stop and refuse to respond to the play/record controls. The only way I could retry was to eject and insert a tape again. And of course, I tried several other tapes with the same result.

After some sputtering and muttering, I decided to clear the workbench and see if a fix could be had. Figure 1 shows the unit opened up, with the transport unscrewed and placed sideways over a folded piece of paper to avoid short circuits. This afforded greater visibility for troubleshooting. The transport is seen in the center behind the front panel.

Figure 1. Opened Panasonic SV-3700, with transport moved for better viewing and servicing.
I was of the opinion that the belts were probably ok. After all, the transport seemed to load, unload, and rewind ok. The problem only occurred when a play or record function was selected.

With the transport repositioned so that I could better view the action of the tape as it wrapped around the heads, I noticed that the head cylinder was never spinning. Could it really be this simple?

Figure 2.  View of the head cylinder from the end of the transport.
Reaching in carefully with the unit off, I touched the cylinder on the corner between side and top, to avoid putting any oil on the head. I noticed some resistance at first as I tried to make it turn. Then it seemed to break free but still had a noticeable amount of resistance. It was time for a power on test!

I powered the unit on and loaded a tape. I set it to record and then I saw a reluctant but spinning cylinder! Shortly after, the spinning overcame all resistance and seemed to continue with a proper smooth spinning action.

Rather than buttoning up the unit right away, I chose to allow it to continue recording for an hour or so (the length of the tape). I wanted to make sure that any built-in lubricants had a chance to reach places where they were meant to be. I also wanted any current "stickiness" to be eliminated by active wear.

And then there was more..

After it successfully recorded for an hour or so, I stopped the unit and requested a full rewind. The unit surprised me by doing a slow rewind and then stopping after about 10 seconds. And then it would retry about three more times. After the third stop, it simply gave up.

This didn't look hopeful but I unloaded the tape. Then I manually turned the spindle drives back and forth with my fingers to overcome some other potential "stickage". 

I reloaded the tape but was not at first successful. Then all of a sudden during a slow rewind attempt, the spindle sped up to full speed and has worked ever since. I naturally spun the tape back and forth a few more times to make sure.

Epilogue

I have since put the unit back together and it continues to work ok (though probably needs a head cleaning). 

So if you have mechanical devices, particularly tape devices, take them for a spin today. If you don't use them, you may lose them.

Thanks for reading!


Wednesday, 28 December 2016

Poor Man's Digital PGA - Part 2 of 2

No testing is complete until you try the final configuration. In the earlier post, I had simply grounded the extra resistor R7 to switch in the higher gain. Figure 1 below shows a capture of the signal at its base gain of 2.

In this capture, all extra AVR resistors R4, R6 and R7 are in the tri-state condition. It can be seen in Figure 1 that some noise exists on the output. Counting the bumps, there appears to be 20 per cycle amounting to about 100 kHz. The AVR device here is operating at about 1 MHz, using its built-in RC oscillator.

Figure 1. Noise on PGA Output
For use with the MSGEQ7, this should present no difficulty since the switched capacitance filters will eliminate this. This may present a difficulty when used in other audio work, however.

The good news is that this noise is reduced as the AVR resistors get switched in for higher gains.

You can watch an AVR switch between four gains here:

  https://youtu.be/iqPBaHtLFI0

Thanks for reading!


Monday, 26 December 2016

Poor Man's Digital PGA

Playing around with the MSGEQ7 chips it was readily apparent that the audio input level was critical to its graphic equalizer display. There have been many analog AGC (Automatic Gain Control) designs used over the years. Some designs using an opamp and a FET can be constructed but can be difficult to get right for students without an oscilloscope.

With an eye to reproducible circuits for readers, I was looking for a single-ended opamp design that was digitally controlled. Digital circuits tend to be easier to manage with the minimum of equipment. So I got to wondering if I could manage this with the use of the LM358 (or the LV rail-to-rail part MC33202).

I wondered if a Digital PGA (Programmable Gain Amplifier) could be constructed with a minimum of parts. Figure 1 shows a typical AC coupled non-inverting amplifier design. Because it is single ended, it needs the voltage divider consisting of R1 and R2. If VCC is 5 V, then the junction between them will be VCC/2 or 2.5 V.  C1 AC couples the signal into the non-inverting input of IC1. The feedback circuit is however a bit unusual because the gain for DC and AC signals differ.
Figure 1. AC Coupled Non-Inverting Amplifier
Those who know/remember their opamp theory, know that a non-inverting amplifier's gain is set by the ratio:

Av = (R5/R3) + 1

But in this circuit the capacitor C2 blocks DC current. The feedback current through R5 is so small, it behaves as if the output was wired directly to the inverting input. The net effect is that the Vout = V- = V+ for DC. The resistor R3 has no DC path to ground and as a result, can have no DC effect on the output.

Yet, the AC gain is however, still affected by R3. So the AC gain of the Figure 1 circuit is indeed:

Av = (500k/500k) + 1 = 2

It is well known that either R5 or R3 has to change to affect a change in this gain calculation. The good thing about this circuit is that the DC gain is not affected by resistance changes as long as R5 remains reasonable.

To change the AC gain, we could change out R5 using some FET switches but this proves inconvenient. Likewise R3 is inconvenient for switching resistors in and out. But if you stare at Figure 1 long enough, you have to start asking yourself "wouldn't it be nice if we could move R3 to ground?" Then you could easily add or subtract resistances to change gain. It turns out that we can!

Figure 2 shows the circuit modified so that R3 has one grounded leg and the capacitor C2 is moved above it. In this case R3 and C2 are simply in series and can be moved around.

Figure 2. AVR Controlled PGA
With R3 grounded, we can easily add resistances in parallel with it. R4 if placed in parallel with R3, is equivalent to:

R3 || R4 ~= 83k

This change alters the gain:

Av = (500k/83k)+1 ~= 7

So with the simple act of adding in R4 in parallel with R3, we've digitally changed the AC gain from 2 to 7. R4, R6 and R7 were chosen to be 10% tolerance resistances giving the following selection of gains:


ValueR3GaindBV
0500,0002.06.0
183,3337.016.9
242,96212.622.0
330,05117.624.9
421,07324.727.9
517,40529.729.5
614,54935.431.0
712,70140.432.1

With all resistors enabled by the AVR device, the maximum AC gain is about 32 dBV (40). With none of the added resistors connected in, the gain reduces to a minimum of 2 (6 dBV).

AVR Digital Control

The digital controls coming from the ATmega328P (Figure 2) must set the outputs of PD5, PB6 and PB7 along these lines:
  1. To enable a resistor, the port must be configured as an output port and have the level set to zero (low).
  2. To disable a resistor, the port must be configured as an input port and have the pull-up resistor disabled (thus achieving a tri-state condition).
Note that a tri-stated AVR input here is never left floating. It will assume the potential of the high side of R3, which will be ground effectively. R3 never switches out of the circuit.

The 'mega ports in Figure 2 were chosen to avoid some otherwise usable ports. You can of course change the ports to meet your own needs.

Function Generator Test

Figure 3 shows the scope traces of the 5 kHz function generator (channel 2) and the IC1A output in channel 1. Here it can be seen that the gain is 2.

Figure 3. R4, R6 and R7 disconnected (off), gain of 2

Figure 4 shows R4 grounded to enable it in parallel with R3. The gain is nearly 7 (422mV/64.3mV=6.56).

Figure 4. R4 || R3, gain near 7
Watch the gain change between four settings, driven by an ATmega328P:

  https://youtu.be/iqPBaHtLFI0

Thanks for reading!

Monday, 19 December 2016

MSGEQ7 7 Band Graphic Equalizer Chip



I had bought a couple of MSGEQ7 chips in 2014 from eBay with plans to do something with them. So recently I found myself a bit of idle time and mounted one on the breadboard to try it out. I used the circuit straight out of the MSI datasheet (Figure 1):
Figure 1. MSGEQ7 Circuit
I had a little trouble getting this to work correctly, so I scoped pin 8, knowing this is not going to be accurate but should indicate if the RC oscillator was running at all or not (Figure 2). The trace indicated about 102 kHz, which is probably higher with the 10x scope probe removed. 

Figure 2. Trace of pin 8 (Oscillator)
The problem was that I was getting an output (pin 3), like that of Figure 3. This was with no signal applied.


Figure 3. Incorrect outputs (pin 3)
After trying several things including gain and frequency adjustments of the function generator, I decided to try the other chip (I always buy two for this reason!) This chip swap yielded the type of results I was looking for (Figure 4):

Figure 4. MSGEQ7 finally works (near 60 Hz)
The tallest signal represents the first frequency bucket which represents about 63 Hz (from the documentation). This will vary somewhat depending upon the internal RC oscillator.  I used a AVR generated oscillator to strobe this thing and used the scope's sync to drive the reset. You can see two complete traces in the middle with partials at the ends. Unfortunately the Rigol internal hardware frequency counter didn't like the low signal levels. The software frequency measurement likewise didn't grok the low function generator signal levels either.

Figure 5 shows the result of the function generator at 160 Hz. I found that the signal generator (B&K Precision Model 3050) needed to be on the 0 dB output range at about 10%. The chip was fussy about the input level going from no output to all high when the signal went out of range.

Figure 5. 160 Hz
 The next bucket is 400 Hz, shown in figure 6.
Figure 6. 400 Hz
 Figure 7 shows the 1 kHz bucket activated.
Figure 7. 1 kHz
 Setting the function generator to 2.5 kHz for the next bucket (Figure 8).
Figure 8. 2.5 kHz
 Figure 9 shows 6.25 kHz.
Figure 9. 6.25 kHz
 Finally figure 10 shows the last of the seven buckets activated with 16 kHz.
Figure 10. 16 kHz
The idea behind the chip seemed cool. I had planned to drive it from an ATmega328P, hooked up to a Raspberry Pi. But having tested it out I quickly realized that this circuit is much too finicky for a "simple project". What it needs is a circuit ahead of the MSGEQ7 with AGC to keep the signal within acceptable limits. Otherwise the MSGEQ7 will simply disappoint.

The MSGEQ7 is a CMOS chip. I was aware of this and took my usual care handling it. But the first chip may have been static damaged on the breadboard. If you choose to breadboard it, I recommend that you make all the connections without the chip and plug it into the breadboard last. This is the first damaged CMOS chip I've had in quite a long time (it might even have been damaged as part of the shipping process).

You can read more about the MSGEQ7 chip from this PDF file:

  https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf

Thanks for reading.

Tuesday, 6 December 2016

No iMac? Build a iRasp3

I've wanted to try this for a long time with the Raspberry Pi 3. The Pi 3 has built-in WiFi, making it a natural for an iMac-like terminal unit. I've held off because of work on my new book, which is will be out early next year (shameless plug here: http://www.apress.com/us/book/9781484224052).

Now that the Pi 3 is free, I just had to repurpose an old Viewsonic VG2230wm monitor with a Pi on the back (Figure 1).

Figure 1. iRasp front view.
I received the monitor some time ago from a friend without a stand. I eventually junked another monitor which had a stand that could be adapted to the Viewsonic. You can see it crudely attached in Figure 2.

Figure 2. Note the adapted stand for the monitor. Raspberry Pi 3 is mounted on the back with plastic spacers, using wood screws in the plastic casing.

The Pi is mounted on top of four plastic spacers, made from a pen cut with a small pipe cutter. The screw holes were carefully drilled over an area known to have some breathing space underneath. The monitor internals are covered in a metal shield, so I wasn't too worried about hurting anything (I had also been inside before).

The Pi 3 also has four USB ports. So even though I need two for keyboard and mouse, I still have two available. If needed, there is also a wired ethernet port.

I made sure to orient the GPIO header strip towards the bottom. This will allow me to use a longer ribbon cable down to the Cobbler-T for breadboard work.

Someday I hope to replace keyboard and mouse with wireless peripherals, since the Pi 3 also sports Bluetooth. In the meantime, I'll be looking for a shorter HDMI and audio cable.

Thanks for reading.

Monday, 5 December 2016

ESR Project Build - Part 6 of 6


This build is not done until the unit is assembled in its cabinet. I thought this last step would be a slam dunk. But I was terribly mistaken!

The W2AEW design called for a 5 volt regulator. Since the parts used didn't require 5V specifically, I tested it using a 6.5V switching supply that I had handy. After all the wiring was done, I merrily built this 7805 circuit on a tiny proto PCB assuming all would be well. Of course, once it was all nicely soldered into place the unit didn't function!  I could not get the meter to deflect with the leads shorted.  Wah, wah, wha... epic fail!

I soon discovered that if I raised the voltage, things returned to normal. So I tested it on a variable supply and found that it returned to normal over 6V. Being too lazy to rework the PCB much, I simply put a pair of diodes in the ground circuit to raise the output to 6.2V (Figure 1). If I was less lazy, I would have run a filter cap over the diodes also, but found that I could get away without.
Figure 1. 7805 regulator circuit used (for 6.2V)
My BNC test connector cannot be grounded, so I found a piece of saved orange crate plywood, painted it black and drilled a hole for it. I eventually got the unit pretty much done without the external case but ran into another problem (more about this later).

Figure 2 shows the internals of the unit -- large enough for an electrical outlet for the wall wart which delivers about 10 VDC without a load. 10V incidentally, is too much voltage for low ESR readings. So a regulator was needed.

Figure 2. Internals of the ESR unit. The PCB hanging down has the 7805 regulator.
The problem was the Fine/Coarse switch that I added to the front panel. When that switch was on Fine, a 47 ohm resistor was placed in parallel with the 10 ohm, to reduce the resistance ever so slightly from 10 ohms to 10||47=8.25 ohms. This provides wider spaced low resistance readings on the meter.

The problem turned out to be that the old switch I had used had an on resistance of several ohms! This drove me batty until I finally took the meter and read the switch resistance. So even with the 47 ohm resistor switched in, it ended up having no effect. After rummaging through the junk box again and measuring the on resistance this time, the issue was resolved with a better switch.

Figure 3 shows the unit re-assembled in the Sencore transistor tester case.

Figure 3. Assembled ESR meter. Zero pot at left, BNC for test leads in middle, power switch at upper right and Coarse/Fine switch below the power switch. BNCs at bottom are NC.

I suppose the lessons of the day includes:

  • Don't assume the last part of the build will be trivial
  • Don't assume switches will all measure 0 ohms, especially old ones!
  • Test with the intended supply voltage up front.
Thanks for reading.

Wednesday, 23 November 2016

ESR Project Build - Part 5 - Test Readings

With the opamp section soldered up and tested, I found that the range was a bit wider than I wanted. The designed range was good if you want to test down to 1 uF. However, to see more meter movement down near the 1 ohm range, I found that I could put a 47 ohm resistor in parallel with the 10 ohm resistor at the DUT terminal. This expands the scale near 1 ohms slightly, so that the readings vary between about 1 and 4 ohms. I plan to make this a "fine" switch setting on the finished meter assembly.

With the setting on "fine" you can measure about 100 uF and higher. Any caps below that, will read off scale (to the left). Turning the switch off (coarse), the unit does measure 1 uF and up.

Figure 1 below shows the Sencore transistor testor 100 uA meter that I used in the zeroed position (right).
Figure 1. ESR meter in zeroed position.
The remaining figures are readings while the switch is on "fine" at various resistances.
Figure 2. 1 ohm
Figure 3. 2 ohms
Figure 4. 3 ohms
Figure 5. 4 ohms
From these readings, you can see that on "fine" that the resistances spread out rapidly. With the switch set to coarse, 10 ohms reads about where figure 5's 4 ohm reading is. Then anything higher bunches to the left of that.

For switching power supplies where the capacitors are expected to have milliohm values of ESR, the "fine" setting should be suitable for identifying failed caps. It is still not the best arrangement for cherry picking caps because of its inability to read milliohm differences.

Later when the hardware build of the cabinet is done, I'll add some photos to the last part in this series. Thanks for reading!

Monday, 21 November 2016

ESR Project Build - Part 4 - Precision Rectifier + Meter

We've so far looked at the ~100 kHz oscillator, driver and gain stages. After the gain stage comes a precision rectifier and driver, which looks like this (Figure 1):

Figure 1. The Precision Rectifier and meter driver
I decided to breadboard this portion since I am substituting the LM358 for the AD8032, which the W2AEW design called for. The AD8032 is a bit pricey and harder to obtain (Mouser price for DIP was $8.11 US in single quantities). The AD8032 is a rail-to-rail opamp but this circuit only requires the bottom rail to function correctly.

The LM358 is a jelly bean part and operates at the V- rail (ground in this case). This part is targeted as a single supply solution. As a bonus, it uses the same pinout as the AD8032. The one other deviation from the W2AEW design is that my selected meter has a 100 uA movement instead of 200 uA. So instead of the 4.7k + 2.2k with 10k adjustment pot, I simply ran the output signal into a 100k trimpot (for this breadboard test), with the other leg of the pot going to ground. Then the meter went to the wiper arm of the pot with its negative lead going to ground. The full deflection is adjusted with the DUT leads shorted. In the final soldered up build, I'll arrange a protective limiting resistor for the meter in case the pot gets cranked.

The signal coming out of the LM358 precision rectifier and going into the driver (pin 5) appears as shown in Figure 2:
Figure 2. Input signal at LM385 pin 5

It is interesting to see that the signal actually does dip below ground by -590 mV. The positive swing of the signal goes up to 650 mV. This signal is generated when the DUT leads are shorted (zero ohms).

With the 1N4148 diode and the 0.1 uF filter cap connected, a DC voltage is established, which is then delivered to the meter. To calibrate, short the DUT leads and adjust the pot to give the meter full deflection like the old fashioned ohm meters.

Early testing has shown that low ESR values show very close to the shorted leads point on my meter. Any resistance over an ohm shows as a reading near the 10% deflection point. So presently, I found this meter to be extremely ESR sensitive.

Once you have a hammer, everything looks like a nail. So I went around the lab looking for caps to measure. All but one measured 100%. This failed cap was pulled out of an '80s power supply along with three others just like it. I had been debating whether or not to use these or to replace them in a power supply project. One of the four showed no deflection at all, while the remaining three all showed 100% good.

I also in-circuit tested this circuit on Intel Atom motherboards with caps and measured a few other boards. All indications look very good so far. Now I just need to find some time to solder this up in its final form.

In the next part, I'll present some pictures of my build into an old Sencore transistor tester case.

Sunday, 20 November 2016

ESR Project Build - Part 3 - Amp

In the amplifier input chain, we first encounter the DUT filter cap (0.1uF) and load resistor (100 ohms). This test signal conducted through the test capacitor is then AC coupled to the amplifier stage.
Figure. Device Under Test input

Amplifier


The amplifier Q1, is suggested as any general purpose signal transistor like the 2N2222 or 2N3904 etc. I chose the latter, though I had ready access to both. Figure 2 shows the basic common emitter amplifier configuration used.
Figure 2. 2N3904 Amplifier stage
The 100 ohm resistor in the emitter leg adds negative feedback and reduces the overall gain of the circuit. The input signal is coupled in with the 0.01 uF cap and then coupled out of the collector circuit with another 0.01 uF circuit.

This circuit should have been painless to add to the existing prototyped circuit, but try as I might to get the orientation of Q1 right, I got it backwards! Doh! After snipping out the failed part and replacing it with another with the correct orientation, the gain came up to what it should be (a transistor with emitter and collector reversed will still function but with low gain). Figure 3 illustrates the pinout for this device.

Figure 3. 2N3904 Pinout
The output of the amplifier stage taken from the collector's coupling capacitor is shown in Figure 4.
Figure 4. Amplifier stage output (at collector)
Here we can see that the output is 640 mVpp, with the DUT probes shorted (for zero ohms). Going out of the oscillator driver, I measured about 355 mVpp. With DUT probes shorted and the signal appearing across the 0.1 uF filter cap and 100 ohm resistor the signal coming in is about 157 mVpp (Figure 5).

Figure 5. Input signal arriving from DUT.
So if the input signal is 157 mVpp and the output voltage from Q1 is 640 mVpp, then this would represent an overall voltage gain of about 4. But don't forget that the stage also adds power gain.

Next up, we'll review the precision rectifier stage.