Showing posts with label battery. Show all posts
Showing posts with label battery. Show all posts

Tuesday, August 30, 2022

Making a "Word Metronome" for pacing of speech

Figure 1:
The completed "Word Metronome".  There are two recessed
buttons on the front and the lights on on the left side.
Click on the image for a larger version.
One of the things that my younger brother's job entails is to provide teaching materials - and this often includes some narration.  To assure consistency - and to fall within the required timeline - such presentations must be carefully designed in terms of timing to assure that everything that should be said is within the time window of the presentation itself.

Thus, he asked me to make a "word metronome" - a stand-alone device that would provide a visual cue for speaking cadence.  The idea wasn't to make the speech robotic and staccato in its nature, but rather providing a mental cue to provide pacing - something that is always a concern when trying to make a given amount of material fit in a specific time window:  You don't want to go too fast - and you certainly don't want to be too slow and run over the desired time and, of course, you don't want to randomly change your rate of speech over time - unless there's a dramatic or context-sensitive reason to do so.

To be sure, there are likely phone apps to do this, but I tend to think of a phone as a general-purpose device, not super-well suited for most of the things done with it, so a purpose-built, simple-to-operate device with visual indicators on its side that could just sit on a shelf or desk (rather than a phone, which would have to be propped up) couldn't be beat in terms of ease-of-use.

Circuitry:

The schematic of the Word Metronome is depicted in Figure 2, below:

Figure 2:
Schematic of the "Word Metronome"
(As noted in the text, the LiIon "cell protection" board is not included in the drawing).
Click on the image for a larger version.

This device was built around the PIC16F688, a 14 pin device with a built-in oscillator.  This oscillator isn't super-accurate - probably within +/-3% or so - but it's plenty good for this application.

One of the complications of this circuit is that of the LEDs:  Of the five LEDs, three of them are of the silicon nitride "blue-green" type (which includes "white" LEDs) and the other two are high-brightness red and yellow - and this mix of LED types poses a problem:  How does one maintain consistent brightness over varying voltage.

As seen in Figure 3, below, this unit is powered by a single lithium-ion cell, which can have a voltage ranging from 4.2 volts while on the charger to less than 3 volts when it is (mostly) discharged.  What this means is that the range of voltage - at least for the silicon nitride types of LEDs - can range from "more than enough to light it" to "being so dim that you may need to strike a match to see if it's on".  For the red and yellow LEDs, which need only a bit above two volts, this isn't quite the issue, but if one used a simple dropping resistor, the LED brightness would change dramatically over the range of voltages available from the battery during its discharge curve.

As one of the goals of this device was to have the LEDs be both of consistent brightness - and to be dimmable -  a different approach was required - and this required several bits of circuity and a bit of attention to detail in the programming.

The Charge Pump:

Perhaps the most obvious feature of this circuit is the "Charge Pump".  Popularized by the well-known ICL7660 and its many (many!) clones, this type of circuit may also be driven by a microcontroller and implemented using common parts.  Like its hardware equivalent, it uses a "flying capacitor" to step up the voltage - specifically, that surrounding Q1 and Q2.  In software - at a rate of several kHz - a pulse train is created, and its operation is thus:

  • Let is start by assuming that pin RC4 is set high (which turns off Q1) and pin RA4 is set low (which turns off Q2.)
  • Pin RA4 is set high, turning on Q2, which drags the negative side of capacitor C2 to ground.  This capacitor is charged to nearly the power supply voltage (minus the "diode drop") via D1 when this happens.
  • Pin RA4 is then set low and Q2 is turned off.
  • At this point nothing else is done for a brief moment, allowing both transistors to turn themselves off.  This very brief pause is necessary as pulling RC4 low the instant RA4 is set low would result in both Q1 and Q2 being on for an instant, causing "shoot through" - a condition where the power supply is momentarily shorted out when both transistors are on, resulting in a loss of efficiency.  This "pause" need only be a few hundred nanoseconds, so waiting for a few instruction cycles to go by in the processor is enough.
  • After just a brief moment pin RC4 is pulled low, turning on Q1, which then drags the negative side of C2 high.  When this happens the positive side of C2 - which already has (approximately) the power supply voltage is listed to a potential well above that of the power supply voltage.
  • This higher voltage flows through diode D3 and charges capacitor C4, which acts as a reservoir:  This voltage on the positive side of C4 is now a volt or so less than twice the battery voltage.
  • Pin RC4 is then pulled high, turning of Q1.
  • There is a brief pause, as described above to prevent "shoot through", before we set RA4 high and turn Q2 on for the next cycle.

It is by this method that we generate a voltage several volts higher than that of the battery voltage, and this gives us a bit of "headroom" in our control of the LED current - and thus the brightness.

Current limiter:

Transistors Q3 and Q4 form a very simple current limiter:  In this case it is "upside-down" from the more familiar configuration as it uses PNP transistors - something that I did for no particular reason as the NPN configuration would have been just fine.

Figure 3:
Inside the "Word Metronome".  The 18650 LiIon cell is on
the right - a cast-off from an old computer battery pack.  The
buttons on the board are in parallel with those on the case and
were used during initial construction/debugging.
Click on the image for a larger version.

This circuit works by monitoring the voltage across R3:  If this voltage exceeds the turn-on threshold of Q3 - around 0.6 volts - it will turn on, and when this does it pulls the base voltage, provided by R5, toward Q4's emitter, turning off Q3.  By this action, the current will actually come to equilibrium at that which results in about 0.6 volts across R3 - and in this case, Ohm's law tells us that 0.6 volts across 47 ohms implies (0.6/47=0.0128 amps) around 13 milliamps:  At room temperature, this current was measured to be  a bit above 14 milliamps - very close to that predicted.

With this current being limited, the voltage of the power supply has very little effect on the current - in this case, that through the LEDs which means that it didn't matter whether the LED was of the 2 or 3 volt type, or the state-of-of charge of the battery:  The most that could ever flow through an LED no matter what was 14 milliamps.

With the current fixed in this manner, brightness could be adjusted using PWM (Pulse Width Modulation) techniques.  In this method, the duty cycle ("On" time) of the LED is varied to adjust the brightness.  If the duty cycle is 100% (on all of the time) the LED will be at maximum brightness, but if the duty cycle is 50% (on half of the time) the LED will be at half-brightness - and so-on.  Because the current is held constant, no matter what by the current limiter circuit, we know that the only think that affects brightness of the LED is the duty cycle.

LED multiplexing:

The final aspect of the LED drive circuitry is the fact that the LEDs are all connected in parallel, with transistors Q5-Q9 being used to turn them on.  When wiring LEDs in parallel, one must make absolutely sure that each LED is of the exact-same type or else that with the lowest voltage will consume the most current.

In this case, we definitely do NOT have same-type of LEDs (they are ALL different from each other) which means that if we were to turn on two LEDs at once, it's likely that only one of them would illuminate:  That would certainly be the case if, say, the red and blue LEDs would turn on:  With the red's forward voltage being in the 2.5 volt area, the voltage would be too low for the green, blue or white to even light up.

What this means is that only ONE LED must be turned on at any given instant - but this is fine, considering how the LEDs are used.  The red, yellow or green are intended to be on constantly to indicate the current beat rate (100, 130 or 160 BPM, respectively) with the blue LED being flashed to the beat (and the white LED flashing once-per-minute) - but by blanking the "rate" LED (red, yellow or green) LED when we want to flash the blue or white one, we avoid the problem altogether.

Battery charging:

Not shown in the schematic is the USB battery charging circuit.  Implementing this was very easy:  I just bought some LiIon charger boards from Amazon.  These small circuit boards came with a small USB connector (visible in the video, below) and a chip that controlled both charging and "cell protection" - that is, they would disconnect the cell if the battery voltage got too low (below 2.5-2.7 volts) to protect it.  Since its use is so straightforward - and covered by others - I'm only mentioning it in passing.

Software:

Because of its familiarity to me, I wrote the code for this device in C using the "PICC" compiler by CCS Computer Systems.  As it is my practice, this code was written for the "bare metal" meaning that it interfaces directly with the PIC's built-in peripherals and porting it to other platforms would require a bit of work.

The unit is controlled via two pushbuttons, using the PIC's own pull-up resistors.  One button primarily controls the rate while the other sets the brightness level between several steps, and pressing and holding the rate button will turn it off and on.  When "off", the processor isn't really off, but rather the internal clock is switched to 31 kHz and the charge pump and LED drivers are turned off, reducing the operating current of the processor to a few microamps at most.

Built into the software, there is a timer that, if there is no button press within 90 minutes or so, will cause the unit to automatically power down.  This "auto power off" feature is important as this device makes no noise and it would be very easy to accidentally leave it running.

Below is a short (wordless!) video showing the operation of the "Word Metronome" - enjoy!

 


This page stolen from ka7oei.blogspot.com

[END]


Tuesday, September 12, 2017

Using an inexpensive MPPT controller in a portable solar charging system

