❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Using an ATX computer power supply to run KiwiSDRs - and as a general purpose 5 and 12 volt supply

By: KA7OEI
28 September 2022 at 03:34

At the Northern Utah WebSDR (link) we run a number of KiwiSDR receivers.Β  These receivers, which are inherently broadband (10 kHz to 30 MHz) allow a limited number of users to tune across the bands, allowing reception on frequencies that are not covered by the WebSDR servers.

At present there are six of these receivers on site:Β  Three are connected to the TCI-530 Omnidirectional antenna (covering 630-10 meters - 2200 meters is included via a separate E-field whip), two are on the east-pointing log-periodic beam antenna (which overs 40-10 meters) and the newest is connected to the northwest-pointing log-periodic beam antenna (which covers 30-10 meters).

Figure 1:
Power supply in a PC case!
The PC case housing the power supply was repurposed -
because, why not?
Click for larger version
The power requirements of a KiwiSDR are modest, being on the order of 600-800 mA, but the start-up current can briefly exceed 1.25 amps.Β  Additionally, they do not start up reliably if the voltage "ramps up" rather slowly - a problem often exacerbated by the fact that the extra current that they draw upon power-up can cause a power supply to "brown out".

Up to this point we had been running 5 KiwiSDRs:Β  Three of them were powered by a pair of 5 volt, 3 amp linear power supplies that are "dioded-ANDed" together to form a 6 amp power supply and the other two KiwiSDRs were powered from a heavily-filtered 5-volt, 3 amp switching power supply.

In recent months, the dual 3 amp linear supply had become problematic, not being able to handle the load of the three KiwiSDRs, so we had to power down KiwiSDR #3.Β  With the recent installation of the northwest-pointing log periodic antenna, we were also looking toward installing another KiwiSDR for that antenna and we were clearly out of power supply capacity.

Using an ATX supply as a general-purpose power supply - it's not just the green wire!

If you look around on the Web, you'll see suggestions that you just "ground the green wire" to turn on an ATX supply, at which point you may use it as a general-purpose supply.Β  While grounding the green wire does turn it on, it's not as simple as that - particularly if you leave the power supply unattended.

For example, what if there is a brief short on the output while you are connecting things, or what if the power browns out (or turns off) for just the "wrong" amount of time.Β  These sorts of things do happen, and can "trip out" the power supply and it may never restart on its own.

With the site being remote, we couldn't afford for this to happen - so you'll see, below, how we remedied this.

Putting together another power supply:

With six KiwiSDRs, the power supply requirements were thus:

  • 5 amps continuous, making the assumption that a KiwiSDR's average current consumption would be about 830 mA - a number with generous overhead.
  • 9 amps on start-up, presuming that each KiwiSDR would briefly consume 1.5 amps upon power-up, again a value with a bit of overhead.
  • The power supply must not exhibit a "slow" ramp-up voltage as the KiwiSDRs did not "like" that.

In looking around for a power supply on which to base the design, the obvious choice was an computer-type ATX power supply.Β  Fortunately, I have on-hand a large number of 240 watt ATX supplies with active power factor correction which are more than capable of supplying the current demands, being rated for up to 22 amps load on the 5 volt supply - more than enough headroom as I would be needing less than half of that, at least with the currently-planned usage.

Circuit description:

Refer to the schematic in Figure 2 for components in the description.

Added filtering:

While these power supplies were already known to be adequately RF-clean (important for a receive site!) from their wide use for the WebSDR servers because we would be conducting the DC outputs outside the box - and to receivers - I felt it important that additional filtering be added.Β  Having scrapped a number of PC power supplies in the past, I rummaged around in my box of random toroids and found two that had probably come from old PC power supplies, wound with heavy wire consisting of 4 or 5 strands in parallel.Β  These inductors measured in the area 10s of microHenries, enough for HF filtering when used with additional outboard capacitance.

These filter networks were constructed using old-fashioned phenolic terminal lug strips.Β  These consist of a row of lugs to which components are soldered - typically with one or two of the lugs used for mounting, and also "grounding".Β  Rather than mount these lugs using a drill and screw, they were soldered to the steel case itself - something easily done by first sanding a "bare" spot on the case to remove any paint or oxide and then using an acid-core flux - cleaning it up afterwards, of course!

