The Conduit: A portable, Class D TPA3110 Audio Amplifier

Update: I made a major revision to The Conduit Amp with some improvements and a bit better fit and finish.

A few months ago I was at the hardware store looking for cheap enclosures for electronics projects. Some aluminum junction boxes for electrical conduit caught my eye, so I bought a couple. In parallel, I was interested in building a small, portable amp that could operate off 12v, which led me to buy some little, mono, TPA3110 modules for a few bucks each.

Surveying my box of parts a couple weeks ago, I noticed that the TPA3110 modules would fit nicely in the smaller of the two junction boxes I purchased, and I started tinkering with ways to assemble them into a finished product.

IMG_0239

The first idea was to join the boards together with standoffs and slip them inside. I ordered some small terminal blocks for the electrical connections. When they came, though, and I tried assembling things as I planned, I realized I’d need to cut the standoffs down in order to fit a board to hold a potentiometer. I was feeling lazy, and didn’t want to deal with metal filings, so I looked for another way.

I decided to use pin-headers to mate the amp modules with small motherboard made from perfboard. For added mechanical strength, I cut the headers with more pins than needed, soldered the pin positions with through-holes on the amp board, and then glued the rest and trimmed them to the same length as the active pins.

Routing the power input and speaker outputs was kind of a nightmare. Rather than trying to plan it all out, I ended up working a couple of connections at once, trying to leave room for the other connections. It took quite a while. I was concerned about some of the routing and figured I’d probably end up doing a second version, so I soldiered on soldering my prototype.

Once I was done, I used my multimeter to check to make sure that there weren’t any short circuits on the motherboard. Fortunately, everything checked out.

Next I had to finish up the input connections and passive volume control. Rather than routing the audio input on the protoboard, I decided to take advantage of the shielding on the input to help keep the signal clean while passing the high-current power and output connections, and the inductors on the amp board. I connected it to the board with the volume-control board at the far end of the case.

After assembling the components on the volume control board I checked everything with a multimeter. Again, I was fortunate that I hadn’t ended up with any shorts. The volume control board was connected to the the “motherboard” with an excess of soldered pin headers for mechanical stability.

I covered the solder pads on the backs of the amp boards with kapton tape to keep them from shorting on the case. Then I made up a power cable and some speaker cables, screwed them in to the terminals on the motherboard and fed them out of the opening of the case.

Maneuvering the amp board into the case with all the cables attached took a bit more force than I was hoping for, a situation not helped by the fact that the position I chose for for the audio input connector interfered with part of the case casting, depriving me of a few extra mm at the opposite side of the case, and putting the volume-pot a bit off center.

IMG_0317

In the end though, I got it to fit.

My plan is to power it off a Quick Charge 2 USB power bank set for 12v output. I have the powerbank, but I still need to make something to negotiate the 12v output, so I powered it off a 12v power brick to test it out.

It works! Even better, it sounds good! So, a second version is a luxury, rather than a necessity. At full volume, the output level with my phone as the audio source is maybe a little lower than I’d like for something intended for use outdoors. I’m not sure yet if that’s a limitation of the 12v supply voltage, or if I need to bump up the gain of the amplifier.

Now that I know it works, I still need to finish it up. I need to fit an extension to the volume potentiometer shaft and pick out a knob that looks good. I also need to put some thermal pads on the bottom of the amp modules to transfer heat to the case. Also I’ll probably find some thinner gauge speaker cable.

Parts Used

Power Rail Noise/Ripple with a Sanwu Blue TPA3118 Mono Class D Amplifier Module

I’m building a few custom audio amplifiers for my personal use out of some inexpensive modules based on the Texas Instruments TPA3118 and TPA3116 Class D amplifier chips.

Class D amplifiers are basically variable switching regulated power supplies (SMPS), which makes them compact and power efficient when compared to traditional amplifiers, which are much more like linear regulated power supplies. The switching frequencies are designed to be well outside of the range of human hearing (and the circuits and transducers we use to reproduce sound) so that it can be filtered without interfering with the audio, and so any remaining signal at switching frequencies is inaudible. In the case of the modules I’m using, the switching frequency is ~400KHz.

The modules I am using have LC (inductor + capacitor) filters on their outputs in order to filter the switching frequency before sending it to the speakers, but I was concerned that the modules would also inject noise onto the power supply rails. TI has provisions for slaving multiple chips together so that they use the same switching clock and can avoid distortion due to interactions on the power supply bus, but the modules I’m using don’t expose the necessary pins, and the small component sizes and spacing between the PCB traces didn’t make me eager to hack them.