As I'm wont to do, I occasionally go backpacking, carrying (a bit too much!) gear with me - some of it being electronic such as a camera, GPS receiver and ham radio(s).  Because I'm usually out for a week or so - and also because I often have others with me that may also have battery-powered gear, there arises the need for a way to keep others' batteries charged as well.

Having done this for decades I've carried different panels with me over that time, wearing some of them out in the process, so it was time for a "refresh" and a new system using both more-current technology and based, in part, on past lessons learned.

Why 12 volt panels?

If you look about you'll find that there are a lot of panels nowadays that are designed to charge USB devices -which is fine if all you need to do is charge USB devices, but many cameras, GPS receivers, radios and other things aren't necessarily compatible with being charged from just 5 volts.  The better solution in these cases is to start out with a higher voltage - say that from a "12 volt" panel intended for also keeping a car battery afloat - and convert it down to the desired voltage(s) as needed.

After a bit of difficulty in finding a small, lightweight panel that natively produced the raw "12 volts" output from the array (actually, 16-22 volts unloaded) I found a 18 watt folding panel that weighed just a bit more than a pound by itself.  It happened to also include a USB charge socket - but can be hard to find one without that accessory!
Figure 1:
The 6-7aH LiFePO4 battery, MPPT controller and "18 watt" solar panel.
The odd shape of the LiFePO4 battery is due to its being intended to power
bicycle lighting, fitting in a water bottle holder.
Click on the image for a larger version.

By operating at "12 volts" you now have the choice of practically any charging device that can be plugged into a car's 12 volt accessory socket (e.g. cigarette lighter) and there are plenty of those about for nearly anything from AA/AAA chargers for things like GPS receivers and flashlights to those designed to charge your camera.  An advantage of these devices is that nowadays, they are typically very small and lightweight, using switching power converters to take the panels voltage down to what is needed with relatively little loss.

But there is a problem.

If you use a switching power converter to take a high voltage down to a lower voltage, it will dutifully try to maintain a constant power output - which means that it will also attempt to maintain a constant power input as well - and this can lead to a vexing problem.


Take as an example of a switching power converter that is 100% efficient, charging a 5 volt device at 2 amps, or (5 volts * 2 amps =) 10 watts.

If we are feeding this power converter with 15 volts, we need (10 watts / 15 volts =) 0.66 amps, but if we are supplying it with just 10 volts, we will need (10 watts / 10 volts =) 1 amp - all the way down to 2 amps at 5 volts.  What this means is that while we always have 10 watts with these differing voltages, we will need more current as the voltage from the panel goes down.

Now suppose that we have a 15 watt solar panel.  As is the nature of solar panels, there is a "magic" voltage at which our wattage (volts * amps) will be maximum, but there is also a maximum current that a panel will produce that remains more or less constant, regardless of the voltage.  What this means is that if our panel can produce its maximum power at 15 volts where it is producing 1 amps, if we overload the panel slightly and cause its voltage to go down to, say, 10 volts, it will still be producing about 1 amp - but only making (10 volts * 1 amp =) 10 watts of power!  Clearly, if we wish to extract maximum power to make the most of daylight we will want to pick the voltage at which we can get the maximum power.

Dealing with "stupid" power converters:

Suppose that, in our example, we are happily producing 10 watts of power to charge that 5 volt battery at 2 amps.  At 15 volts, we need only 0.66 amps to get that 10 watts, but then a black cloud comes over and the panel can now produce only 0.25 amps.  Because our switching converter is "stupid", it will always try to pull 10 watts - but when it does so, the voltage on its input, from the panel, will drop.  In this scenario, our voltage converter will pull the voltage all of the way down to about 5 volts - but since the panel can only produce 0.25 amps, we will be charging with only (5 volts * 0.25 amps =) 1.25 watts.


Now, the sun comes out - but the switching converter, being stupid, is still trying to pull 10 watts, but since it has pulled the voltage down to 5 volts to charge the battery, we will need 2 amps to feed the converter the 10 watts that it will need to be happy, but since our panel can never produce more than an amp, it will be stuck there, forever, producing about only (5 volts * 1 amp =) 5 watts.

If we were to disconnect the battery being charged momentarily so that the switching converter no longer saw its load and needed to try to output 10 watts, the input voltage would go back up to 15 volts - and then when we reconnected the battery, it would happily pull 0.66 amps at 15 volts again and resume charging the battery at 10 watts - but it will never "reset" itself on its own.

What this means is that you should NEVER connect a standard switching voltage converter directly to a solar panel or it will get "stuck" at a lower voltage and power if the available panel output drops below the required load - even for a moment!

Work-arounds to this "stuck regulator" problem:


The Linear regulator

One obvious work-around to this problem where a switching regulator gets "stuck" is to simply avoid using them, instead using an old-fashioned linear regulator such as an LM317 variable regulator or a fixed-voltage regulator in the 78xx series (e.g. 7805 for our 5 volt example).  This type of regulator, if outputting 1 amp, will also require an input of 1 amp, the difference in voltage being lost as heat.  If a black cloud comes over - or it is simply morning/evening with less light - and the panel outputs less current, that lower current will simply be passed along to the load.

The problem with a linear regulator is that it can be very inefficient, particularly if the voltage is being dropped significantly.  For example, if you were to charge the 5 volt device at 1 amp from a panel producing 15 volts, your panel would be producing (15 volts * 1 amp =) 15 watts, you would be charging your device at (5 volts * 1 amp =) 5 watts, but your linear regulator would be burning up the difference -10 watts of heat - wasting most of the energy.  On the up side, it simply cannot get "stuck" like a switching converter, it is very simple, it will cause no radio interference, and it is nearly foolproof in its operation.

Figure 2:
The front of the EvilBay "5 amp MPPT charger".  This unit is
an inexpensive unit that used the "Constant Voltage" algorithm (see
below) and designed primarily to charge lithium chemistry batteries.
One of the potentiometers is used to set the final charge voltage - between
14.2 and 14.6 volts for a "4 cell" LiFePO4 - and the other is set to the "maximum
power voltage" of the panels to which it is connected.  This unit- as do most
inexpensive units -require that the MPPT voltage of the panels be 2-3 volts
higher than the final charge voltage of the battery being charged.
Click on the image for a larger version.

MPPT power controller

A better solution in terms of power utilization would be to use a more intelligent device such as an MPPT (Maximum Power Point Tracking) regulator.  This is a "smarter" version of the switching regulator that, by design, avoids getting "stuck" by tracking how much power is actually available from the solar panel and never tries to pull more current than is available.  For this discussion we'll talk about the two most common types of MPPT systems.

"Perturb and Observe" MPPT:

This method monitors both the current and voltage being delivered by the panel and internally, calculates the wattage (e.g. volts * amps) on the fly and under normal conditions, and it will change the amount of current that it is trying to pull from the panel up and down slightly to see what happens, hence the name "Perturb and Observe" (a.k.a. "P&O").

For example, suppose that our goal is to get the maximum amount of power and our panel is producing 15 volts at 1 amp, or 15 watts.  Now, the MPPT controller will try to pull, say, 1.1 amps from the panel.  If the panel voltage drops slightly to 14.5 volts so we are now supplying (1.1 amps * 14.5 volts =) 15.95 watts and we were successful in pulling more power to be delivered to our load.  Now, it will try again, this time to pull 1.2 amps from the panel, but it finds that when it does so the panel voltage drops to 12.5 volts and we are now getting (1.2 amps * 12.5 volts =) 15 watts - clearly a decrease!  Realizing its "mistake" it will quickly go back to pulling 1.1 amps to get back to the setting where it can pull more power.  After this it may reduce its current to 1 amp again to "see" if things have changed and whether or not we can get more power - or if, perhaps, the amount of sunlight has dropped - such that trying to pull less current is the optimal setting.

By constantly "trying" different current combinations to see what provides the most power it will be able to track the different conditions that can affect power output of the solar panel - namely the amount of sun hitting it, the angle of that sun and to a lesser extent, the temperature of the solar panel.

Figure 3:
Curves showing the voltage versus current of a typical solar cell.  Once
the current goes above a certain point, the voltage output of a cell
drops dramatically.  The squiggly, vertical line indicates where
the maximum power (e.g. volts * amps) is obtained along the curve.
The upper graphs depict a typical curve with larger amounts
of light while the lower graphs are for smaller amounts of
impinging light.
This graph is from the Wikipedia article about MPPT - link. 
Click on the image for a slightly larger version.
"Constant Voltage" MPPT:

If you look at the current-versus-voltage curve of a typical solar panel as depicted in Figure 3 you'll note that there is a voltage at which the most power (volts * amps) can be produced (the squiggly vertical line) - a value typically around 70-80% of the open-circuit voltage, or somewhere in the area of 15-18 volts for a typical "12 volt" solar panel made these days.

Note:
Many "12 volt" panels currently being made are intended for use with MPPT controllers and have a bit of extra voltage "overhead" as compared to "12 volt" panels made many years ago before MPPT charging regimens were common.  What this means is that a modern "12 volt" panel may have an maximum power point voltage of 16-17 volts as opposed to 14-15 volts for an "older" panel made 10+ years ago.

