Archive for December 31, 2013

More goodies

Felt I needed a shopping trip, just because I could. If there is one thing about the electronics hobby you should know, is that you never have enough parts. This time I visited Supremetronic on college street again, if it is still called that since it merged with home hardware.

Though I realize I could probably order the parts online and not have to go anywhere, I brick and mortar shop for two reasons. First, I want to support the few remaining shops still in business. They are having a hard time competing with online retailers. Second, I like the experience. Sometimes it’s damn hard to tell what I’m buying online and it helps to logically find stuff in bins of parts. It’s important also to keep through-hole components and by extension, hobby electronics alive. Radio Shack has become a pale shadow of what it once was, nothing more than a gadget retailer now. Especially in Canada where it has become “The Source” which is just laughable and has nothing I want for too much money. I do not shop there.

Anyway, I was able to get many parts I was missing given the revisions going on in my power supply design as well as my nixie tube clock project which has been on the back burner.

I picked up a 2x6V 12VA transformer, which means I can get 1x12V out of it at 1A. Just what I needed. Smaller and lighter than the 24V ones I was messing with since they are no longer necessary. This will power my relays and output board switching as well as my meters, keeping it nice and independent from my main power board.

As I mentioned before a couple of posts ago, I’m moving the voltage and current reference settings to the main board so that they actually have a common reference. To that end, I was able to find some zener diodes that work perfectly. Picked up 8 or so 30V zeners (didn’t know they existed), a bunch of 12V ones and some 5.1 (i think) volt zeners. This should give me rough voltages to start from and regulate for the references.

As a bonus, I figured out I can use another darlington transistor biased with a zener at it’s base to drop the voltage from the main rectifier (currently at 42.6V) to just shy of 30V so I solved the problem of the voltage being too high as well. This will save me a lot of heat and keep me well away from the voltage differential maximums for my regulators. This now means that I have to use three pairs of darlington transistors: first, as a pre-regulator, second as the current regulator, and third as a pass transistor for the voltage regulator. This seems complicated to me (as I am sure it does to you) but I really want to keep these functions separate if possible. I’m sure I could combine the first two just fine, but I want both to function 100% independently just in case. This is a learning process, so things may change when I breadboard it up and see if it catches on fire.

So I’m homing in on my final design. It’s a bit sad that my control voltage board basically has nothing on it anymore apart from power to the relays and the regulators for the meter supply. I may merge this with the output control board just to save boards. It also occurs to me that I may not have enough headroom on the new transformer for a 7812 regulator to give my output board a stable 12V. I do believe after rectification and smoothing with a 1000µF cap, I should have plenty to overcome the dropout voltage of the 7812.

In addition, I also picked up a few parts I was running low on. Notably, a bunch of dual and quad opamps like the TL084, LM3900 (which I heard was discontinued yet still available), and the NE5532 (one of which I fried by accidentally using it in place of a 555 timer for the nixie supply). Also picked up a bunch of 555 timers and 556 dual timers for various applications. I was thinking of improving my soft start circuit with a more accurate (and more customizable) timer using 555s though this remains to be seen. I may revert to the earlier design anyway. I still haven’t figured out to create a latching cutoff condition during current overload without putting the sense after the relay. A minor, but important detail.

the nixie clock now will also have MPSA42 300V switching transistors for it’s digits. I’ll write on this in a separate post.


Finally, it happened. I busted a cap. No, this has nothing to do with firearms.

I’ve oft been entertained by youtube videos showing exploding capacitors but had yet to witness one in person, thankfully. Here’s what happened.

I was playing around with my voltage control board using my new transformers. I used pretty much a standard rectifier design to get my DC out, and all was well through several tests. I used a 1000µF cap as a filter and it was working through the short power up tests I was doing. As I progressed, I left it on for longer and longer. At one point, with no warning, it just went BANG and scared the living crap out of me.

At the time, i was using my finger to test the temperature of my trimmer pots and resistors in my voltage divider for the 24V Vset reference because I was having some heating issues. I did notice that the first resistor and trimmer was too warm for comfort when I hard a bang and my head was enveloped in smoke.

After I coughed my lungs out from the noxious electrolyte vapour, I was worried that it was my trimmer(s) that died on me but was puzzled to find them fine and operational. Then I looked a bit left and noticed the deformed case of my filter cap.