The heavier components (inductors, capacitors) were mechanically secured using RTV (silicone) adhesive to keep them from moving around - and to prevent the possibility of the inductor's wire from touching the case and chafing.

Looking at the schematic you may note thatΒ  C202, C302, C501, C502 and C503 are connected to a "different" ground than everything else.Β  While - at least for this power supply - the "Common" (black) wire is internally connected to the case, it's initially assumed that this lead - which comes from the power supply - may be a bit "noisy" in terms of RF energy, so they are RF bypassed to the case of the power supply.Β  This may have been an unneeded precaution, but it was done nonetheless.

Connectorizing and wiring the power supply:

The ATX power connector was extracted from a defunct PC motherboard to allow the power supply itself to be replaced in the future if needed.Β  On this connector, all of the pins corresponding with the 5 volt (red wires), 12 volt (yellow wires) and ground (black wires) were bonded together to form three individual busses and heavy (12 AWG) wires were attached to each:Β  This was done to put as many of the wires emerging from the power supply in parallel with each other to minimize resistive losses.Β 

The green wire (the "power" switch) and purple wire (the 5 volt "standby") were brought out separately as they would be used as well - and the remainder of the pins (3.3 volt, -12 volt, -5 volt, "power good", etc.) were flooded with "hot melt" glue to prevent anything from touching anything else that it shouldn't.

The 5 volt supply was split two ways - each going to its own L/C filter network (L501, L502, C502, C503, C504, C505) as shown in the schematic, this being done to reduce the total current through the inductor - both to minimize resistive losses, but also to reduce the magnetic flux in each inductor, something that could reduce its effective inductance.

Although I don't have immediate plans to use the 12 volt supply, a similar filter (L503, C506, C507) was constructed for the 12 volt supply lead.Β  On the output side of the 12 volt filter, a 3 amp self-resetting thermal fuse (F501) was installed to help limit the current should a fault occur.Β 

About the self-resetting fuses:

Β These fuses - which physically look like capacitors - operate by having a very low resistance when "cold".Β  When excess current flows, they start to get warm - and if too much current flows, they get quite hot (somewhere above 200F, 100C) and their internal resistance skyrockets, dropping the current to a fraction of its original value:Β  It's this current flow and their heat that keeps the resistance high.

It's worth noting that these fuses don't "disconnect" the load - they just reduce the current considerably to protect whatever it is connected to it.Β  Since, when "blown", they are hot, they must be mounted "in the clear" away from nearby objects that could be damaged by the heat - and also to prevent lowering of their trip current by trapping heat or being warmed by another component - such as another such fuse.Β Β 

It should be noted that if the outputs - either 5 or 12 volts - are "hard shorted", the thermal fuse may not react quickly enough prevent the power supply from detecting an overcurrent condition and shutting down.Β  As an output short is not expected to be a "normal" occurrence, this behavior is acceptable - but it will require that the power supply be restarted to recover from shutdown, as described below.

In the case of the KiwiSDRs, they are connected with fairly long leads (about 6 feet, 2 meters) and often have enough internal resistance to reduce the current below the power supply's overcurrent limit and rather than allowing the full current of the power supply (which could be more than 20 amps) to flow through and burn up this cable, the fuse will trip as it should, protecting the circuit.Β  To "reset" the fuse, the current must be removed completely for long enough for the device to cool - something that is done with the 5 volt supplies as we'll see, below.

The controller:

As mentioned earlier, if you look on the web, you'll see other power supply projects that use an ATX power supply as a benchtop power source and most of those suggest that one simply connect the green (power on) wire to ground to turn it on - but this isn't the whole story.Β  In testing the power supply, I noticed two conditions in which doing this wouldn't be enough:

  • Shorting a power supply output.Β  If the output of a good-quality ATX power supply is shorted, it will immediately shut down - and stay that way until the mains power is removed (for a minute or so) or the power supply is "shut off" by un-grounding the green wire for a few seconds before reconnecting to "restart" the power supply.
  • Erratic mains power interruption.Β  It was also observed that if the mains power was removed for just the right amount of time, the power supply would also shut down and would not restart on its own.Β  It took the same efforts as recovering from an output short to restart the power supply.