One thing that you might notice is that, at least for higher amounts of light, the optimal voltage for maximum power for our hypothetical is about the same - approximately 0.45 volts per cell.  We can, therefore, design an MPPT circuit that is designed to cause the panel to operate only at that optimum voltage:  If the sunlight is reduced and the voltage starts to drop, the circuit will decrease the current it is pulling, but if the sunlight increases and the voltage starts to rise, it will increase the current to pull the voltage back down.


This method is simpler and cheaper to implement than the "Perturb and Observe" method because one does not need to monitor the current from the panel (e.g. it cares only about the voltage) and there does not need to be a small computer or some sort of logic to keep track of the previous adjustments.  For the Constant Voltage (e.g. "CV") method the circuit does only one thing:  Adjust the current up and down to keep the panel voltage constant.

As can be seen from Figure 3, the method of using "one voltage for all situations" is not optimal for all conditions as the voltage at which the most power can be obtained changes with the amount of light, which also changes with the temperature of the panel, age, shading, etc.  The end result of this rather simplistic method of optimization is that one ends up with somewhat lower efficiency overall - around 80% of the power that one might get with a well-performing P&O scheme according to some research. Ref. 1

This method can be optimized somewhat if the circuit is adjusted for maximum power output under "typical" conditions that one might encounter.  For example, if the CV voltage is adjusted when the panel is under (more or less) maximum sun on a typical day, it will produce power most efficiently when the solar power production is at its highest and making the greatest contribution to the task at hand - such as charging a battery.  In this case, it won't be optimized as well when the illumination is lower (e.g. morning or evening) but because the amount of energy available during these times will be lower anyway, a bit of extra loss from the lack of optimization at those times will be less significant than the same percentage of loss during peak production time.

Despite the lower efficiency, the Constant Voltage method is often found as a single-chip solution to implement low-cost MPPT, providing better performance than non-MPPT alternatives.

Actual implementation:

I was able to find an inexpensive (less than US$10, shipped) MPPT charge control board on EvilBay (called "5A MPPT Solar Panel Regulator Battery Charging") that was adjustable to allow its use with solar panels with open-circuit voltages ranging from 9 to 28 volts and its output being capable of being adjusted from 5 to about 17 volts.  This small board had built-in current regulation set to a maximum of 5 amps - more than adequate for the 18 watt panel that I would be using.

From the pictures on the EvilBay posting - and also once I had it in-hand - I could see that it used the Consonance CN3722 MPPT chip. Ref. 2  This chip performs Constant Voltage (CV) MPPT functions and provides a current-regulated output with the components on the EvilBay circuit board limiting the current to a maximum of 5 amps.  Additionally, this board, when used to charge a battery directly, may be adjusted, using onboard potentiometers, to be optimized for the solar panel's Maximum Power voltage (typically called "Vmp" in panels' specifications) and adjusted for the finish charge voltage for the battery itself, being suitable for many types of Lithium-Ion chemistries - including the "12 volt" LiFePO4 that I was going to use.
Figure 4:
The back side of the MPPT controller showing the heat sink and connections.
The heat sink is adequate for the ratings of this unit.  To save weight and bulk,
the unit was not put in a case, but rather the wires "zip tied" to the mounting
holes to prevent fatiguing of the wires - and to permit the wires themselves to
to offer a bit of protection to the top-side components.
Click on the image for a larger version.

To this end, my portable charging system consists of the solar panel, this MPPT controller and a LiFePO4 battery to provide a steady bus voltage compatible with 12 volt chargers and devices.  By including this "ballast" battery, the source voltage for all of the devices being charged is constant and as long as the average current being pulled from the battery is commensurate with the average solar charging current, it will "ride through" wide variations in solar illumination.  This method has the obvious advantage that a charge accumulated throughout the day can be used in the evening/night to charge those devices or even be used to top off batteries when one is hiking and the panel may not be deployed.

Tweaking the "Constant Voltage" MPPT board:

As noted, the EvilBay CN3722 board had two trimmer potentiometers:  One for setting the output voltage - which would be the "finish" charge voltage for the battery and another for setting the Constant Voltage MPPT point for the panel to be used.

Setting the output voltage is pretty easy:  After connecting it to a bench supply set for 4-6 volts above the desired voltage I connected a fairly light load to the output terminal and set it for the proper voltage.  For a "12 volt" LiFePO4 battery, this will be between 14.2 and 14.6 volts while the setting for a more conventional "12 volt" LiIon battery would be between 16.2-16.8 volts, depending on the chemistry and desired finish voltage. Ref. 3  Once this adjustment has been done I connected a fully-charged battery to the output along with a light load and power-cycled the MPPT controller and watched it as it stabilized, readjusting the voltage as necessary.

Setting the MPPT voltage is a bit tricker.  In this case, a partially discharged battery of the same type and voltage that will be ultimately used as was adjusted above is connected to the output of the MPPT controller in series with an ammeter on the output.  With the solar panel that is to be used connected and laid out in full sun, the "MPPT Voltage" potentiometer is adjusted for maximum current into the battery being charged.  Again, this step requires a partially-discharged battery so that it will take all of the charging current that is available from the panel.

Note that the above procedure also presumes that the solar panel is too small to produce enough power to cause the MPPT battery charger itself to go into current limiting - in which case, the current limit is that of the panel itself - which means that the maximum current that is seen at the charging terminal of the battery reflects the maximum power that can be pulled from the panel.  For example, with a panel producing 18 watts and charging a battery at 13.5 volts we could only ever expect to see about 1.33 amps flowing into the battery due to the inability of the panel to supply more power, but maximizing this current by adjusting the "MPPT" voltage control permits optimization for that particular solar panel.

If the panel is large enough to cause the MPPT controller to current-limit its charging current (around 5 amps for the MPPT controller that I used) then it may be that the panel is oversized slightly for the task - at least at midday, when there is peak sun.  In that case one would make the same adjustment in the morning or evening when the amount of light was low enough that the panel could not cause the charger to current-limit or simply block a section of the panel.

While this charging board would be able to connect directly to almost any rechargeable Lithium battery, it would be awkward try to adapt it for each type of battery that one might need to charge "on the trail" so I decided to carry with me a small "12 volt" LiFePO4 battery as well:  The solar panel and MPPT controller would charge that battery and then the various lightweight "12 volt" chargers for the different batteries to be charged would connect to it.

Its worth noting that MPPT power controllers use switching techniques to do the efficient conversion of voltage.  What this means is that if, attached to - or nearby - is a sensitive radio - particularly an  HF (shortwave) transceiver - the switching operation of the MPPT controller may cause interference unless the controller is enclosed in an RF-tight box with appropriate filtering on the input and output leads.  In practice I haven't found this to be an issue as any HF operation is usually done in the evening, at camp, as things are winding down and the sun isn't out, anyway, so the unit is not in service at that time.

Final comments

While the "ballast battery" method has an obvious weight and volume penalty, it has the advantage that if you need to charge a number of different devices, it is possible to find a very small and light 12 volt "car" charger for almost any type of battery that you can imagine.  The other advantage is that with a 12 volt battery that is being charged directly from the MPPT controller, it acts as "ballast", allowing the charging of this "main" battery opportunistically with the available light as well as permitting the charging of the other batteries at any time - including overnight!

The 18 watt panel weighs 519 grams (1.14 pounds), the MPPT charge controller with attached wires and connectors weighs 80 grams (0.18 pounds), a cable connecting the panel to the MPPT controller weights 60 grams (0.13 pounds) while the 6-7 amp-hour LiFePO4 battery pictured in Figure 1 . Ref. 4  weighs in at 861 grams (1.9 pounds).   The total weight of this power system is about 1520 grams (3.35 pounds) - which can be quite a bit to carry in a backpack, but considering that it can provide the power needs of a fairly large group and that this weight can be distributed amongst several people, if necessary, it is "tolerable" for all but those occasions where it is imperative that there is the utmost in weight savings.  For a "grab and go" kit that will be transported via a vehicle and carried only a short distance this amount weight is likely not much of an issue.


* * *
References:

1 - The article "Energy comparison of MPPT techniques for PV Systems" - link - describes several MPPT schemes, how they work, and provides comparison as to how they perform under various (simulated) conditions.

2 - Consonance Electric CN3722 Constant Voltage (CV) MPPT multichemistry battery charger/regulator - Datasheet link.

3 - Particularly true for LiIon cells, reducing the finish (e.g. cut off) voltage by 5-10%, while reducing the available cell capacity, can improve the cell's longevity.  What this means is that if the cut-off voltage of a typical modern LiIon cell, which is nominally 4.2 volts, is reduced to 4.0 volts, all other conditions being equal this can have the potential to double the useful working life.  While this lower cut off voltage may initially reduce the available capacity by as much as 25%, a cell consistently charged to the full 4.2 volts will probably lose this much capacity in a year or so, anyway whereas it will lose much less capacity than that at the lower voltage.  For additional information regarding increasing the longevity of LiIon cells see the Battery University web page "How to Prolong Lithium-based Batteries" - link and its reference sources.