Some people have addressed the issue by dedicating a separate power supply to each module, but all things being equal, using a single supply should be cheaper and more compact. I asked for advice on the DIYAudio.com forum, and got some general suggestions, but nothing specific enough to be actionable. I was going to need to do more of the legwork myself.

So, first step, was to see if there were any existing solutions. I started reading datasheets and application notes, but I didn’t find what I thought I needed. I did learn though that, in addition to the switching frequency, Class D amps draw current at either 1x the audio input frequencies, when configured as a half-bridge, or 2x the audio input frequency, when configured as a full bridge.

Next step was to measure magnitude of these potential PSU noise sources in a naive implementation, with no added filtering beyond the PSU’s output filters and the modules PSU input filters.

I used the 24v DC PSU I had handy, an ~10-12 year old 65W Apple 24V PSU intended for a Macintosh PowerBook. I haven’t seen a teardown of the PSU, but in general, Apple seems to put a lot of effort into making their PSUs electrically robust and low noise.

I paired this with a Sanwu “Blue” TPA3118 PBTL mono module. which has ~1320uF (2x 2x 330uF) of electrolytic decoupling caps on the power rails. I then hooked up my oscilloscope and an Analog Discovery to do the measurements.

DS1Z_QuickPrint2

With no signal input to the amp, this is what the power supply rail (yellow) and the amp output (blue) look like. You can see that there is a sinuous ~400KHz, 1.2v peak-to-peak signal on the output from idle switching of the output bridge. You can also see evidence of this switching on the power rail, at the same fundamental frequency, but with a lot of ringing. The 400KHz component is about 50mV peak-to-peak, while the higher-frequency ringing and transients are about 190mV p-p.

I also took measurements using my Analog Discovery as a spectrum analyzer.

Baseline 1MHz Narrower Y range (similar lashup, no AC power to PSU)

First with everything connected, but no AC power applied to the PSU.

Apple 24v Brick with resistor load

Next, with AC power, and various resistive loads. I was sloppy and didn’t record the exact condutions, but it gives some sense of what the PSU noise is and how it changes with load. Blue is with no load, magenta is with ~30 Ohms, Green is with ~15 Ohms. Also, note, this is a relatively wide spectrum range, from ~0 to 2MHz.

0-1v 100Hz in. multiple traces. 1MHz wide

With the amp as a load (driving a 7.5Ohm power resistor). There is a 100Hz input to the amp. Each trace is a spectrum measurement of the PSU with a different input amplitude, from signal-off to 1v peak-to-peak. These readings were DC coupled, so the measurement reflects the DC voltage component. As a result, the average level for each trace is closer to the baseline as the DC voltage of the PSU rails sags at higher output powers.

There are peaks at the 400KHz switching frequency, and its harmonic at 800KHz. I’m not sure I understand all the little peaks that group around on each side of the switching frequency.

DS1Z_QuickPrint3

In the time domain, we can see the amplifier-induced PSU ripple & noise in the yellow trace, along with the amplifier output signal from a 500mv p-p, 100Hz input signal. There is a 200Hz ripple on the power supply rail as the amplifier bridge switches on 2x for each input cycle, once to drive the output high, and then again, in reverse polarity, to drive the output low. This ripple is ~500-600mV p-p and its phase is offset a bit from the output waveform. On top of that, you can see the switching noise in the high-frequency “fuzz” on the power supply rail. This “fuzz” is about 1.3v P2P. The two components together add up to ~1.96v of swing.

DS1Z_QuickPrint4

Pushing the input higher quickly runs into problems. With 1v input p-p, things look rather nasty as the peaks get brutally clipped off against the limits of the PSU voltage.

I also took PSU rail frequency measurements with input signals of 50Hz and 10KHz.

40-1280Hz 300mV in

I decided to wrap things up by looking more closely at the impact on PSU voltage at different input audio frequencies. Since the human hearing falls off sharply above 20KHz, and the amp current draw varies at 2x the input frequency, I limited the top of the measurement range to 42KHz. The input signal was 300mv peak-to-peak, and the input frequency was stepped starting at 40Hz and ending at 1,280Hz.

I’m really not sure what the high-frequency peaks are starting at 18KHz or so. I probably should have looked into them more closely.

Now that I have the measurements, I have to make sure I actually understand them before I figure out what to do, and how to do it. I note that in PBTL mode, the chip has a power supply ripple rejection ratio of 75-80dB up to 1KHz, rising to ~55dB at 8KHz and continuing at that level for the rest of the audio range.

 

SMSL HV-50 Amplifier, anyone?

Does anyone know anything about the SMSL HV-50 amplifier?

s-l1600

SMSL HV-50