Since this power supply would be at the WebSDR site - an unmanned location in rural, northern Utah - it would require additional circuitry to make this power supply usable.

Fortunately, an ATX power supply has a second built-in power supply that is independent of the main one - the "standby" power supply.Β  This is a low-power 5 volt supply that is unaffected by what happens to the main supply (e.g. not controlled by the power switch and not affected if it "trips off") and can be used to power a simple microcontroller-based board that can monitor and sequence the start-up of the main power supply.Β  For this task I chose the PIC16F688, a 14 pin microcontroller with A/D conversion capability and a built-in clock oscillator.

As seen in the schematic, the "5 volt standby" is dioded-ORed (D601, D602) with the main power supply (12 volts) so that it always gets power - from either the 5 volt standby, or from the 12 volt output - when mains is applied.Β  R603 and capacitor C602 provide a degree of protection to the voltage regulator should some sort of "glitch" appear on the 12 volt supply - possibly due to the 5 volt load being abruptly disconnected (or connected) as the 5 and 12 volt supplies are "co-regulated" in the sense that it's really only the 5 volt output that is being regulated well - the 12 volt power supply's output is pretty much a fixed ratio to the 5 volt and doesn't really have much in terms of separate regulation.

It should be noted that when operating from the standby +5 volt power source, the voltage from U2 (the 5 volt regulator) is on the order of 3 volts or so (drop through D602 and U2) but this is comfortably above the "brownout" threshold of the PIC, which is around 2.5 volts, so there isn't really a worry that the low-voltage brownout detector will trigger erroneously and prevent start-up.Β  If it had, I would have simply moved the cathode side of D602 to the +5V side of U2.

Figure 3:Β 
Inside the case!
Top right:Β  12 volt supply filtering and thermal fuse
Upper-middle:Β  Dual 5 volt filtering
Lower middle:Β  Controller board with FET switches
and thermal fusing.
The ATX power supply is in the lower-left corner.
Click on the image for a larger version.
Because the PIC microcontroller can monitor the 12 volt supply (via R601/R602) it "knows" when the main ATX supply is turned off.Β  Through the use of an NPN transistor (Q401) - the collector of which can be used to "ground" the green "power on" line, the controller can turn the main power supply on and off as follows:
  • When the microcontroller starts up, it makes sure that the ATX "power on" wire is turned off (e.g. un-grounded).Β  This is done by the microcontroller turning off Q401.
  • After a 10 second delay, it turns on the power supply by turning on Q401.

It also monitors the power supply to look for a fault.Β  If either the 5 or 12 volt output is shorted or faults out, both power supply outputs (but not the 5 volt "standby" output) disappear.

  • If, while running, the monitored 12 volt supply (via R601/R602 and "12V V_MON") drops below about half the voltage (e.g. trips out) the "power on" wire is turned off using Q401, disabling the ATX power supply.
  • A 10 second delay is imposed before attempting to turn the power supply back on.
  • Once the power supply is turned back on, monitoring of the voltage resumes.

In practice, if there is a "hard" short on the output, the power supply will attempt to restart every 10 seconds or so, but remember that a short on an output could occur with ANY sort of power supply, so this isn't a unique condition.

5 volt output sequencing and monitoring:

The other function of the controller is to sequence and monitor the 5 volt outputs.Β  As mentioned earlier, it was noted that the KiwiSDRs do not "like" a slow voltage ramp-up so a FET switch is employed to effect a rapid turn-on - and since there are two separately-filtered 5 volt busses, there are two such switches.Β  In order to reduce the peak current caused when the load is suddenly connected, each of these busses is turned on separately, a 10 second delay between the two of them.

The N-channel FET switches (Q203, Q303) are controlled by an NPN (Q201, Q301) transistor being turned on by the microcontroller which, in turns, "pulls" the base of a PNP transistor (Q202, Q302) low via a base resistor (R202/R302), turning it on - and other resistors (R203, R303) assure that these transistors are turned off as needed.