4 - This LiFePO4 battery has been featured several times before - see these links:
  • Problems with LiFePO4 batteries - link
  • Follow-up:  LiFePO4 batteries revisited - equalization of cells - link


    [End]

This page stolen from "ka7oei.blogspot.com".
 

Wednesday, January 25, 2017

A microcontroller-based A/B Battery replacement for the Zenith TransOceanic H-500 radio, with filament regulation

A friend recently gave me an old Zenith TransOceanic (ZTO) H-500 and after re-aligning it to get it into proper working condition I decided that I wanted a battery pack for it - both for "completeness" as part of making it look as original as possible and to allow the radio to be used outdoors, away from interference sources.  While it might be said that the GoogleWeb is lousy with options to replace the obsolete "A/B" battery used to power the Zenith TransOceanic, that wasn't a deterrent for me to design and build yet another one.

Even though it is easy to use a lot of 1.5 cells and 9 volt batteries to get the 9 and 90 volts required to operate the radio, I decided to do something different.

Figure 1:
The faux A400 "AB" battery, installed and working in the Zenith Trans
Oceanic H-500.  Contained therein are eight "D" type cells and circuitry
to produce the 90 volt "B" voltage and a regulated 9 volts for the
filament supply.
Click on the image for a larger version.
I threw a computer at it.

While it might seem odd to wield a microcontroller to solve a relatively simple problem on an antique, tube-type radio, it does make sense in a few ways as I'll outline below.

Design goals:

There are several things that I decided that this voltage converter should do:
  • Automatically power up when the radio is turned on and shut down when it is turned off. 
  • Cause no interference to radio reception.
  • Consume minimal current when the radio is turned off.
  • Produce a regulated B+ voltage so that radio performance is consistent.
  • Regulate the filament voltage so that the radio functions properly even when the battery is mostly discharged so that maximum use can be made of its total capacity.
While I was at it I decided that it should be able to do a few other things as well:
  • If the radio is on for a long time (e.g. more than about 2 hours) do a "power save" shut down to (hopefully) prevent the batteries from being completely flattened.
  • "Lock out" the operation of the radio if the batteries are already extremely low.  Avoidance of completely killing the battery may reduce the possibility of their leaking.

Generating the "B+" voltage:

The "B Battery" (high voltage) needs of the ZTO are rather modest:  Approximately 90 volts at 5-20 milliamps.  Aside from using a battery of sixty 1.5 volt cells or ten 9 volt batteries in series there are two common ways to generate this sort of voltage electronically:
  • Use a step-up transformer to take the low battery voltage to the appropriate B+ potential, typically using a low-voltage mains transformer in "reverse" (e.g. applying drive to the secondary, rectifying high voltage from the primary.)
  • The use of a simple boost-type converter using a single inductor.
The first method has the advantage that it is possible to design it such that the switching of the driving transistors is "slow" enough (at a modest efficiency loss) that it does not produce harmonics that may be picked up by the receiver - even at the lowest receive frequencies, and without shielding.  If you are interested in a good discussion of this method visit Ronald Dekker's excellent page on the subject (link).
 
Figure 2:
Test circuit to determine the suitability of various inductors and transistors
and to determine reasonable drive frequencies.  Diode "D" is a high-speed,
high-voltage diode, "R" can be two 10k 1 watt resistors in parallel and
"Q" is a power FET with suitably high voltage ratings (>=200 Volts)
and a gate turn-on threshold in the 2-3 volt range so that it is suitable
to be driven by 5 volt logic.  V+ is from a DC power supply that is
variable from at least 5 volts to 10 volts.  The square wave drive, from a
function generator, was set to output a 0-5 volt waveform to
make certain that the chosen FET could be properly driven by a 5 volt
logic-level signal from the PIC as evidenced by it not getting perceptibly
warm during operation.

The second method - and the one that I chose - uses a boost-type converter as depicted in Figure 2.  The switching frequency must be much higher than one would use with an ordinary mains transformer, typically in the 5-30 kHz range if one wishes to keep the inductance and physical size of that inductor reasonably small.  With these higher frequencies and the typically "square" drive signals (which are rich in harmonic content) needed to obtain good efficiency, there is a much greater likelihood that it will interfere with reception - particularly in the AM broadcast band.  While a bit of a nuisance, the interference potential may be easily mitigated by putting the entire circuit in a metal box and appropriately bypassing and filtering the leads in and out.

Raiding my inductor drawer I picked a few "power" devices (those capable of handling at least half an amp) in the range of 100μH and 1 mH and threw together the circuit in Figure 2, consisting of a high-voltage FET (Q), the inductor under test (L), a high voltage, high speed diode (D), a 22μF, 160 volt capacitor (C) and a 5.6k, 2 watt load resistor (R).  Connecting the FET's gate to the square wave (50% duty cycle) TTL-level output of a signal generator I measured each one in terms of output voltage, total output power and overall power conversion efficiency with respect to frequency.

As would be dictated by the plethora of design articles on the subject - not to mention data sheets of switching regulator chips - I noted that neither the value of the inductance or switching frequency was particularly critical to achieve the desired results.  In general, higher inductances produce a bit more output at the lower frequencies (a few kHz) while the lower inductances worked a bit better in the 10-30 kHz range, but all of the inductors did work over the entire range to a greater or lesser degree.  Settling on a decent-sized 330μH inductor - a value that is not particularly critical - I proceeded with the circuit design.

Figure 3:
Schematic diagram of the voltage converter.  See text for details.
Click on the image for a larger version.
The circuit:

Rather than go through a lot of theory I'll just describe the circuit that I designed and built - See Figure 3, above.

When the radio's power switch is turned on its filament circuit is connected and a voltage appears across the "Batt-" and "A-" leads and R7, a 10k resistor connected across switched-off FET Q4 which are in series with the filaments.  When this happens transistor Q3 is turned on, pulling the base of Q1, a PNP transistor in the high side of the BATT+ line, toward ground and turning it on and applying power to U3, a 78L05 voltage regulator, and microcontroller U1, a PIC12F683.  After a short initialization delay the microcontroller activates the "PWR_SW" line, turning on Q2 which assures that Q1 is always turned on even if the filament switch is turned off abruptly and Q3 turns off or, as we shall see, when the battery voltage is at or below the filament regulator's set point.

At this point the microcontroller enables interrupt-driven code to produce the high voltage (B+) output by monitoring it via resistor divider R18/R19/R20:  If the voltage is below the threshold, the duty cycle of the PWM signal output on the "SW_DRIVE" line is increased to force more energy storage in the inductor (L1) - up to a maximum limit of around 80%, set in software.  If the voltage is above the threshold, the duty cycle is decreased - down to zero and even into "discontinuous" mode (e.g. the PWM signal intermittently turned off and on) if necessary as would be the case if there were no load on the output.  In this way the output voltage is appropriately regulated, typically to 90 volts as set by R19.  In this circuit, when the PWM signal turns off Q5, the high voltage FET, the magnetic field in L1 collapses and induces a high voltage across it.  The current resulting from this field collapse is rectified by high-speed, high-voltage diode D2 and stored and filtered by C8 and additionally filtered and smoothed by R21 and C9.
Figure 3:
The (mostly complete) converter board.  The high-voltage FET (Q5) is
in the lower left corner while the filament regulator FET is in the lower-
right corner.  In the upper right corner is U2, the rail-to-rail dual op-amp
that is part of the filament regulator.  Because of the very small amount of
heat being dissipated by any component, no heat sinks were required.
The high voltage filtering components and the optoisolator are in the
upper left corner.
No circuit board is available - but if you design one, I'd be happy
to post information about it and give you credit! 
Click on the image for a larger version.

Because the battery voltage could be as high as 16 volts if ten fresh "1.5" volt cells were used it is necessary to regulate the filament voltage down to something around 8.0-9.0 volts, the precise voltage chosen by the constructor and set via R14.  Op amp section U2b is configured as a "difference amplifier" (a.k.a. subractor) that measures the voltage difference between the "A-" and the "A+" lines (the filament supply to the radio) and this calculated voltage difference is output from U2b and applied to the inverting input of U2a via scaling potentiometer R14.  The voltage at the inverting input of U2a as set by this potentiometer is compared to the "reference" voltage applied to its non-inverting input and if the voltage is low, its output voltage is increased so that FET Q4, which is placed between the A- and BATT- connections, conducts more to increase the filament voltage.  Conversely, if the voltage is too high, the output voltage of U2a to Q14's gate is reduced, decreasing its conductivity.

The use of the circuitry of U2b is necessary because neither the A- or A+ (filament) leads are referenced to the circuit ground (e.g. they are sort of "floating") which makes it necessary to measure the difference between those two leads to ascertain the actual filament voltage.  If the battery voltage does get low enough that Q4 is completely "on", the voltage across R7 will disappear and Q3 will turn off:  It is because this can happen that we must have activated Q2 to keep the microcontroller's power turned on and this is also why we cannot use the same voltage drop that we used to tell if the radio was turned on to also detect if the filament current has ceased to flow when the radio is turned off.