I’m asking, but I think I already know the answer: No, no one knows anything about the SMSL HV-50 audio amplifier, or if they do, they aren’t talking (not in english, anyway). I found a recent reddit thread asking about it, but no one knew much, and I haven’t found much else.

What I do know are some basic details:

  • 50W per channel (stereo)
  • RCA inputs
  • 5-way binding posts for outputs.
  • Based on the TDA7492 Class D Amplifier IC from ST Microelectronics.
  • Aluminum case.

The TDA7492 chip is used in a lot of compact, inexpensive audio amps made by various Chinese manufacturers and sold under various names on Amazon, Ebay, AliExpress, etc.

41ZJRL36sHL

SMSL SA-50

It is also used in the older, almost identically specced 50 Watt/channel SMSL SA-50 amplifier, pictured above. The chip and specs aren’t the only thing the two have in common. As you can see, the case is the same. The only outward difference is slightly different markings and detailing.

The insides are a different story. Both use the same TDA7492 amplifier chip, but as you can see, the PCB and components are quite different.

Last night I noticed that one seller was offering the HV-50 for just $35 with free shipping, so I ordered one. At that price, it was a no-brainer. I’d have easily spent $25 and several hours getting one of the cheap TPA3116 boards I’ve ordered mounted in a suitable case.

I’ll follow up with a new post in a few weeks, once I have the HV-50 in-hand.

 

New To Me: Datron 1081 Autocal Standards Multimeter

I’ve passed up a few chances to get a Keithley 2001 7.5-digit multimeter on eBay for ~$500, because while that’s a pretty good deal for a Keithley 2001 in working order, it’s more than I can justify spending on a 7.5 digit multimeter that I want, but don’t need. Somehow though in my twisted psychology, spending $300 on a two-decade older 7.5-digit multimeter with known issues is perfectly acceptable, because I recently did just that.

A couple of weeks ago, I was checking eBay on my phone while waiting for an appointment and came across a new llisting for a Datron 1081 Multimeter that caught my eye. It was listed for parts or repair for $300, or best offer.

Datron 1081

According to the description, it had been damaged in shipping, and gave an error during selftest. From the photos, it looked like the shipping damage was confined to a broken “ear” on the front of the case, and misalignment of the front panel. Definitely interesting…

Some quick googling confirmed that the 1081 was, as I thought, a 7.5-digit capable multimeter with high stability and and the ability to use an external voltage reference. I thought it would be useful for evaluating and calibrating precision voltage references, and 6.5-digit DMMs, like the Keithley 2000 and HP/Agilent/Keysight 34401a. I couldn’t find an operators manual for the 1081, but I hoped the 1071 manual I found was correct that the selftest error was with the AC measurement circuitry. I’m mainly interested in DC, so I wasn’t too concerned.

I reviewed past eBay listings on my phone to confirm that the 1081 typically goes for more than $300, checked my gut, and decided to make an offer of $200.

The seller responded within a few hours that the listing had generated a lot of interest, and counteroffered for $275. At this point, I was back home, with the ability to browse eBay without the limits of a phone. I should have taken advantage of this to investigate past listing a little more thoroughly. If I had I would have realized that some of the higher sales prices weren’t actually sales, they were expired listings that eBay wasn’t filtering properly. I didn’t though, instead I accepted the offer.

It took a few days for the seller to ship the item, and it was shipped by FedEx Ground, so it took over a week to get to me. It arrived last Friday, packed well in a Cisco router box with reused foam endpieces and packing peanuts for extra protection. It was in the physical condition I expected; the case damage was limited to an extremity, and the main enclosure was sound. I opened it up for inspection and to deal with the misaligned front panel.

The front panel is a metal plate covered with a big printed plastic sticker. The sticker holds a smoked plastic protective lens over the display. The sticker was loose at a few spots, including the protective lens, which allowed dust and exposure to further weaken the adhesive. I decided to remove it, clean it up, and reattach it.

I heated the panel with a hair dryer to loosen the adhesive, but that didn’t work all that well. I ended up peeling the outer layer and printed layers of the sticker off its backing. Some adhesive remained on on the printed surface of the label, and the backing remained stuck firmly to the metal plate. I used a plastic scraper to remove most of the backing, but getting the rest off required a razor blade, elbow grease, and solvents (“Goo Gone” worked best). I used isopropyl alcohol to clean the remaining adhesive off the back of the printed sheet. Unfortunately I think the process of peeling off the label led to some of the printed brown background along the left side of the lower edge crazing and flaking off. I considered trying to apply a new background of spray paint, but decided the risk of causing further damage wasn’t worthwhile.

