Re:load 2

28.05.2014 23:04

One thing I was missing on my table was an adjustable constant-current load. I occasionally repair small power supplies and having a robust load to test them is quite handy. I have a drawer full of high-power ceramic resistors, but those are clumsy to handle, especially when they get too hot to touch.

For a while I've been planning to make one myself. I have a finished schematic hanging on the wall for a battery powered device using a micro-power op-amp and an old passive heat sink salvaged from an old Radeon. I just never came around to finish a PCB layout for it. Then I came across the Re:load 2. It looked better than what I was making, so I filed away my design and ordered one instead. It's nice being a shopper on Tindie instead of a seller for once.

The build instructions were quite clear and there's not much assembly required anyway. I ordered the version with the highest power (6 A and 20 W) and I got the PCB pre-assembled with SMD components. The Arachnid Labs shop points to an instruction manual that describes soldering through-hole components, which was not necessary in my case.

Re:load comes without an enclosure and the bare circuit seemed a bit awkward to use, with the tiny pot and current sense wires close to the big load terminals. I wanted it to stand on its own on my table, so I fashioned a simple stand from a scrap piece of aluminum I found in my father's workshop.

Re:load 2 constant-current load in a simple custom enclosure.

I connected the load and the current sense wires to terminals on the front panel. I also found a matching 10 kΩ potentiometer with a knob for setting the current.

Eventually I want to also add a connector for external power supply and a switch instead of the solder jumper that's on the PCB. I didn't have one at hand when I was first assembling it though so it's missing here.

Mounting the enclosure directly to the heat sink makes sense from the mechanical point of view, but it also means the whole thing gets uncomfortably hot under load. Unfortunately that was the only obvious solution. The four 3 mm mounting holes on the Re:load's PCB turned out to be useless for actually mounting the thing. SMD components are too close to the holes to accommodate a spacer or a M3 nut.

Re:load 2 with an external potentiometer and connections.

As far as I have tested it, Re:load 2 seems to work as advertised. I haven't noticed any drift in current I could notice with my multimeter when Re:load is heating up. I did notice though that with the 6 A range it gets hard to set currents below 1 A even with the large knob I added. A fine-adjustment pot might be handy in those cases.

I haven't tested the thermal protection feature. I have looked up its design though - there are no obvious components doing the advertised thermal shutdown visible on the board or the schematic.

The secret turns out to be in the BTS117 component. What looks like an ordinary MOSFET in a TO-220 package is in fact a linear integrated circuit with a power MOSFET and all sorts of protection functionality. Here's the datasheet if you're interested.

In conclusion, at the first glance Re:load 2 seems to be exactly what it says it is. At $30 I paid with shipping to Slovenia it's also quite cheap. Even if I just count the material, I doubt I would get below that if I would make my own from scratch.

Only time will tell if it's also as indestructible as it claims to be. Considering what kind of hardware ends up on my desk I don't think I'll have to wait long to put that to the test.

Posted by Tomaž | Categories: Analog | Comments »

Balanced variable phase shift circuit

13.05.2014 14:28

While working on the new UHF receiver for VESNA, I came across a problem when I wanted to correct for a delay in a 16 MHz sine wave signal. The idea was to have a circuit where you could adjust the phase shift by turning a trimmer of some sort. Delaying a signal of single frequency is relatively simple and shouldn't involve delay lines or other such unusual components.

While searching for circuits that would fit this purpose I came across the single transistor phase shifter. While it isn't directly applicable here, it did give me an idea. Signals in my circuit are balanced, which means that for every signal you have the inverse signal available as well. This fact removes the need for the transistor that only serves as a way to invert the signal.

This line of thinking led me to the following a circuit:

Balanced, variable phase shift circuit.

In a single-ended RC circuit the gain as well as phase delay varies when you change the time constant RC. The very nice thing about this balanced version however is that its response only varies in phase. The absolute value of gain remains 1 for the complete range.

You can verify that from the expression for the complex gain:

\frac{U_{out}}{U_{in}} = 2 \frac{j\omega R C}{j\omega R C + 1} - 1

The characteristic value for the circuit is the normalized angular frequency ωRC. Here is the relationship between it and the signal phase shift Δφ.

Phase shift versus wRC.

Note that you can affect the phase by changing either capacitance or resistance. I've chosen a variable capacitor for my circuit because trimmer capacitors characterized for high frequencies are simpler to find. Small variable resistors seem to be mostly designed for low frequency signals and don't have defined characteristics for higher frequencies.

You can also make a similar LR circuit, but tunable inductors are even rarer these days.


From the graph above it looks like you could achieve any phase shift for any frequency with this circuit. In reality however several factors limit the usable range.