With the emitter of the PNP connected to the 12 volt supply, the gate voltage of the FET is approximately 7 volts higher than the drain voltage, assuring that it is turned on with adequately low resistance.Β  Capacitors (C201, C301) are connected between the FET's gates and sources to suppress any ringing that might occur when the power is turned on/off and as a degree of protection against source-gate voltage spikes while the 47k resistor (R207/R307) assure that the FET gets turned off.

The use of P-channel FETs was considered, but unless special "logic level" threshold devices were used, having only 5 volts between the gate and drain wouldn't have turned them fully "on" unless the -5 or -12 volt supply from the power supply was also used.Β  While this would certainly have been practical, N-channel FETs are more commonly available.

Figure 2:Β 
Schematic of the ATX controller with power supply filtering, voltage monitoring, and control.
See the text for a description.
Click on the image for a larger version.

In series with the 5 volt supply and the FET's source is a 5 amp self-resetting thermal fuse to limit current.Β  Should an overload (more than 5-ish amps) occur on the output bus, this fuse will heat up and go to high resistance, causing the output voltage to drop.Β  If this occurs, the microcontroller, which is using its A/D converter to look at the voltage divider on the outputs (R205/R206 for the "A" channel, R305/R306 for the "B" channel) will detect this dip in voltage and immediately turn off the associated FET.Β  After a wait of at least 10 seconds - for the fault to be cleared (in the event that it is momentary) and to allow the thermal fuse to cool off and reset - the power will be reconnected.Β  If there continues to be a fault, the reset time is lengthened (up to about 100 seconds) between restart attempts.

Finally, the status of the power supply is indicated by a 2-lead dual-color (red/green) LED (LED701) mounted to be visible from the front panel.Β  During power supply start-up, it flashes red, during the time delay to turn on the power supplies it is yellow, when operation is normal it is green - and if there is a fault, it is red.Β  Optionally, another LED (LED702) can be mounted to be visible:Β  This LED is driven with the algorithm that causes it to "breath" (fade on and off - and on, and off...) to indicate that "something" was working.Β  I simply ran out of time, so I didn't install it.

* * *

This power supply was put together fairly quickly, so I didn't take as many pictures as I usually would - and I omitted taking pictures of the back panel where the power supply connections are made.Β  Perhaps it's just as well as while I used a good-quality screw-type barrier strip, it was mounted to a small piece of 1/4" (6mm) thick plywood that was epoxied into the rectangular hole where one would connect peripherals to the motherboard.

As you would expect, the terminals are color-coded (using "Sharpies" on the wood!) and appropriately labeled.Β  While not pretty, it's functional!

(Comment:Β  The photo in Figure 3 was taken before I added the circuit to control the "Power On" wire (e.g. Q401) and the diode-OR power (D601, D602) - and it shows the dual-color LED on the board during testing.)

If you are interested in the PIC's code, drop me a note.

This page stolen from ka7oei.blogspot.com

[END]



Making a "Word Metronome" for pacing of speech

By: KA7OEI
31 August 2022 at 01:32

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]


Linux PIC16F628 programing on the cheap

Had to program a 16F628 PIC for a frequency counter kit that let the magic smoke out.

First I tested with the PIC included on a different kit to see if would work, in fact looks like all these kits use the same code from DL4YHF.Β Β 

The programmer diagram was a re-use of one that I used in the past, see schematic:

Β 


Β From here and other ideas here.

Β I had some problems making it to run on the laptop but using the serial port from the desktop it worked.

Commands to use were this ones:

# picprog --device=pic16f628 --pic /dev/ttyS0Β  --erase
# picprog --input-hexfile=counter2.hex --device=pic16f628 --pic /dev/ttyS0 --burn
(Picprog version 1.9.1)

I did not had a serial port plug so resorted to use some terminals, for a one of, it's ok


The assembly re-using the board from another test project:


The programmer that had the PIC issue, now running:

Β  and the clone kit used for testing the PIC:

Β 

...eventually one day ill get a "proper" programmer but for one PIC every so often it's perfectly fine this way.

That's it, have a nice day!

❌
❌