Once I got everything cleaned up, I decided to use some non-corrosive silicone adhesive to stick everything back down again. I smeared a thin layer all over the back of the sticker, and around the edge of the smoked lens before lining everything up and sticking it back down, smoothing it out and wiping off any ooze. I weighted the area over the lens and let it cure for a few hours before reattaching it.

As for the electronics, there sure are a lot of them, and very few of them are electrolytic capacitors – the component most apt to fail on older equipment. I looked everything over very closely.

I was relieved not to spot any physical problems, because while everything is through-hole components, many of them are packed in very closely, and a number of them look like nothing I’ve ever seen before. Repair would be challenging.

Glass Capacitors

My first Glass Capacitors

Actually, there was one problem, but one I expected to find.

The back panel was labeled at manufacture with a battery replacement date of April 1992! Either the battery hadn’t been changed, or whoever did so was too lazy to update the label. Inside I found the truth, the battery had a datecode of 1984, like most of the other components. Fortunately it still had a voltage of 3.7v, but I’ll be changing it soon.

I found a few other interesting things as I looked the device over.

IMG_7787

The photos above feature four 1N829a temperature compensated zener diodes. Together, they make up the heart of the voltage reference. They are each numbered with a unique serial number because they were carefully aged for months (or years), then characterized for noise, stability, voltage, and the current at which they have flat temperature sensitivity. My understanding is that the four Zener are connected as two parallel series of two.

I plan to look at these in more detail in a future post, because the unique characteristics of this voltage reference may make it the most notable part of this device. The use of hand-selected temperature compensated Zener was a common practice in a variety of precision instruments at one time, even so, the use of multiple TC Zeners was unusual, as is the stability they obtained. Also by the mid-1980s, when this device was made, use of temperature stabilized burried-Zener voltage references, like the LM199 (introduced in 1976) was commonplace.

IMG_7819

This insulated metal strip running the length of the digital board between a row of I/O bufferes, and the ribbon connectors, also caught my eye.

IMG_7845

I found evidence of a component level repair on the AC RMS converter board. Most of the components on the AC RMS converter board, and most of the other boards, have date codes no later than mid-1984, but the Fairchild opamp in the hermetically sealed package in the photo above is dated from 1987. The GPIB board seems to date from 1985, and there are some socketed ICs on another board that have 1986 date codes, while other chips on the board are from 1982 or 1983.

IMG_7860

Artifacts of repair can also be found on the inside of the case, where some of the melted nubs holding the RF shielding seem to have sheered off and been replaced with some glue.

Functional Tests

After checking it over and fixing the front panel, I reassembled it, and powered it up. On the EEVBlog forum, “dacman” suggested that self-test error could simply be the result of running the tests with the “guard” switch was set to remote. I could see from the photos on the listing that it was, indeed, set to remote, and it still was when I received it, so I set it to local guard and ran the self tests. Everything passed!

After that, I did spot checks on the 100mv, 1v, 10v and 100v DC ranges using the output from my EDC 521 DC voltage calibrator. The EDC hasn’t been calibrated in years, though from my tests, it is accurate to within the combined 1year tolerances of both it and all my 6.5 digit DMMs. The readings are stable over the short term.

I’ve also done some longer term checks of a 10v signal over a period of days and found that for the most part, the peak-to-peak variation is within the 20-40uV range measured by one of my Keithley 2700s (it is a 6.5-digit meter, but in stats mode it collects and calculates 7.5-digit values) in my Seattle home, near an external wall, without any heating. Sometimes  the Datron has reported a wider range than the Keithley, sometimes a narrower range. I’ll need to get logging working over GPIB soon so I can can look more closely at the trends.

Unexpected behavior

In the first few days, of use, I ran into a few instances of unexpected behavior, some of which may have been user error, some of which may have been software bugs, and some of which is as of yet unexplained.

One of the first things to crop up happened while I was checking the 100v range with a 100v output. After the initial readings seemed good, I left it for a while and checked it while I worked. About 15-30 minutes in, I looked over, and it was reporting values of 110v or more, and they were changing quickly. I haven’t been using the EDC much in its 100v range, so I breifly considered the possibility that it was at fault, but a quick look at the Keithley 2700 measuring the same source showed that the voltage was still stable at 100v.

The reading on the Datron was still on the move and soon it was reporting an “Overload.” I tried changing to the 1000v range, but the Overload message remained. I cut the EDCs output and after about 30s, the Datron cleared the overload message and started giving readings again. I applied an input again (I can’t remember if it was 10v or 100v), and it again gave plausible readings. I left it for a while and continued checking it, and after a while, it was again reporting an overload. This time cutting the EDCs output didn’t clear the overload message, and I ended up power cycling it.