What had happened was I mistakenly chose a 1000µF cap with only a 25V rating when the voltage across its pins was about 35V. Surprised it lasted as long as it did really.

Moral of the story: pick a cap with the proper voltage rating for heavens sake! At least it wasn’t a tantalum cap which are prone to catching on fire. Still, scary. Breathing the vaporized electrolyte wasn’t good for me either.

Voltage, it’s relative

So yeah, playing about with my new transformers, everything working fine. Until I realized one tiny hiccup. When I switched the control voltage board to it’s own transformer for the sake of the meters, I thought it a good idea to keep the circuit as is and have independent references for Vset and Iset. Though in theory this sounds like a good idea, I had one of those face-palm epiphanies. With two isolated power supplies, they have no common voltage reference. If I try to inject a voltage on the set pin of an LM317 and use the power supply ground as a ground references I get: 0V. It’s interesting to think about what this means. With no common reference, the potential is, effectively, zero. Hilarious! Also, utterly useless for my application.

Fixing this minor issue is quite easy. I have two possible options:

  • connect Vset and Iset to the set pin of the LM317 and the input on the current comparator. I am not sure at all this will work. In fact, I’m pretty sure it won’t.
  • move the 0-24V Vset and 0-3V Iset back to the main power board so they share a common reference. This seems more likely to work.

What a learning experience! When I simulated it up in CircuitLab, it was assumed that ground is ground. Whenever I define a ground reference it’s universal. Sadly not true for reality. Voltage, by definition, is a relative measurement – the difference in potential between any two points in the circuit. With no common reference, it’s meaningless.

What kind of sucks is now my control voltage board has much less functionality. The two transformers I bought, sadly, not for this project. No matter, their values are common enough that they will find definite use elsewhere. Especially since they are both centre-tapped.

So, what’s left? If I subtract the Vset and Iset from the cv board I am left with the relay control circuits and the power for the meters. Not bad that. I can use another, smaller, transformer rated for 12V. As for the voltage references for the current and voltage setting, I can use either fixed linear regulators or zener diodes (probably the former). Not what I had in mind, but not the end of the world either. At least it stopped me from moving things between the two boards, unsure of where they should be.

XBMC Youtube fixed, finally

Last night I thought I’d take a poke at trying to fix XBMC’s youtube plugin which has been broken for me since the summer. This was most annoying. I could still use youtube on it, but I’d have to search for videos I wanted rather than just pop into my favourites and play the damn thing. I’m quite sure I lost some hair fiddling with the script and trying various login techniques.

The root of the problem is, of course, Google. In their wisdom (read: folly), they decided to force users into G+ sideways which mucked up 3rd party attempts to use youtube in any useful way. Those who know me know I loathe social networking. I have zero desire to plaster my personal thoughts, feelings and actions across the internet especially in light of recent (though obvious) revelations that our information is not only posted, but permanently posted, used, abused, analyzed, and made to turn a profit while providing a handy information source for american spooks. Not my idea of a fun time. I will not digress into a lengthy political discussion, I refuse to waste my life.

Getting back to XBMC, one chappy posted near christmas on the open ticket I had on the YouTubeXBMC bug tracker. The entire thing can be found here. What came to light through the last post is the following:

  • it is now impossible to separate G+ from YouTube, Google has forced it down our throats
  • XBMC was logging in successfully, but it was looking for videos in the new channel created when G+ was created not the old channel as expected

The last part proved key. I was perplexed that it was logging in and finding nothing for favourites, subscriptions and history. It turns out I had two youtube channels now, one under my real name and the other being my old one. Though ostensibly connected to one another, they are separate and one could not point to, or exchange information with, the other. Annoying.

After fiddling for some time to get it to read from my old youtube account, I gave up (as probably Google intended) and just shifted everything over to the new account. Bang, it works. Finally.

The one catch here is as I mentioned above, two channels cannot exchange subscriptions and favourites. Bummer! Yes, I had to manually do it all over again. Some odd 100 faves and 30 subscriptions. Though modest by YouTube standards, it took some time and was tedious as hell. So now I’m my real name on youtube but that matters little since I only use it to save videos for playback on XBMC. I create none myself.