The maximum phase shift is limited by how low you can get your time constant RC. With capacitances below 1 pF stray effects of the circuit board start to get significant. On the other end, you are limited by the circuit's input impedance Zin. Typically the lower bound is dictated by whatever is driving the circuit.

Z_{in} = R + \frac{1}{j\omega C} = R\left(1 + \frac{1}{j\omega R C}\right)

This expression shows that the impedance is lowest for the lowest phase shift and that the chosen resistance value directly affects Zin. Therefore in general, you want to keep the range of capacitances as low as you can and keep the constant resistance high.

To illustrate, here are usable ranges for phase shift Δφ for frequencies between 1 MHz and 1 GHz and three different lower bounds on Zin. For the range of capacitance values I used a common trimmer capacitor.

Phase shift ranges for different frequencies and impedances.

In conclusion, this circuit can be quite useful when you are dealing with balanced signals, but you need to drive it from a low-impedance source to have a wide setting range. For electronic phase adjustment I guess a varactor diode could also be used instead of a trimmer capacitor.

Unfortunately, I had to leave this part out of my final design because I ran out of circuit board real-estate for an additional voltage-follower and trimmers. I'm describing it here however, because I'm sure it will come handy in the future, perhaps as an add-on daughterboard for the receiver (I left provisions for that).

Posted by Tomaž | Categories: Analog | Comments »

Seminar on spectrum sensing methods

07.05.2014 17:34

Today I gave a short seminar on spectrum sensing at the Jožef Stefan International Postgraduate School. It contained a quick overview of the topic: what spectrum sensing is, what are the most common methods that are used in the context of dynamic spectrum access and how they can be implemented in practice.

Spectrum sensing methods and implementations title slide.

I couldn't go into much detail in the short time provided, but I've written a paper that goes with the talk and covers a bit more. The version on the School's website has reasonably unreadable formatting, so I'm publishing my original copy here. Of course, you can also download the slides.

When I first attended one of these seminars, I was somewhat surprised by the format. I haven't seen anywhere else that questions from the audience are written on slips of paper that are then passed over to the speaker to read and answer.

I sometimes attend seminars on interesting topics at the Faculty of Mathematics and Physics across the street from IJS. For example, there the Q&A is a normal human discussion between peers. The presentations are around 45 minutes while here I've heard a comment that they should be shortened to only 15 minutes.

I'm not sure about the reasoning behind these choices at IPS, but I can say that I like the common version better. If not for anything else, because I would not be hesitant to invite people that don't need mandatory attendance to join us.

Posted by Tomaž | Categories: Life | Comments »

Idioterna's USB charger

05.05.2014 19:37

A while ago Jure told a story on IRC about how he bought a bag of very cheap Chinese battery chargers with an USB socket. One of them apparently self-destructed with smoke and fire.

Charred remains of a cheap USB charger.

Image by Jure Koren

I've seen some interesting posts about such gadgets from Ken Shirriff. After watching tear downs that show how little regard for safety some manufacturers have, I was curious to take a look at one of such specimens myself. So I asked Jure to borrow one.

Disassembled cheap USB charger.

With the charger disassembled, I was surprised to see a design consisting solely of discrete transistors, bipolar no less. This is rare to see these days, especially for line converters. Typically, I would expect to see a circuit built around one of the many chips on the market intended solely for this purpose.

Note also that the plug isn't soldered to the circuit board. Rather, the prongs are only touching metal connections that have a bit of flexibility in them. I wonder if this is what caused the carnage on Jure's self-destructed charger. Since no components are visibly damaged, an arc could have developed over a bad connection on one of the prongs.

Isolation boundary on a cheap USB charger.

Here is the bottom side of the circuit. I've marked the isolation boundary - the line between the high-voltage primary side of the circuit and the "safe" low voltage secondary side. The separation at the closest point is a millimeter at best.

Specification printed on a cheap USB charger.

Here is the specification printed on the casing. Note that the CE has the proportions of the infamous China Export, not the European conformity mark. Such an unsafe design would never pass a conformity test.

Intrigued by transistor-only design, I took the time to draw the full schematic of the circuit.

Schematic of a cheap USB charger.

How does it work?

Diode and the 2.2 μF capacitor on the input form a half-wave rectifier for line voltage.

The topology is a regular flyback converter. In the first half of the cycle the power transistor Q1 is open. The current through its collector and the primary winding of the transformer is rising, storing energy in the ferrite core. Induced voltage over the secondary terminal is negative and D2 is closed.

At one point primary current raises to the point where voltage drop over the 12 Ω resistor is greater than Ube of Q2. Q2 opens and shorts the base current of Q1 to ground. Q1 closes and primary winding current drops abruptly to zero.