Since then, I’ve been focused on the 10v range, and I haven’t seen this behavior again. I have had it with a 100v input for the last 18 hours or so though, and its been solid. I’m beginning to suspect that the problem may have been the result of user error. At some point, I think I’d used a function that “zeros” the meter. I thought this worked like the relative measurement option on my Keithleys, which can give readings relative to any voltage. The Datron 1081’s feature is different. The zero-point is supposed to be set with the inputs shorted, and the value is stored and used until the next time the meter is zeroed. If it is more than a small portion of the full range (1% or so), it will give a overange error. I’m wondering if perhaps the zero-point that I or someone else previously set was near the limit, and perhaps some internal auto-correction ended up pushing things over the limit. This is just a stupid wild ass guess though. All I can be sure of is that since setting the zero point for all the ranges with the input shorted, I haven’t had this happen again.

IMG_9130

I spotted the next problem after leaving the DMM on overnight. When I checked it the next morning, I suspected that the display had frozen because the last digit didn’t change once. I pushed a button to change the value displayed, and was treated to the above, after a minute or two, it seemed to reset itself and resume operation.

IMG_9131

The next morning, after leaving it overnight, I again found it with a frozen display. The first button I hit produced a similar result to the previous day. I tried hitting another button (I don’t remember which) and the rest of the display segments and all the indicator LEDs on the buttons lit up too. This time, it didn’t reset itself, at least not before I got tired of waiting.

I haven’t seen this behavior since, despite leaving the unit on continuously. A few days ago though, I decided to investigate a hunch. I thought that that when I saw this problem behavior previously, I may have left the unit displaying the delta between minimum and maximum values. So, I again left it in that state, and the next morning, the display was again frozen. This suggested that my memory was correct, and that it was infact a software problem. However, the following morning, after again leaving the unit in min-max display overnight, the problem didn’t present itself. So, it seems that I still don’t have it figured out.

What Next

IMG_9164

I’m trying to decide where to go from here.

At the very least, I’m going to power it down, open it up again, and take a close look at power supply voltages and ripple.

When I power it up again, I’ll keep an eye out for a recurrence of any of the bad behavior I observed. If so, it will suggest that some of the problems are the result of bad solder joints that act up when the unit is coming to a new thermal equilibrium.

Beyond that, i’ll do some logging over the GPIB interface to get a better sense of stability and tempco. I also need to investigate the resistance and ACV functions.

After that, I’ll have to consider whether to get it calibrated, or figure out a way to calibrate it myself. I’d also like to investigate its ability to use an external voltage reference to provide high-precision comparisons between different voltage standards. Doing so will require either figuring out a source of the (likely expensive) low-thermal-EMF rear panel connectors, or replacing them with similar performance and lower cost.

I’m also still looking for a Datron 1081/1082 Users Handbook (the 1082 is basically a 1081 with all the options). The Datron 1051/1061/1071 users handbook has been useful, because for the most part, they operate very similarly to the 1081, but there are some important differences with the digital filter, and some of the other aspects.

AVR Transistor Kit and Case Mod

I ordered an AVR Transistor/component tester kit from Bangood. At the beginning of the year I bought AVR transistor tester by Fish8840 off of eBay and found it a bit lacking. This kit is better. It uses the 1.12k version of the open source firmware, and includes a rotary encoder for easier access to the advanced features. I also opted for the case.

The kit makes use of through-hole components for easy home assembly. It includes an external 8MHz crystal, a voltage regulator, and uses narrow 1% and 0.1% tolerance resistors in critical positions for highest accuracy.

The case is designed to use a ceramic socket (provided) for connecting components, and also provides two banana jacks to allow test leads for testing larger components. People have complained that the provided socket is hard to use and doesn’t make good contact, and I wanted all three test connections available via leads, so I decided to modify the case.

My modification is inspired by some of the fully assembled versions of the tester I’ve seen on ebay. I cut a piece of plastic and glued it over the existing holes for the socket and banana jacks on the case and drilled three holes for 2mm banana jacks I ordered on eBay. Then, I cut a piece of protoboard and drilled three holes for some 2mm  banana plugs, which I screwed into the board. Then I soldered in the ZIF socket and connected up the leads to the plugs.

I haven’t tried building the latest firmware from source for this, but my understanding is that “mega328_st7565_kit” is the proper version to build.

Power Designs TP340a Knob Upgrade

My Power Designs TP340a bench power supply has a look and feel of quality stemming from its industrial design roots in the 1960s. Unfortunately, my supply was built in the mid-1990s and the design was compromised by the use of plastic knobs for the voltage controls on each of the three independent power sources.

TP340a with "original" plastic knobs.

TP340a with “original” plastic knobs.