Really though, the kind of modifications Google is making lately are terrible. Apart from forcing us both to use our real names and G+ they have made the experience annoying. I’ve used handles to post comments since before the internet existed and I prefer it that way. I also have no use for the piece of garbage that G+ is. Hell, I have no interest in social networking at all. If I am forced to have a G+ account, I simply won’t use it and won’t give it any information. None of their business.

This is peanuts compared to what they’ve done to content creators, now they are having a hard time getting to their comments and analytics and it’s also messing with their monetization settings.Seriously – don’t stab yourself in the foot there. Remember these are the folks that make you money and make people want to use youtube. Don’t fuck with that.

In brief, Google you bungled this one, and I haven’t seen a single person out there who likes your “improvements”. Stop being evil and listen to your user base.

Back to the lab…

OK so I’ve enjoyed a bit of a respite from pretty much everything except relaxing and revelry as suits the season. I made sure and visited A1parts the other day and picked up some more parts and bits.

There, I was able to find two used transformers, one 25V CT and one (presumably) 28V one in a cool retro hammond case. I bought two since I figured I couldn’t lose by having an extra transformer about in that range, but also wanted to see how big the voltage jump would be after I rectified and filtered it. It was also a major piece of the puzzle for my control voltage board as it requires a separate supply from the main one to give an independent voltage reference as well as power my meters. The plan today is to test their output voltages and build up the basic control voltage circuit. I can then test the power drain of the 12V loads (relays and indicators) and their effect on the control voltages (hopefully minimal). This is probably the shortest path to finishing the next board in my power supply.

I realize I need to do up a new schematic for the cv board given the modifications I previously mentioned, and I will do that soon. I am just too eager to get my hands dirty and breadboard it up.

Other items I managed to grab while I was at A1:

  • Nice pair of side cutters
  • Panel nibbling tool
  • A collection of smaller gauge marettes
  • Some smaller gauge splice crimps
  • Some 0.1Ω 1% 2W resistors

The last item was a nice find and will be useful for experimentation. I could use them in my final design for the current shunts since the max power dissipated would be 900mW, and I may still, but I think I will shop on digikey for those precision current shunts I mentioned in a previous post. It would cut soldering down from 11 components to 2 components for the ammeter. Still, good enough for testing! I can parallel 10 of them to make 0.01Ω. Shame I couldn’t find the same in 10Ω to make the 1Ω shunt. I suppose I could put 10 of them in series but that’s just silly.

Zener diodes can be bloody useful

More problems… more solutions…

So, I was just going over the main power supply board, looking to solve something that on paper should work, but in reality is less than ideal. The output of my monster transformer is somewhere in the neighbourhood of 42.6V with no load. That’s a tad high considering the maximum voltage differential of the LM317 is 40V and the current output seriously suffers when it’s that high. I had tried breadboarding an earlier version of the circuit to get a total fail, the regulator refused to even bother to regulate. So, I figured an easy way to drop some voltage would be to use a bunch of series power diodes to drop 0.7V each, so I inline-soldered 6 of them to drop 4.2V (when under load) down to 38.4V. Looks nice and bodgy, i’ll post a photo at some point, looks laughable.

Though this approach sort of works, it is far from elegant, ugly, and I’m not entirely sure reliable. 38.4V vs. 42.6V is not that great a difference and still dangerously close to that maximum voltage differential. Not only would I like more padding for safety, but for more reliable operation that dissipates less heat.

The general calculation for linear regulators and power dissipation is given by: ( VIN – VOUT ) * IOUT. Even with passing most of my current via a pass transistor, the LM317 will dissipate an unacceptable amount of power. I read somewhere that the absolute maximum dissipation is on the order of 15W and at full load and minimum voltage, I calculate that it will dissipate 9.3W. Though this is under the limit, the wide differential voltage could potentially cause problems. Also, I just don’t like it. Yes, it’s my first power supply – but I want it to be a good one I will want to use for years.

Zeners to the rescue

A little googling around revealed that I could use a transistor, Zener diode and resistor to act as a voltage regulator. In this case it would be a pre-regulator and would drop the voltage down to about 30V which would solve the above issue. I found this circuit from Elliot Sound Products, a site I’ve been liking for several years now as most of his projects are for audio. The entire site is full of not only useful circuits but in-depth explanations, I highly recommend it. Turns out this technique is used all the time in audio amplifier applications for this exact purpose.