The stored magnetic energy induces currents in the secondary and auxiliary windings. D2 opens and the current charges the output capacitor C2. At the same time, auxiliary winding charges C5 and also keeps Q1 closed further - step change in induced voltage on the current pulls base of Q1 negative through C3 and the 560 Ω resistor.

When the core discharges, Q1 obtains the base current again and the cycle repeats.

Output voltage regulation is implemented using Zener diode ZD1. When the diode breaks down, it causes current to flow over the LED in U3. This in turn opens opto-coupler's transistor, which injects current into Q2's base, halting the converter until voltage drops again. In other words, this converter only functions in discontinuous mode.

Function of 500 mΩ resistor on the input is a bit of mystery to me. Typically you would find a fuse or a fusible metal film resistor. From the looks of it however, this is just a regular carbon film resistor. So either it's a case of cargo cult engineering or it's needed because of some subtle effect on the circuit behind it.

There is one safety feature on the circuit: the varistor between the primary and secondary ground. It's there so that any static discharges from the USB connector do not compromise isolation in the transformer. I've seen this safety feature implemented simply as a spark-gap printed on the circuit board, so a varistor is an interesting choice. (Update: as S56A points out in the comments, this is more likely a Y-class capacitor I have misidentified as a varistor).


Guessing from the discontinuous mode of operation, I would guess it doesn't regulate the output voltage very well. Devices that use USB solely for charging a battery probably aren't too sensitive to voltage swings though, so it might fit its intended purpose just fine. I haven't tested it though.

In conclusion, an interesting design. Very simple and built from cheapest possible components. I'm wondering if this was designed from scratch or maybe copied from some obsolete design from back before integrated flyback controllers were available. On the other hand, it's obviously a dangerous toy to leave unattended at home and most likely illegal to sell in the EU.

Posted by Tomaž | Categories: Analog | Comments »

GA 7VT600 lmsensors settings

02.05.2014 17:35

Recently I've put into use a relatively ancient Gigabyte GA 7VT600 1394 motherboard that's been gathering dust on the top shelf of my wardrobe. I used it to replace an even older MSI board which, while still working perfectly, was getting a bit slow.

After replacing the dead lithium battery for RTC and NVRAM, it seems to work just fine with stock Debian Wheezy and passes a few ad-hoc stress tests.

One thing I noticed though is that sensors tool from the lm-sensors package isn't very useful by default.

it87-isa-0290
Adapter: ISA adapter
in0:          +1.70 V  (min =  +0.00 V, max =  +4.08 V)
in1:          +1.33 V  (min =  +0.00 V, max =  +4.08 V)
in2:          +3.25 V  (min =  +0.00 V, max =  +4.08 V)
in3:          +2.86 V  (min =  +0.00 V, max =  +4.08 V)
in4:          +3.23 V  (min =  +0.00 V, max =  +4.08 V)
in5:          +1.89 V  (min =  +0.00 V, max =  +4.08 V)
in6:          +1.89 V  (min =  +0.00 V, max =  +4.08 V)
in7:          +3.01 V  (min =  +0.00 V, max =  +4.08 V)
Vbat:         +0.00 V  
fan1:        3308 RPM  (min =    0 RPM, div = 8)
fan2:           0 RPM  (min =    0 RPM, div = 8)
temp1:        +35.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
temp2:        +31.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
temp3:        +47.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermal diode
intrusion0:  OK

The board obviously has a IT87 series chip that provides some hardware monitoring functionality (you need the it87 kernel module). Apart from the lack of useful labels, some voltages also seem to be divided by voltage dividers before being measured by it87. I would expect at least 5 V and 12 V lines there.

Figuring out which fan is which was trivial. For finding out other things, I compared the printout above with what the BIOS setup utility says. I picked out the most logical divider values for voltages. Since these also seem to fit the order of sensors, I'm relatively confident they are correct.

PC Health Status screen on GA 7VT600 motherboard.

in5 and in6 readings are very unstable and don't seem to be shown in the BIOS screen. I'm guessing they are not connected on this board. temp2 is also not shown, but seems to give reasonable values, so I'm guessing there is a temperature sensor connected there, but I don't know where it is.

So, for future reference, put this into /etc/sensors.d/ga-7vt600 to get a nicely labeled and properly calculated values for this hardware:

chip "it87-isa-0290"
    label temp1 "Sys Temp"
    label temp2 "Aux Temp"
    label temp3 "CPU Temp"

    label fan1 "CPU Fan"
    label fan2 "Sys Fan"

    label in0 "Vcore"
    label in1 "DDR Vtt"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "+12V"
    label in7 "5VSB"

    compute in3 @*1.679, @/1.679
    compute in4 @*3.973, @/3.973
    compute in7 @*1.679, @/1.679
Posted by Tomaž | Categories: Digital | Comments »