Since getting the supply up and running, I’ve been on the look out for some suitable replacement knobs. Other/earlier models of these Power Designs power supplies appear to have used knurled aluminum knobs supplied by Kilo International. Kilo sells similar knobs to this day, but they apparently long-ago discontinued the model Power Designs used (which is probably the reason for the substitution in the first place).

In the current lineup, Kilo has two lines that might serve as suitable substitutes. The JD series has the right overall profile, with a flat top rounding into a straight side, but it lacks the flared skirt of the originals. The DDS series has the skirt, but the rest of the profile isn’t right, with a flat top dropping to a flat side that then flares slightly for the knurling.

I suspect that the original knobs were a skirted variant of the JD series, probably called JDS. I scoured eBay for old stock or used knobs, without luck, but I did find a seller with used knobs of similar design. In fact, they look like knobs that Power Designs used on a number of supplies made in the late 60’s or early 70’s. The price wasn’t bad either, 5 knobs for about $17, shipped.

They still weren’t quite right though. The fact that the design wasn’t an exact match wasn’t the issue. Rather, I was concerned that they were a little wider than the original knobs, and  that their proportions would seem off (I lack the skill to create a nice, well proportioned design, but I can tell when things are off). Because of this, I dithered on ordering them, but after seeing his stock decline, I finally pulled the trigger.

IMG_8866

The knobs were in pretty good condition, other than being a bit gunked up. I gave them a washing and scrubbed them gently with some Barkeepers Friend (a mildly abrasive cleaner for glassware and stainless steel) before replacing the existing knobs.

IMG_8859

I think my concern about proportions were warranted. The I think the knobs give the supply a bit of a big-nosed look. Still, I think they look better than the plastic knobs that it had before, and the definitely feel better to use.

IMG_8861

The seller also offered some knobs with the same design but a smaller diameter. I would have purchased them instead, but for the fact that they were drilled for small diameter potentiometer shaft. I considered getting them and drilling them out, but I don’t really have the right tools and so I figured it would be a frustrating project that I could do without right now.

Big LED Clock Kit

A couple of months ago I was browsing Banggood and came across a stupid little clock kit that I felt drawn to for some reason. I suppressed the urge, but not before seeing if I could get the kit for cheaper on eBay (I couldn’t).

About a month ago, I was looking at Banggood again, and this time I gave into temptation and ordered the kit and it finally arrived, by way of Sweden!! a week or so ago and I assembled it yesterday.
IMG_8865

I’m still not sure why I was so attracted to the kit, even now that I have it assembled and working on my desk, but I have an idea. I think a big part of the appeal is the minimalism of the device. From the front, all you see is the inch high LED digits. The circuitry is all on a board hidden behind the LED modules. The optional clear acrylic case is similarly minimal. It’s just six pieces of clear acrylic, with tabs and notches cut to interlock, holes for the six screws and slots for the six nuts that fasten it all together.

IMG_8869

Features:

  • 1″ white digits (other colors available)
  • Clock (24hr/military time only, so far as I can tell)
  • Temperature, Centigrade only, alternates with time display
  • Alarm
  • 5v power with cord for powering from a USB connector
  • Battery backup for the clock.

The kit comes with all the thru-hole parts needed to assemble the clock and 8.5×11″ sheet of paper with the instructions printed on one side. The instructions are probably enough to build and operate the clock given some basic familiarity with assembling electronics, which is not to say that they couldn’t be better.

Assembly

Assembling the kit is quite simple. There are about two dozen resistors of three different types to be added to the board, along with a with a diode. After placing and soldering these low-profile components, I added the six provided solid capacitors and the crystal, then the two IC sockets, six transistors, pezio buzzer, electrolytic capacitor, power socket, switches, and a surface mounted coin-cell holder.

The transistors proved just slightly tricky, because the provided transistors are in a TO-92 package, while the PCB is layed out for something with a wider lead spacing like a TO-126. The solution is simple, bend the leads to fit, but it’s a bit fussy.

IMG_8872

Before finishing soldering the components, I partially assembled the case so I could check the distance between the back of the board and the notch cut in the case to provide direct exposure to the thermistor. Photos of the assembled clock on Bangood show the thermistor sticking out high above the case, which strikes me as ridiculous and unnecessary. I decided that ~1cm off lead between the board and the component was enough to position it in the cutout while remaining protected by the case. I bent the leads to be parallel to each other and perpendicular to the axis of the thermistor package, then 1-2mm from that bend, I bent both leads at another right angle, so the leads remained parallel in the same plane, and the thermistor was a elevated slightly above it. I then soldered the thermistor to the board so there was about 7mm from the PCB. I did something similar for the photoresistor, so it could face upward. I bent the leads a couple mm away from the package, and then soldered the leads so they protruded about 5mm from the board.