The mechanism of action is quite simple – use a zener to bias the transistor and the voltage drops by the zener voltage plus 0.6V. So a 12V zener would knock down my voltage to pretty much exactly 30V. Nice and tidy

I looked back at my schematic and didn’t like the idea that I would have to add yet another transistor pair and more circuitry. It then occurred to me that I’m already kind of doing the same thing with my current limiting darlington transistor which drops the voltage in response to hitting the set current limit. If I bias this transistor properly, I can essentially achieve the same effect without adding in another transistor and keep my circuit mostly as it was. Brilliant. Of course, I’ll need to simulate and then do a test build to make sure it won’t catch fire.

By my (inexperienced) reasoning, I believe I can combine both functions by using a 12V zener to bias the transistor from the positive rail, dropping it down to 30V by default, and keep my other transistor which will open to ground if the current limit is reached. Hopefully, this will still drop the base, when the current limit is exceeded, to 0V and thus zero current, shutting it down.

I have to point out here – I really have very little clue what the hell I’m doing, so if you try this I’m not in any way responsible for what may happen to you. Do your research and use caution. I’m learning out loud. If you have any comments on the above please post them, I can use all the help I can get. For myself, I’m not trying this until I simulate it first.

I’ll post schematics and simulation analysis when I have it.

Opamps and something I didn’t think of…

This process also brought to light something I completely forgot about. Using simulation, the opamps were omitting their power rails as is often done on schematics assuming rail to rail operation. In reality, these opamps would have a supply voltage, and the output of said opamps is limited by this. Under ideal conditions, the opamp would be rail to rail and be able to handle the full 80 odd volts (since I have to power them before all the regulation happens to ensure operation). I’ve never seen an opamp that can handle 80V rail to rail, though it wouldn’t surprise me if these exist … and are expensive as hell.

Really, I have no need of such precision and such a wide voltage swing in my outputs. The opamps are used to manage the set voltages for the current limit and voltage regulation. Using the idea from Dave Jone’s excellent power supply videos, I use a 1Ω current shunt, and a bunch of opamps to compare a measured current to a set voltage and keep the two in line allowing me to set the maximum current allowable. For the voltage setting, the opamps are used to buffer, split and invert the signal so that one voltage setting can be used for both the positive and negative regulators so they track each other and avoid the messy issue of using dual-gang pots (also, I’ve never seen a 10-turn dual gang, again, wouldn’t surprise me if they exist but man that would be expensive).

Last night, before I slept, I chewed it over a little and figured out how I can solve this supply voltage issue. The requirements are that I need to have a 3V voltage swing for the current limiters and a 24V voltage swing for the voltage setting. The former is quite easy – I can use just a couple of standard LM3900 quad opamps since they can easy output a 5V swing. If I supply them using say ±5-12V that would provide an adequate swing for both positive and negative current limiting (whose desired values are 0-3V for the positive, -3-0V for the negative) and prevent going anywhere near either rail since these are not rail-rail opamps. I can use two LM3900s (one for positive, one for negative) and supply them both with at least ±5V using zener diodes. Lovely solution!

The voltage setting is a bit more difficult. In shopping about I had a hard time finding opamps with a supply voltage greater than 44V rail-rail, which is just shy of the 48V r-r I would need to set the voltages from 0-24V (and invert to negative for the negative regulator). Of course, they beauty of op-amps is that they are analog calculation machines, in essence.

The circuit as I have it uses 4 opamps which act as buffers and one inverting amplifier. It would be a simple matter to power the positive ones from 0-24V (the LM3900 has, I believe a ±16V supply limit, giving me 36V if I were to single-supply power them) and the negative ones from -24-0V. The one inverting amplifier would, according to my reasoning, have to straddle the negative and positive voltage rails in order to invert the signal. Here’s the neat bit: to overcome having to convert a maximum of 24V to -24V (and use the associated > 48V power supply) I can simply convert the buffers leading to the inverter into variable gain amplifiers to divide the voltage in half, then invert it, then multiply it by two. This way the inverting amplifier can run on half it’s supply voltage (24V, -12V – +12V) and stay well within it’s limits. I’m not sure how much precision I would lose in this conversion but it would afford me greater control of the symmetry between the rails as well if I add in a couple of trim pots on the gain of the divide-by-2 and multiply-by-2 amps. The supply voltage for the all the amps can be easily accomplished using zener diodes in various configurations.