Note:  It would have been possible to have used the microcontroller to regulate the filament voltage in a manner similar to that in which the high voltage is produced, but a programming bug or crash could cause the fragile, expensive tubes to be exposed to the full battery voltage whereas a malfunction of the high voltage generator is unlikely to cause damage to the radio.

A short time after the high voltage converter is enabled the "FIL_SW" line is set high.  Because the microcontroller has low-impedance FET output drivers, this pin's voltage is essentially that of the 5 volt regulator and it is used as the filament voltage reference.  Similarly, if the microcontroller sets the "FIL_SW" line low (zero volts) this will shut off the filament supply.

With the use of a MOSFET (e.g. Q4) as the filament control device, the series regulation of the filament has a very low drop-out voltage - that of the voltage drop across the FET, limited by its own "on" resistance, and the wiring used to carry the filament current - and this drop can be as low a few 10s of millivolts.  What this means is that if the filament voltage is set to 9.0 volts by R14, as long as the "A" battery voltage exceeds that by a few 10s of millivolts, the filament will always be maintained exactly 9.0 volts but if the "A" supply (battery voltage) drops below 9.0 volts, Q4 will be turned fully on and the filament voltage will be within 10-20 millivolts of that battery voltage.  Compared with the operation of a typical "low dropout" regulator IC that has around 0.15-0.3 volts drop, the circuit used here offers a lower voltage drop and better radio performance in those situations, particularly when even a few tenths of a volt can make a lot of difference!
Figure 4:
Inside the completed voltage converter.  All leads going in and out are
bypassed with low-ESR electrolytic capacitors and further filtered with
series chokes as shown in Figure 3.  The use of a completely shielded
enclosure (top not shown) is necessary as direct E-field radiation from the
circuit will otherwise be heard on the radio.  This box is made from
cut pieces of circuit board material, soldered at the seams inside and out,
with cut-in-half nickel-plated brass standoffs soldered to the board being
used to support the circuit and at the corners to attach the lid.
Click on the image for a larger version.

A second or so after the application of the filament voltage - enough time for the tubes to warm up - the microcontroller starts to "look" at the current drawn on the B+ lead as detected by U4, an opto-isolator that is in series with this supply.  Once the tubes warm up and begin drawing current, U4's internal LED turns on, activating its internal phototransistor which then pulls the "HV_IMON" (high voltage current monitor) line low, indicating to the microcontroller that the radio is now operating.  At this point the microcontroller is in a mode where it will repeatedly check to see that current is drawn by the radio on the high voltage line.

When the radio is turned off the current on the B+ line will disappear due the loss of the tubes' emission caused by the filaments being turned off and, possibly, the B+ line being disconnected.  When this happens the LED in optoisolator U4 will turn off, its phototransistor will stop conducting, and the "HV_IMON" line will be pulled high indicating to the microcontroller that the radio has been turned off.  After a short "debounce" period to verify that this loss of current wasn't due erroneously detected, the microcontroller will shut off the high voltage generator, set the "FIL_SW" line low, powering down the filament regulator, and then set the "PWR_SW" line low which then disconnects the microcontroller's power source from the BATT+ line, removing load from the battery.

How the high-voltage supply works in software:

The PIC12F683 has several very helpful peripherals on board:  An A/D (analog-to-digital) converter, an on-board clock oscillator, and a hardware-based PWM (Pulse-width modulation) generator.  To obtain the necessary switching rate for the power supply/inductor combination, a PWM rate of 15.624 kHz was chosen which, with the setting of the peripherals, allowed for 9 bits of PWM resolution - these choices being dictated by the processor's internal 8 MHz clock with respect to the desired PWM rate and the inductor value..

On the diagram in Figure 3, above, may be seen resistors R18, R19 and R20 that form an adjustable voltage divider, taking the (nominal) 90 volts from the "B+" supply down to approximately 3 volts:  R19 is made variable so that the resulting output voltage may be adjusted.  The wiper of R19 is bypassed with C7, a 0.01uF capacitor to both suppress switching noise from the voltage converter and also to provide a minimum AC input impedance for the PIC's A/D input - an important consideration for practically any microcontroller with a built-in A/D converter.

In the software there is an interrupt service routine that occurs at the same rate at the PWM update and in that routine, the A/D converter's input multiplexer is switched between monitoring the divided-down high voltage ("HV_VMON") and the divided-down battery voltage ("VBATT_MON") a process that requires several steps that span interrupt cycles, as in:
  • Get the most recent result from the A/D converter and set a flag that indicates new data is available for this A/D input.  We then switch to the "other" A/D's multiplex input because we can't start the A/D converter at this point since it takes a finite amount of time for the input to settle. (5 microseconds is a reasonable time for this device when operating at 5 volts.)
  • By the time the next interrupt has occurred, the A/D MUX has settled so the A/D converter is started.
  • By the time the next interrupt has occurred, the A/D conversion has finished, so the result is obtained and the A/D multiplexer is switched to the "other" input and its "data ready" flag is set.
Because we aren't getting new voltage data every time the interrupt occurs we have to wait until we get a new reading of the high voltage supply before we can make any adjustment.  When an interrupt occurs and the flag indicates that we have a new A/D reading, we compare the voltage with a preset value in firmware (approximately 2/3 scale of the A/D converter) and if the voltage is lower than the threshold, the PWM duty cycle is increased by one count, but if the voltage is higher than the threshold, the PWM value is decreased by one count.  Included in this algorithm is a "window" comparison:  If the voltage is out of bounds by more than about 10%, an "extra" count up or down is added.

As with any PWM implementation - hardware or software - the is an enforced limit of the maximum duty cycle - about 80% in this case:  Were this limit not enforced, the duty cycle could go to 100% and short out the power supply - and that would not be good!

Because the PWM value is not being updated on every ISR cycle, there is a lag in the feedback loop - and this can result in instability of the high voltage supply if one is not careful.  A few steps were taken to prevent this instability:
  • Minimal R/C filtering was applied at the voltage divider (e.g. C7) to minimize a low-pass filter pole which can cause a delay/lag and instability.
  • The rate-of-change of the PWM duty cycle is limited by the nature of the software so that it can't make huge corrections very quickly.
  • The radio presents a minimum current load on the high voltage supply of between 5 and 10 milliamps, peaking up to, perhaps, 50 milliamps - and the radio doesn't really care if the voltage varies by 5-10%.  Because this current excursion is only, at most, a 10:1 ratio, there isn't a need to try to keep the power supply stable at extremely low currents (e.g. no load) where the PWM duty cycle would be small - and small changes in that duty cycle would cause large changes in voltage.  The addition of a second stage of power-supply filtering (e.g. R21 and C9) further "smooth" the changes in current from the radio.
Why use eight 1.5 volt cells rather than just six to get the filament voltage?

Why not just use six 1.5 volt cells to get "9 volts" for the filament string?  As it turns out only a set of six fresh 1.5 volt cells will actually produce 9 volts - and the voltage drops rapidly from there.  If one consults the manufacturers' specifications for alkaline cells it will be noted that the majority of the useful life of typical "1.5 volt" cells occurs with their voltage being in the range of 1.2-1.3 volts and it isn't until a cell gets all of the way down to 1 volt (for a total of 6 volts to the filaments for a six cell battery) that just 80% of the cell's capacity has been exhausted.

In this radio I noted that below an "A" battery potential of 8 volts (e.g. 1.33 volts/cell for 6 cells) the sensitivity started to drop and by the time it has dropped to around 7.5 volts (1.25 volts/cell for 6 cells) the radio was practically deaf with the oscillator abruptly stopping just below this.  Poking around inside the radio I noticed that at 9 volts, the series voltage drop across each of the tubes' filaments was very close to that shown on the schematic diagram in the service manual, but by the time it dropped to 7.5 volts it had become unequal, with the 1L6 converter tube being disproportionately affected and its filament voltage at or below 1 volt.  Interestingly, this drop-off in sensitivity did not appear to be related to frequency:  The radio still worked at all frequencies with a filament voltage just above where it cut off, but it was just as deaf on the low bands as it was on the high.  Because the 1L6 tube is the component in this radio that is the most difficult to find, it would also make sense to construct the battery supply in such a way that it would allow the best operation from a "weak" tube, anyway.