Once the components were all soldered, and the leads trimmed, I checked over the board and fixed a number of dodgy solder joints before adding the four 7-segment LED modules on the opposite side of the PCB.

The third digit brought unexpected difficulty. It is supposed to be rotated, so that the dot that usually sits at the lower right to serve as a decimal point, will instead sit at the top left, to serve as the top dot of a colon separating hours from minutes formed with analogous dot at the bottom of the previous digit. This rotation presented a problem, because the leads at the top and bottom edge of the LED packages are offset, rather than centered, and the PCB wasn’t laid-out to account for this. All the leads had to be bent to accommodate. Again, a relatively simple task, but fussy in practice, because of the need to maintain the spacing between the 5 leads on each side so they will slip into the holes on the PCB.

Troubleshooting

At this point, I fit the ICs to their sockets, powered up the clock, and found that it worked. Or should I say, mostly worked? The left-most digit didn’t light up. I tried resetting the device as described in the instructions, but it still didn’t work. I checked all the solder joints for the LED module, and they seemed Ok, but I touched some of them up with another pass of the soldering iron. I also consulted the schematic to figure which transistor is responsible for strobing the power to the module and checked/touched-up its leads. The first digit still wasn’t lighting up. It was time for bed.

After a good nights sleep, and breakfast out with friends, I returned to troubleshooting the clock. I spent 15 minutes or so using the continuity function on one of my multimeters to trace out part of the circuit and better associate the schematic with the actual layout of the PCB. In particular, I was interested in the portion of the circuit responsible for powering the problem LED module. I figured out the center pin on either side of the module provided +5v, and that there seemed to be good continuity between that and the collector lead of the controlling transistor (Q1). I also found that there was proper continuity from the base of the transistor to the associated resistor, and that the other end of the resistor was, indeed, connected back to an output pin on the microcontroller. Finally, the emitter was properly connected to the 5v supply.

Since everything seemed to be connected properly, I needed to look elsewhere to figure out why the clock wasn’t functioning properly. I thought, perhaps, one of the components was defective. Rather than going to the trouble of testing them individually, either in or out of circuit, I decided to power up the device again, and use an oscilloscope to inspect the signals at various points in the circuit, and compare them against the signals at analogous points for the other functioning digits. This would help me pinpoint the component in need of attention.

That was the idea, anyway. Once I powered the clock up again, the problem digit lit up. I’m not sure what happened. Perhaps my probing and shifted a faulty solder joint back into contact? I tried pushing on a few spots, to see if I could reproduce the problem, but nothing happened. In the end, I decided I had better problems to solve than chasing down an intermittent fault in a $12 clock kit, mounted it in the case, and called the project done.

Other Details

 

The PCB has some unpopulated areas. The documentation doesn’t say much about them, other than that they are “DIY” areas and no components should be installed. The schematic casts some light on what they are for. There are some headers for in-circuit-programming, and another which, I think, may be for resetting the MCU. There is also space for a relay, and an accompanying space for a connector/header for attaching the switched load. Given the design and clearances on the PCB, and the width of the associated traces, I’d guess that it is only suitable for switching low voltages at modest currents (~1A, tops). The firmware also seems to support this relay by allowing you to set an our to turn it on, and and hour to turn it off.

For what it is worth, the device uses a pre-programmed STC15F20EA_28 microcontroller in a DIP package. This MCU comes from STC Micro, in China. It has an implementation of the 80C51 CPU, along with 4K of flash, 256 bytes of SRAM, an 8-channel, 10-bit AD converter and 1K of EEPROM. This chip isn’t particularly hobbyist friendly, other than being inexpensive. Someone did create software for programming these chips called ‘stcdude.’ It is analogous to ‘avrdude’ used for programming Atmel avr microcontrollers. You’ll also need a compiler like SDCC (small device C compiler). That, and experience doing embedded development without much handholding. This isn’t an Arduino, nor is it Arduino compatible.

The MCU is complimented by a DS1302 clock chip (or something that functions like one), which stores the alarm settings, and keeps time on battery power when the external power isn’t connected.

IMG_8871

I measured the power consumption using a USB meter, and it read 0.01-0.02a, or 10-20mA. In theory, you could probably run it for ~4 days off of a modest single-cell USB powerbank. In practice though, it probably doesn’t draw enough current to keep most USB power banks switched on.

Conclusion

IMG_8870

I’ll give this kit a solid B overall. The kit and instructions are a B- because of the layout problems I mentioned above. The finished product is a B to a B+. It think it is attractive, and useful, but as an American, the fact that it only displays time in 24-hour mode and temperature in Centigrade undermines its utility somewhat.