I know some of you are screaming at my already to use a bloody microcontroller and stop fiddling about with messy opamps. Really – I want to do it this way. I feel that in my self-education, I want to use opamps effectively and get a good understanding of analog electronics before pushing on to digital. This is why I am trying to keep the power supply entirely analog, which I have done so far apart from the meters.

Currents and Transformers

Salvaged Transformer candidate

So not feeling like assembling another annoying voltmeter tonight, I thought I’d do some testing to get a real idea of parts of the control voltage circuit. As I may of mentioned, I had a couple of extra transformers hanging about, so I thought I’d rectify their outputs and see if it could work for me. My requirements again are that I have at least one output capable of 26.5V rectified DC. Even better if it had multiple outputs that could be rectified and regulated to give 24Vdc, 12Vdc, and 5Vdc.

So I have one with three pairs of secondary wires that I had measured before, and they seemed close – but the only way to tell is rectify it and take readings. I used a simple integrated bridge rectifier and a single 1000µF cap for filtering. Probably excessive, but more fun anyway.

On the first pair, I measured 22Vac and got 27.4Vdc, perfect! I can get 24V from that. On the second I had 11Vac and got a disappointedly low 13.12Vdc. Linear voltage regulators like the LM7812 have a large dropout voltage of around 2.5V so it’s best to exceed that to get a stable regulation at your target voltage. I would need at least 14.5Vdc preferably higher by a volt or two. The last pair originally measured 8Vac and 9.22Vdc, perfectly fine for 5Vdc. Dang, if only the middle one was two volts higher I would be rejoicing.

Now I know what your saying, I could mess with combinations of secondaries in series to get a larger Voltage on the middle one. Fact is, I was hoping to keep them all separate, and if I am to combine them anyway, I might as well just buy a new transformer and save this (salvaged) one for another project. Gives me an excuse to go shopping, not like I need a reason.

Relays and current consumption

The largest draw on my control voltage board will definitely be my relays. There are five of them in the proposed circuit. Two for output of the power supply to whatever project I connect to it, and three to switch the current shunt between the three rails. I suppose I could have put the shunt on the positive rail and call it a day, but I really wanted the flexibility of seeing the current flow on any of the V+, V and V0 rails. The relays are used since I’ll be passing up to 3A of current through them, so the more traditional band switch would not work.

Anyway, I powered up my relays, both singly and together and got the readings I was expecting, more or less. The larger pair of relays for the output are real power hogs. They are 40A rated (total overkill) and suck 130mA each when actuated. The trio of smaller relays are 10A rated and consume a more modest 75mA each. They measured in at a total of 450mA which is close to the projected 485mA value from the simple arithmetic.

The conclusion of both of these tests are that I will need to go transformer shopping. I’m not about to waste a centre-tapped transformer, or a three-secondary one for this application. I’ll probably just grab a 24Vac one. 1A should be more than enough for my needs since it doesn’t look like I will top 600mA anyway. Always best to have breathing room.

ICL7660 feeding two meters

I mentioned back a few posts when discussing using a separate power supply for the meters, that I could use the ICL7660 IC to provide the -5V side of the power supply for the meters, rather than a cascade of negative voltage regulators stepping down from 24V. I’m not exactly sure why the 7107 requires a symmetrical supply, but it makes sense because it will have to perform negative voltage measurements as well as positive. No problem.

I conducted a few quick tests to see where the current is flowing and found some encouraging results. On the -5V line, I was only able to detect about 90µA of current flowing through it when it’s doing nothing. This is encouraging as it means I most likely can use one 7660 IC for two meters rather than shell out for another chip. I say most likely as I am having a hard time finding what the actual max sink current is for the 7660. If someone knows, please let me know. I figure I will just go ahead and build the ammeter (learning from my mistakes with the voltmeter) and attempt to power both from my single 7660 and see if it melts on me. They are replaceable to why not? Even if the sink current doubles (which is what I expect), it will still only be 180µA.

I also measured the +5V and 0V leads and found that the bulk of the current, no doubt to power my humungous 1″ LED displays, travels from +5V to 0V and the -5V rail is just to provide a reference for the meter. Displaying all zeros, it draws 56mA of current.