I decided to use the battery voltage of eight 1.5 volt cells rather than the "9 volts" obtained from six cells for several reasons:
Figure 5:
Inside the faux "AB" battery box for the Zenith TransOceanic.  Eight
"D" cells are used in four holders (one 4-cell,  one 2-cell and two 1-cell) which,
along with the converter box, are screwed down to some plywood (3 layers of
3.2 mm "luon") which itself is glued to the bottom of the box.  The cover,
made from the same circuit board material as the box containing the circuits,
has both of its surfaces electrically connected using thin, copper foil soldered
to each side to assure that an electrical connection is made to the box
itself when the cover screws are tightened.  The authentic-looking replica
battery box and radio connector were obtained from "Edsantiqueradios.com".
Without having made the voltage converter smaller, there is room only for
eight "D" cells in the box.
Click on the image for a larger version.
  • The higher voltage of eight 1.5 volt cells (12+ volts when fresh) would allow the total filament potential ("A" voltage) to be regulated down to 8.0-9.0 volts.  (For longest filament tube life, one should run the filament string in the 8.0-8.5 volt range - the lower end being somewhat preferred if the radio's performance is still acceptable.)
  • The use of an extra two cells will allow the use of more of the battery capacity.  For example, with 8 cells discharged to 1.0 volts each, around 80% of the cell's useful life has been utilized with the ending voltage still being 8 volts.  Contrasting this to the use of just six cells, at a total "A" voltage of just 7.75 volts (approx. 1.3 volts/cell for 6 cells) 40-60% of the life of the cells will remain, but the radio will likely be getting deaf or even may not be usefully operational!
Additional comments:
  • In theory, ten 1.5 volt cells could be used.  Because the voltage of a "fresh" 1.5 volt alkaline is around 1.6 volts, this could expose some of the devices, particularly the electrolytic capacitors and U2, to voltage at or above the official maximum rating.  Practically speaking these devices will likely survive this, particularly since the voltage will very quickly drop under the load presented by the radio into the "safe" range.  The use of one or two additional 1.5 volt cells (e.g. 9 or 10) won't add more than 10-15% of "run time" to the radio so it is not likely to be worth using more than eight 1.5 volt cells.  (Nine cells would work as well, provided there was space in the battery box and that you were OK with using an odd number of cells.)
  • The typical filament current of this radio is on the order of 50 milliamps.  At a battery voltage of 12 volts where around 3 volts is dropped by the series regulator, approximately 150 milliwatts is dissipated as heat - about 25% of the total filament power, or around 8% of the radio's total power consumption.  Were a switching regulator used for the filament its efficiency would likely be in the 85-90% range and increase of efficiency over the linear regulator would likely not be worth the added complexity.  Considering that the average voltage of the battery over its life will be around 10-10.4 volts (approx. 1.25-1.3 volts/cell) with a regulator dissipation of only 70 milliwatts, the difference in loss will be even lower.
With a fresh set of eight 1.5 volt "D" cells the current consumption was measured at 140-150 milliamps at very low volume and peaking to well over 250 milliamps when the volume was set to maximum on a strong station (lots of audio distortion!) with the filaments accounting for around 50 milliamps of the total.  While it has not been empirically tested (it's not particularly cheap to buy eight "D" alkaline cells just to run them down!) the estimated run times at "room" temperatures and normal receive volume to 1 volt per cell for various sizes of alkaline cells, based on manufacturers' data sheets are:
  • For "AA" size:  15-20 hours with reduced performance for an additional 1-2 hours.
  • For "C" size:  30-40 hours with reduced performance for an additional 3-5 hours.
  • For "D" size:  70-90 hours with reduced performance for an additional 6-10 hours.
If just six cells were used the filament voltage would drop below 7.5 volts in about half the time noted above and by then, the radio's performance will have likely diminished considerably.  In contrast, using eight cells and a filament voltage regulator the performance will remain essentially unchanged until the cells are about 80% discharged (around 1 volt/cell) and the radio's performance will drop from there.

Note that this circuit can be powered directly from a 12 volt supply or battery - just heed the warnings below about NEVER allowing the "Batt-" line to come in contact with the "A-" lead - or any part of the radio's chassis.  Because this radio has no AC (mains) power transformer, its chassis could be "hot" with mains voltage and as such it is already capacitor-isolated at its antenna connection.

Additional comments about the circuit:

It should be noted that the "BATT-" and "A-" lines are isolated from each other.  These two lines should never be connected to each other as that would prevent the closure of the filament switch from being detected when the radio is turned on and it would bypass the filament regulator, exposing the tubes' filaments to the full battery voltage, likely destroying one or more of them!  The reason for putting the filament regulation in the negative lead is allow an N-channel FET to be used and to avoid the use of a P-channel device in the "high" side and the complications required in driving this device and keeping its circuit stable (e.g. avoiding spurious turn-on events and momentary loss of voltage regulation) when the unit is powering up or down.

Even more circuit comments:
  • Resistors R8 and R17 are used to bias their respected FETs "off" by default.  This is necessary as the outputs of the microcontroller are high-Z unless/until it is operating and these FETs could randomly turn on due to leakage currents without them.
  • Similarly R15, on the "reference" voltage for U2's filament regulator circuit from the microcontroller, pulls that output down before the processor initializes its outputs from their default "Hi-Z" state, eliminating a possible "glitch" of the filament voltage during circuit start-up and shut-down.
  • U2, the filament voltage regulator, MUST be a rail-to-rail input and output op amp.  An "ordinary" op amp such as the '1458 or '358 WILL NOT WORK PROPERLY under all conditions.  Some parts suggestions for suitable op amps are included in the schematic diagram of Figure 3.  In other words, if you use a "normal" op amp it is possible that this circuit will misbehave and expose the filaments to excessive voltage.
  • Resistor R9, a 470 ohm resistor in series with the output of U2a and FET Q4, isolates Q4's gate capacitance, preventing instability of the op-amp while C6 provides frequency compensation for the regulator circuit.
  • When powered down the quiescent current of this circuit is approximately 7μA and is a result of the battery voltage (minus the drop of D1) always being applied across the B+ voltage divider string R18, R19 and R20.  This amount of current is comparable to the self-discharge rate of modern alkaline cells and can generally be ignored.  If this amount of current were to really bother you, the  voltage converter circuit could be powered from the "V+_SW" line and transistor Q1 could be replaced with a P-channel power FET as noted on the diagram.
  • LED1 and LED2 are optional.  LED1 will glow when the microcontroller activates the "PWR_SW" line and can be used for troubleshooting.  For example, if no current is being drawn from the B+ line - or the converter is not working - the software will continually cycle:  It will turn on the high voltage, wait for current to flow and when not seeing it, it will turn off the high voltage again and retry after a few seconds causing LED1 to turn on and off.  LED2 is also optional and is used to indicate when the circuit is powered up by Q1, either by the microcontroller turning on Q3 and/or Q2 being activated by the voltage drop across R7 when the filament switch is closed.  If desired, it may be mounted to the battery box so that it is visible when radio's back cover is open.
  • Transistor Q5, used in the high voltage "boost" converter, must be rated for at least 200 volts and it should have a "logic level" gate threshold appropriate for turning the FET (more or less) fully on at just 5 volts:  Some suggested device types are noted on the diagram (Figure 3).  An additional device worth considering is the ON Semiconductor NDD02N40-1G, a 400 volt, 1.1 amp FET that has a suitably low turn-on threshold - and it's pretty cheap.
  • Components TH1, a 1 amp self-resetting fuse, and diode D1 protect the circuit against shorts or accidental reverse polarity by limiting the current to a reasonable value should this occur.  TH1 may be replaced with a 0.75-1 amp fast-acting fuse if so desired.
  • The PWM (switching) frequency is approximately 15.625 kHz and is based on the microcontroller's internal 8 MHz clock.  Both 7.8125 and 31.25 kHz were tried and the conversion efficiency was slightly lower (by approx. 1-5%) with the 330 μH inductor value chosen - an indication that the actual value of L1 isn't particularly critical.
  • The value of L1 may be anything from 220μH to 470μH - and even a bit beyond this range.  Make sure that the inductor used has a current rating of at least a half an amp or else internal resistive losses will significantly impact conversion efficiency.  If available, a toroidal inductor or other shielded type is preferred as it better-contains its magnetic field than solenoid styles.
  • The measured efficiency of the boost converter of the prototype was greater than 80% despite the power lost in R21, the "filter" resistor in series with the B+ output.
  • The 15 volt maximum supply voltage limit is set by the voltage rating of op amp U2 and possibly the ratings of the electrolytic capacitors exposed to the battery voltage.
  • If one chose to use just six 1.5 volt cells instead of eight, never supplying more than 9 volts, the "FIL_SW" line would be connected directly to the gate of Q4 and the circuitry related to U2 would be omitted.  Do note that six "fresh" 1.5 volt alkaline cells could initially produce a bit over 1.6 volts/cell and expose the filament string to over 9.6 volts.
  • The diagram and pictures show the use of feedthrough capacitors (4000pF) to pass the voltages through the shielded box.  Feedthrough capacitors are somewhat difficult to get, but good results may be obtained by using good-quality monolithic ceramic (NOT disk ceramic) capacitors instead, placing them - using very short leads to a solid ground plane - where the wires pass through the hole in the shielded box.  These capacitors are typically square in shape and rather compact and available in both leaded and surface-mount form.  Remember that for the B+ output a capacitor with a rating of at least 100 volts must be used:  Any value from 0.0022μF to 0.1μF may be used.
  • If you build this sort of circuit, make absolutely certain that you simulate the filament string with a 150-200 ohm 1/2-1 watt resistor and the B+ load with a 10k, 1-2 watt resistor and verify that the circuits are working properly BEFORE connecting it to a radio.  While a brief bit of over-voltage on the B+ line (to perhaps 130-150 volts) will likely not harm the radio, more than 9 volts on the filament line, even for a moment, will probably ruin one or more of the fragile and expensive tubes!
  • About that "auto power save" feature mentioned at the top of this article?  After two hours of uninterrupted operation the microcontroller will modulate the filament line with an intermittent tone and drop the B+ voltage to about 50% causing the radio to partially mute with the alarm tone sounding in the speaker.  This "beeping" will continue for about a minute before the microcontroller turns off the filament and high voltage supplies, dropping the current consumption from 100-50 milliamps to about 6-12 milliamps - the quiescent current of the remaining circuitry.  Turning the radio off for 5-10 seconds and then back on will reset this timer at any time.  The down-side of this is that if the radio shuts down in this way, one may forget that the radio is even on, still drawing a few milliamps - the only reminder being that the front lid of the radio will still have been in its upright position!  If the battery voltage is less than around 7.5 volts (0.9375 volts/cell) the radio will be "locked out" and will not even turn on, but at this voltage the batteries are not only quite discharged, but their internal resistance will be rapidly increasing as well and little run time would have been left.
Figure 6:
A handy "map" showing where the various RF adjustments may be found.
This doesn't really have too much to do with the article, but since I made it
when I was aligning the radio I thought that I might as well post it here!
Note that locations of some of the trimmer capacitors - particularly those
in the lower-left corner - will vary with different production runs.  Some of
the alignment points shown in this picture are also omitted in the
"official" H500 service manual and thus have no parts designations:  These
adjustments are peaked at the frequencies indicated on the drawing.
Click on the image for a larger version.
How well does it work?

As can be seen in Figure 1 the circuit board and the eight "D" cell battery is concealed in a replica battery box that is situated exactly where an original "AB" battery would be placed.  Then the power switch is turned on it takes a bit over a second for the computer to power up, do its checks and for the tubes to warm up and the radio begins playing while the power-off is detected within two seconds of the radio power switch being turned off.

With the shielding of the circuity and bypassing of its leads there is no detectable interference caused by switching voltage converter.  With the filament and B+ voltage being regulated to the same as a "fresh battery" or AC mains voltage, the sensitivity and audio output capability are maintained until the battery is more than 80% depleted.

In other words, it works just as it should!

* * * * * * * * * * * * * * * * * * * * * * *

If you are interested in the code for this (written in "C" using the PICC compiler) or just a .HEX file so that you can program a PIC12F683 yourself, or if you are interested in getting an already-programmed PIC12F683, let me know via a comment.

And before you ask:  Sorry, but I can't build you one at this time...

[End]

This page stolen from "ka7oei.blogspot.com".
 

Tuesday, August 9, 2016

A latching low-voltage disconnect for 12 volt lead acid and lithium batteries (non auto-resetting)

Figure 1:
The as-built and working prototype constructed.
This version does NOT automatically reset itself - by design.
Click on the image for a larger version.
There are two things that you don't want to do with any rechargeable battery on a routine basis:
  • Overcharge it.
  • Overdischarge it.
While the above are true for lead-acid batteries, they are particularly true of Lithium-Ion chemistries, but for different reasons.

With Lead-acid batteries:
  • Lead-acid batteries - particularly the "flooded cell" types (e.g. those to which you can add water) can handle quite a bit of overcharging as long as the electrolyte level is maintained.  "Sealed" batteries (e.g. AGM, or those that many mistakenly called "gel" cells) can handle some overcharging, but only to an extent before their pressure vents release accumulated gasses, reducing the amount of usable electrolyte, which is why they should never be "equalized".
  • Lead-acid batteries can also handle being run (almost) completely down - as long as you don't keep them in that state for very long (a few days at most - as little time as possible) and don't do it very often.  In other words, if you run an otherwise healthy lead acid battery completely dead and immediately recharge it, little actual damage is likely to have been done other than taking a bit of life off it farther down the road.  In cold-weather environments, while the degradation (primarily sulfation) is dramatically slowed, extremely deep discharge also reduces the specific gravity, raising the electrolyte's freezing point, increasing the possibility of the battery being damaged/destroyed at very low temperatures if it does freeze.
 With Lithium-ion batteries:
  • If a battery is overcharged, it will start to chemically decompose.  Gross overcharging - while tolerated at least briefly by lead-acid batteries - may result in a lithium-ion battery venting and/or exploding, possibly catching fire.
  • If a battery is over-discharged it will chemically decompose, often with the contained lithium changing into a more volatile - and not useful - state.  Severe over-discharging (e.g. below 2 volts per cell - this voltage varies depending on chemistry) can mean that the battery can never safely be charged again or, in some cases - if the voltage is only allowed to get down to this general area and not lower (again, the voltage varies according to chemistry) some special charging precautions are required (e.g. a specific, very low-rate trickle charging regimen) to "recover" this battery.
  • There are also some specific temperature-related restrictions with lithium-type batteries regarding their use and charge/discharge and these are noted by their respective manufacturers.
Avoiding over-discharge:

The avoidance of overcharging is usually pretty easy:  Just use the appropriate charging system - but over-discharge is a bit more difficult, particularly if the battery packs in question don't have a "protection board" with them.

Lead acid batteries (almost) never come with any sort of over-discharge protection - one must usually rely on the ability of the device being powered (e.g. an inverter) to turn itself off at too-low a voltage and hope that the threshold is sensible for the longevity of a 12 volt battery system.  For low-to-moderate loads (e.g. 1/10th "C" or so) a pretty safe "dead battery" voltage for a 12 volt lead-acid battery is around 11.7 volts - or somewhat higher for heavier loads.  Again, after disconnect, it is not a good idea to keep it in a discharged state for any longer than possible.

Many larger (e.g. >10 amp-hour) lithium-iron phosphate (LiFePO4) do not routinely come with "protection" boards unless it is ordered specially or includes some sort of "Battery Management System":  Batteries in this category can include the "Lead Acid" replacements sold for use with motorcycles and off-road vehicles  and some of the "raw" LiFePO4 batteries available from many vendors, such as the 20 amp-hour modules made by GBS.

While it is also important to equalize LiFePO4 batteries when charging (refer to this post - Lithium Iron Phosphate (LiFePO4) batteries revisited - Equalization of cells - link) the more immediate danger in routine use is accidental over-discharge.

A simple "latching" low-voltage disconnect circuit:

Again, for lithium batteries one may install "protection" boards that prevent accidental over-discharge and, in some cases, provide charge equalization - but such things are much rarer for lead-acid batteries, but such a circuit is quite simple and is applicable to either Lithium or Lead Acid batteries.

Note that this particular circuit does not automatically reconnect the battery again after its voltage has been restored by charging (directly at the battery, anyway - and this is the "latching" part) and this was intentional - both to keep the circuit as simple as possible and because it draws attention to the system on which it is used when it trips out.

Figure 2:
Schematic diagram of the low-voltage disconnect circuit.
Not shown is overcurrent protection (e.g. fusing) that should be present on the output of the battery - see text below. 
If desired, LED1 can be placed in series with R2 which could be changed to 2.2k and R7 be omitted as an indicator that the circuit has actually latched, not just that there is voltage present on the Load+/- terminals.
Click on the image for a larger version.

These days it is rather easy to construct a low-voltage disconnect circuit using readily-available components:  The diagram of one such circuit may be found in Figure 1.

How it works:

The RESET button is pressed, applying a positive voltage to the gate of N-channel power MOSFET, Q1, turning it on, which then connects the "BATT -" output terminal to the "LOAD -" terminal.

If the voltage at the "Ref" terminal of U1 is above 2.5 volts, as determined by the voltage divider consisting of R4, R5 and R6, the cathode of U1 is connected to its anode (e.g. "Load -"), pulling the base of Q2 down, making it negative with respect to its emitter, R2 limiting Q2's base current to a safe value and providing enough current for U1 to function, and turning it on.  With Q2 turned on, Q1 is "latched" on, even when the RESET button is released.

If the voltage at the "Ref" terminal of U1, representative of the voltage across the LOAD terminals, drops below 2.5 volts, U1 turns off and the base of Q2 gets pulled positive to the emitter voltage by R1, turning it off.  With Q2 turned off resistor R8 pulls the gate of Q1 down to its source, also turning it off and disconnecting the load.  Because of the "latching" effect, once this has happened the load will never be turned on again until the RESET button is pressed.  This happens because with Q1 turned off, U1 is without voltage (e.g. "Load -" rises to the same voltage as "Load +) and can never turn Q2 (and thus, Q1) back on again.  Even though pressing and holding the RESET button will connect the load even if the voltage is below the threshold, until the voltage rises above the threshold the circuit will not stay "on" once the RESET button is released.

To accommodate a range of voltages, U1's "Ref" terminal is connected across the output (Load +, Load -) with R4 and R6 to "scale" the range of potentiometer R5 to have a threshold in the 8-16 volt range:  Without R4 and R6 the usable range of R5 would be compressed to a very small portion of the overall rotation and make adjustment touchy, but with these resistors setting R5 at mid-rotation yields a threshold of around 11 volts.

Note the presence of capacitors C1 and C2:  C1 provides a bit of filtering of the sampled output voltage to prevent brief current transients that might momentarily drag the voltage down below the threshold, "falsely" causing an undervoltage condition from being detected.  Similarly, C2 slows the "fall" time of Q1's gate voltage, preventing it from shutting off instantly in response to a brief spike of current - and it also provides some degree of protection of Q1's gate in response to possible voltage transients.

While not explicitly tested, the presence of C1 and C2 should provide a modicum of RFI protection:  If your environment includes high RF fields - such as powering a 100 watt amateur transceiver - this could be considered in testing and the construction/layout, knowing that such a transceiver can also impose very brief, high-current loads on the battery can causing momentary brown-outs due to I*R drops in the wiring and battery which could also trip this circuit.

Finally, the combination of R7 and LED1 provide an indication of power-on to the user - see the note on modification of this circuit, below.

Additional circuit notes:

The "high voltage" limitation of this device is primarily that of the gate voltage rating of Q1.  Most power FETs are rated for only +/- 20 volts gate-to-source voltage which means that it is suitable for no more than a "12 volt" bus (e.g. 10-16 volts or so):  If a higher operating voltage is required it will be necessary to add additional circuitry around the FET's gate to keep its voltage safely below its rating.  For an example of such circuitry see this article:  A Simple, effective, yet Inefficient Solar Charge Controller - link and taking note of components D1, R7, R8 and C4 surrounding Q3 in Figure 3 on that page.

If a lower cut-off than 9 volts  (or higher than 15) is required it will be necessary to recalculate the values of R4 and R6 (in Figure 2, above) to appropriately scale the adjustment range.

It should also be noted that if voltages below 10 volts are routinely required one should pay close attention to the saturation (e.g. "full on") gate voltage required for the FET that you plan to use:  Typical FETs do not achieve their lowest resistance until 8-10 voltage of gate-source voltage is present but there are "logic level" FETs available that will be fully "on" at around 5 volts.

Finally, there is a slight modification to the circuit depicted in Figure 2 that could be made:  Place LED2 in series with R2 and decreasing the value of R2 to 2.2k or so, omitting R7 entirely.  This modification not only saves a few milliamps of "on" current, but it also provides an indication of when the circuit is actually latched in its "on" state - particularly useful if the load has its own, separate power source which would cause LED1 to illuminate no matter the state of the disconnect circuit if wired according to Figure 2.

Construction:

None of the components are critical, save the possible exception of R4, R5 and R6 which are selected to scale the adjustment range of R5:  While it is the ratios of these components that are important (e.g. one could use 4.7k, 1k and 1k for R4, R5 and R6, respectively) going much higher than the stated values may violate the minimum reference current specifications of U1 resulting in temperature/device variations of the set voltage thresholds.

The TL431 (U1) is a rather ubiquitous chip, found in practically every PC-type power supply made in recent years and is available in single quantities for well under $1.

Q2 may be practically any silicon PNP transistor with a rating of at least 30 volts while Q1 may be any N-channel MOSFET with a voltage rating of at least 30 volts and a current rating of at least 3 times the current that you plan to draw and an "ON" resistance of a fraction of an ohm.  For the prototype I used an F15N05 FET - a 15 amp, 50 volt device, more than adequate for the 3 amp load that was to be used, but one could use as "large" a power FET as you wish.  For "12 volt" operation make sure that the FET that you choose has at least a 20 volt gate-source voltage rating.  Higher-current FETs include the IRFZ44 (50 amp max.) and the PSMN2R7-30PL (100 amp max.) to name but two out of hundreds of possibilities.  If even more current is required one can parallel multiples of the same-type FET as needed, potentially providing many hundreds of amps of capacity, provided the wiring is appropriately considered.

Device layout is not critical aside from the use of appropriately heavy conductors to the source and drain leads of Q1 to carry the current.  For most applications a heat sink is not even required for the FET - particularly if one chooses a device with milli-Ohm range "on" resistance but there is never any harm in doing the calculations yourself to verify that this is true in your case with the FET that you choose.  Note that the "Batt+" and "Load+" lead is straight-through and the wire connecting this circuit to that "through" connection may be of light gauge:  The only caveat is that it is recommended that the connection to this circuit be connected closer to the "BATT+" terminal than the "LOAD+" terminal to minimize the resistance of that connecting wire which could cause the circuit to sense a slightly lower voltage than is actually present.

Finally, note that this circuit works by disconnecting the "BATT-" from the "LOAD-":  Your battery's negative terminal must be completely isolated from the load for this circuit to work properly and protect your battery!

(Comment:  It is possible to reconfigure this circuit to disconnect in the positive lead, but this requires the use of a P-channel power FET:  A not-yet-built or tested circuit design is available on request.)

Adjustment and Operation:

For proper set-up an adjustable power supply is required and the procedure is as follows:
  • Set the power supply to a volt or two higher than the desired drop-out voltage.
  • Adjust R5, the potentiometer so that the wiper is closest to R6 to set the drop-out voltage to maximum (e.g. highest voltage measured betweenU1's REF terminal and LOAD- while the RESET button is being pressed).
  • Connect the device to the power supply using the BATT- and BATT+ connections.  No load is required for testing.
  • Press and release the RESET button:  The LED should stay on, but if not, check the adjustment of R5 to verify that it is providing the maximum voltage to U1's REF terminal.  If this checks out, check for proper resistor values of R4, R5 and R6 as well as proper wiring of U1.  Note that the circuit will not stay on if U1's REF terminal is below 2.5 volts.
  • Lower the power supply to the desired drop-out voltage.  The LED should stay on, but if not check the setting of R5.  (Remember that the useful range of R5 with the specified values of R4 and R6 is in the 8-16 volt area.)
  • Slowly rotate R5 until the LED just turns off.
  • Increase the power supply voltage slightly, press and release the RESET button and verify that the LED turns on and then goes off again when the voltage drops below the threshold, repeating the above steps as needed.
If a device is connected that has a high "starting" current it is possible that - particularly if the battery is weak or near the cut-off voltage and/or the cut-off device is located at the end of a long run of rather small-gauge wiring - it will drop-out before the voltage gets to the pre-set threshold.  If this happens and it is not practical to move the device closer to the battery or increase wire size to minimize lead resistance one can increase the value of C1 (to as much as 47uF) to slow the response time, allowing a momentary "brown out" to occur without tripping the device.  Note that with such a capacitor it will take longer to respond to such changes, but this should not be an issue from the viewpoint of protecting the battery.  The value of C2 can also be increased, but not much more than 1 uF should be used as this will excessively slow the "turn off" time of Q1, causing it to spend more time out of saturation and potentially dissipating more heat in the process.

Additional comments:

In this particular application Anderson Power Pole (tm) connectors were used on the input and outputs allowing this device to be easily removed from the circuit and configured as needed.

This device should also not be left connected to a battery in long-term storage as it draws several milliamps when it is in its "ON" state due to the LED and the current consumption of Q1/Q2 and associated resistors, R4-R6 and U1.

When in its "OFF" state its current consumption is negligible (likely in the nanoamp range) so if it is left connected and the battery gets drawn down, it will still do its job, disconnecting the load - and itself - from the battery and protecting it.  Note that if the load is "back-fed" from another source - say an AC/solar charger or power supply - and the voltage rises above the threshold, this will have the same effect as pressing the RESET button, turning the circuit on.  Again, if the voltage is back-fed, the LED will be drawing a few milliamps whenever voltage is present whether the circuit is "on" or not - unless the modification noted above is made.

It is recommended that one NOT attempt to charge the battery "through" this device - at least at higher currents:  In theory it should work, but the current will flow backwards through the FET.  The reason for this is that while a FET that is turned "off" has an intrinsic "backwards" diode, it will drop 0.5-0.8 volts across this diode causing the FET to dissipate far more power than it would if it were actually "on".  If the charge rate is limited to a rather low current - perhaps less than 3-5 amps - the amount of heat dissipated by the FET should be tolerable.

Until the voltage rises above the cut-off threshold the FET will exhibit this 0.5-0.8 volt drop, but above this - when the circuit turns the FET on - this diode drop will largely disappear.   If you do this it would be a good idea to test it at your intended charge current in the worst-case scenario (e.g. highest current and adjust R5 so that the circuit will not trigger "on" during this charge, forcing the "diode drop" across Q1 to exist) and note if additional heat-sinking of U1 is needed.  Note:  If this is done, the "LED1-R2" modification noted above is recommended so that the LED will properly show the state of the circuit.

Not shown - but recommended - is the use of some sort of fuse or other overcurrent protection on the output of the battery.  It is recommended that the fuse rating be no higher than a third of the current rating of the FET to increase the chance that the FET will survive the surge current required to blow the fuse in the event of a dead short on the output.

[End]

This page stolen from "ka7oei.blogspot.com".