I should also say that while the temperature seems accurate to within a degree or so, I have no idea how well it will keep time.

EDC 521 Voltage Source Stability and Accuracy

IMG_8647

Last week, I cleaned up the used EDC 521 DC Voltage & Current Source I bought on eBay and ran it through some quick tests. The next day, I connected it up to one of my Keithley 2700 6.5 digit multimeters, started logging readings, and powered it up. Since then, I’ve been collecting voltage readings every 5 seconds so I could get a better sense of the device’s stability and accuracy.

The EDC 521 was set to 10.00000v and powered on.

to4hr

Once the self-tests ran the output turned on. The initial voltage was only 9.99954v, but climbed quickly. After 15 minutes, it was up to 9.99981v and still rising gradually. At the end of the specified two hour warm-up period, it was 9.99986v, well within the specified tolerance of 0.000258v (0.002% of setting + 0.0005% of range + 3uV), as well as the DMMs uncertainty of 0.000350v 30ppm of reading + 5ppm of range.

2to8hr

After the initial warm-up, the voltage continued rising for another 5 hours, before leveling out at about 9.99989v.

From2hr

The graph above shows the voltage over ~4 days following the two hour warm-up period. If we look at the stability once the voltage first leveled out ~7 hours after turn-on, we see that it lies between 9.99990v and 9.99994v, which works out to be about 4 parts per million (ppm), which is better than the specified 7.5ppm 8-hour stability and the 10ppm 24 hour stability for the source and ~14ppm 24-hour stability of the DMM.

I’d guess that some of the variation is due to temperature changes. The EDC 521 specifies a temperature coefficient of +- 5ppm/C°, and the DMM has a temperature coefficient of about 2ppm. Unfortunately, I didn’t start collecting temperature readings until yesterday afternoon. Once have accumulated a few days worth of readings, I’ll look at the relationship between temperature than the voltage reading.

last3hr-bounds

The last thing I did was look at short term variation in readings. The graph above looks at a 4 hour period earlier today. The blue line is a moving average of 10 minutes of readings (~120 readings), the dark green shows the standard deviation in readings over the same window, and the light green bounds the average of the minimum and maximum readings over the same period.

It shows that the difference between minimum and maximum readings are ~6uV, which is  less than 1ppm. The DMM is only a 6.5 digit DMM, which means that the smallest reading on the 10v range is 10uV. When readings are taken using the GPIB or RS-232 interfaces, it does report an extra digit, which is useful for statistical purposes. In this case, I think its safe to say that the short term variation in readings is probably mostly down to the DMMs noise floor.

After looking over this data, my conclusion is that I got what I was hoping to get, a stable and accurate precision voltage source. Next step is to test the GPIB interface and use it to collect data across every available setting and range to check for linearity/accuracy and decide whether any adjustments are needed.

Keithley 2000 & 2700 Data Logging in Python

ReadDMMs.py

This is a simple, braindead, python script to get measurements from a Keithley 2000 & 2700 DMMs using VXI-11 and store them in a simple timestamped SQLlite database.

It’s not a general tool, but it should be easy enough to tweak it to dump to a text file, take different measurements, use different ranges, different intervals, different communications transports.

It doesn’t have enough error checking, and bug fixing, but it mostly works well enough. It recovers from (some) malformed readings. It doesn’t recover from other errors (mostly communication related)

Requirements

  • OS X or Linux
    • It may work with Windows, but I haven’t tested it.
  • Python 2.7.x 
    • It may work with others, I haven’t tested it.
  • python-vxi11

How to use

The script takes voltage readings at ~10s intervals, on the 100v range, and stores them in a SQLlite3 DB called readings.sqlite3 in the current working directory. If you want different behavior, look through the source code and make the necessary changes.

You MUST edit the file to configure the name of your VXI-11 gateway and GPIB address(s) of the devices you want to poll.

Finally, run the script, ie:

python ReadDMMs.py

Tips

Since this script doesn’t do much error checking, it occasionally dies. In my experience, when it dies, it is because of a communcations timeout. In such situations, restarting the script is often enough for hours more logging.

I usually run it in a shell loop, so it restart automatically after a delay:

while true; do python ReadDMMs.py; sleep 150; done

If you modify this script to communicate with your Keithley 2000 DMM over RS-232 serial, be aware that a problems with hardware/firmware before ~2007 can result in frequent communication failures.

The simple workaround is to modify the RS-232 cable, or the DMM’s own RS-232 port, to ensure that the RTS pin (#7) is not connected.

Continue reading