Soon, it will be time to test and build the control voltage board. I have a junk transformer somewhere on my bench and I will test it’s suitability tonight. If one pair of secondary leads can be rectified to a couple of volts above 24VDC then I’m in business. I know this one to have several secondaries so that even raises the possibility of having separate secondaries for 24V/12V/5V supplies which would be even better. Otherwise, I’ll have to go shopping which I enjoy anyway.

Another thing to do would be to measure the total current draw of 4 relays when they are closed, add the odd 120mA for both meters, and the tiny quiescent currents of the regulators. I expect all of this to fall under an Amp which should do nicely.

Voltmeter success!

Now that I’m back to where all my tools are, I had a few minutes to pop down and perform the changes I have been documenting.

After messing about with a few alligator leads, I determined that not only does IN LO need to be connected to analog common, but the voltmeter ground as well. When IN LO wasn’t grounded, I got an initial reading (with nothing connected to the input) way off zero, beyond the point the trimpot could calibrate it.

As the forum posts mentioned in my previous articles stated – the dotted connections. must both be connected for the thing to work properly. This means REF LO is connected to ANALOG COMMON which is connected to IN LO and then GROUND. Given the language in the datasheet, I would have that it was an either/or scenario, not both. Regardless, I am pleased it’s working.

The assembly process was a bit messy, I cleaned up a lot of solder blobs and accidental solder bridges. Unfortunately, I soldered/desoldered and overheated a couple of pads, removing them from the board, the result works but it’s messy. If it can survive a few knocks and keep working, good enough for now. I can always build another one.

The divider resistor values calculated in my previous post worked a charm. Rather than wasting money and time grabbing 1% resistors, I tried various combinations of 5% ones until I got very close to those values. I tried a number of test voltages from batteries and my soon-to-be-replaced power supply and noted that not only was the reading linear across a range of voltages, but along it’s scale ranges as well which is exactly what I was looking for. After calibrating to 100mV and further trimming it a hair to get it in line with my multimeter, I am pleased to say it seems accurate to better than 1% which is not only good enough for it’s intended purpose, but better than I expected.

I have earned myself a beer tonight!

Voltmeter Scaling

As a follow-up to my last post, I ran a bunch of figures on how to set the proper scale ranges for the voltmeter and ammeter for the power supply project. The numbers end up being really close to the forum post I stumbled upon a few days ago which is great. Using 100mV instead of 1V for my reference voltage, I was able to recalibrate it by a factor of 10 and solved my former problem where I would have had to use 1MΩ as my divider resistor and it equalling the input resistor. This way, I end up using more sane values and I’m pretty sure when I retrofit my voltmeter they will work out ok.

CircuitLab mock-ups for voltmeter/ammeter scale divider resistors

CircuitLab mock-ups for voltmeter/ammeter scale divider resistors

On the back of the envelope, it would make sense to use round numbered divider resistors to get even factors of 10, but as it turns out in analysis, those numbers end up being slightly off for some reason probably involving calculus.

Not wanting to waste my sunday morning trying to remember math I last used in high-school, I consulted CircuitLab (invaluable resource and well worth the subscription price) and mocked up some quicky input divider circuits for my voltmeter and ammeter. The results I will display here along with the schematic.

Voltmeter Divider

Scale Resistor Ideal Value Resistor Calculated Value
2V (0-1.999V) 1kΩ 1.001kΩ
20V (0-19.99V) 10kΩ 10.1kΩ
200V 100kΩ 111.1kΩ

Ammeter Shunt Resistors

Scale Shunt Resistor Value
2A (0-1.999A) 0.1Ω
20A (0-19.99A) 0.01Ω

So that solves that. All that is left is to build it up (may breadboard it first to avoid unnecessary soldering) and see if she floats. Obviously, I’m going to have a hell of a time finding the Voltmeter divider resistors in those odd formats so I will just play with series combinations until I get as close as possible to those values. It will save me hunting for expensive 1% resistors when I can just compensate with 5% resistors of which I have a ton.

For the ammeter, you will note the numbers are a bit off, this is due to the 4 significant digits in CircuitLab’s calculation which is absolutely fine and I can trim any error with the reference voltage.

For the ammeter (as well as the current sense for the limiter) I have some interesting ideas which may warrant it’s own post, coming soon.