Thursday, January 30, 2014

10dB: a factor of 10 in Watt? Power or Amplitude?

Is it 10 or 20 dB that corresponds to a factor of 10 ... ?

In power or in amplitude ... ?

These are common head-scratchers that a physicist might have when faced with dBs (they come up every 5 years or so).  Okay, let's figure this out so that in 5 years I can come back to this place and read up on it.

Let's start with what we know.  Calculating dBs goes like this:

dB = # log(ratio)

The log is in base 10.  The ratio is either one of amplitudes or powers.  And there is a pre-factor # that is either 10 or 20, but we can never remember.

To figure this out, let's realize that the number of dBs (say 10 dB) must always describe the same thing about a signal, whether we were measuring in power or amplitude.  A signal that changes 10 times in power will change sqrt(10) times in amplitude.  So, what are the prefactors?

dB(power) = dB(amplitude)

#power log(10) = #amplitude log(sqrt(10))

#power = #amplitude * 1/2

So #power must be the one equal to 10, and #amplitude must be the one equal to 20.

dB = 10 log(power ratio)
dB = 20 log(amplitude ratio)


20 dB is a factor of 10 in amplitude
10 dB is a factor of 10 in power


6 dB is a factor of ~2 in amplitude
3 dB is a factor of ~2 in power


Tuesday, November 19, 2013

Etching your own printed circuit boards

Today's topic is printing and etching your own circuit boards!

I have found Pulsar's toner transfer paper to be quite easy to use and make good quality circuit boards in very little time.  However, when I first started using this technique, I found it quite difficult to obtain good results (toner didn't transfer well, traces were broken...) - after some fussing around, I figured out all the little tricks and ended up with a good method.  It's documented in the following:  

Hope this helps your home-grown electronics making!

Wednesday, March 6, 2013

What's the PRL pipeline looking like?

So I hear you are anxious to read this upcoming article in PRL.

Minimum threshold for incipient plasticity in the atomic-scale nanoindentation of Au(111)

The formation of the smallest permanent indentation in a Au(111) surface is studied by scanning tunneling microscopy and atomic force microscopy in ultrahigh vacuum. The 9.5 nm radius W(111) indenter was characterized in situ by field ion microscopy. Elastic and plastic indentations are identified both in the residual impression image and by features in their force-displacement curves such as the sink-in depth, popins, and hysteresis energy. Plasticity is best identified quantitatively in the force-displacement curves by the sink-in depth. The minimum of plastic damage producible in the substrate is associated with an energy budget of ~70 eV.
Aren't we all.

The mean waiting time of accepted papers waiting for publication in Phys Rev Lett is 22.8 days, excluding one outlier they've been dragging around since 2011.

In other news, the PhD thesis will be done shortly, so I can return to tell you all about things like fixing coffee grinder switches, building sous-vide rigs, brewing ciders, etc.  AKA WP's return to the land of the living.

Monday, November 26, 2012

Safety Interlock Circuit for Vacuum Systems

Working in ultra-high vacuum (UHV) is a pain in the ass.  The idea is that by achieving such a high-quality vacuum (having something like twenty thousand billion times less gas atoms per unit volume flying around than in air), we can perform atomically well-defined experiments without all the airborne junk and hopefully learn something about physics at the atomic and molecular scale.

Ultra high vacuum system, named Dolores, on the left.  Me on the right.  We often fight.

But when things go wrong, there is a lot of down-time.  This post aims to share a simple electronic circuit that can help to relieve some of the pains associated with equipment failure.

Turbomolecular pump innards, from  US Patent EP0522603A1
A common type of pump used to achieve UHV is the turbomolecular pump, which looks very similar to an aircraft jet engine.  Its rotor turns really really fast (~1000Hz - yes, revolutions per second!) in order to transfer momentum to the gas particles in vacuum such that they are propelled toward its exit.  The turbo pump must itself be connected to a vacuum pump (known as a roughing pump, or forevacuum pump).  This ensures that the pressure throughout the turbo pump is sufficiently low to reduce viscous drag on the rotors.

Unfortunately, if something bad happens to the roughing pump, like it overheats, seizes, leaks oil, etc. the turbo pump might get damaged.  And in the case of an expensive magnetically levitated bearing pump, it might cost 8 weeks of research time and $25000 to replace.  Problems associated with roughing pumps have occurred twice in our lab in the last decade and have necessitated a turbo pump replacement.

Naturally, it would be nice to avoid such incidents in the future.  This is why I put together a simple, robust analog circuit to monitor the forevacuum pressure and shut down the turbo pump and close the vacuum valves if the pressure goes bad.  It only costs $50 to build, and I think I wrote a nice pedagogically rigorous report on "how to do it" so that you can learn something about electronics, and build it step-by-step.  Unfortunately, the Review of Scientific Instruments or Journal of Vacuum Science and Technology A won't even publish it as a "shop note" (yeah ok, I understand it's not "novel science", but it's useful!).

So, after a double editor rejection, I am unleashing it upon the internet.  Because somewhere, there is another poor suffering grad student working on a complex UHV system who might want to put together something like this as an investment toward their supervisor's wallet's well-being, their expedited graduation (freedom!), and their mental health.

Oh and by the way, it saved my ass when this happened:

KF flange that broke in the forevacuum line overnight, totally randomly.  Interlock to the rescue.

You'll find a very detailed description of the electronic circuit below, and more stuff including a parts list, below that.

We describe the design and operation of a simple analog circuit which can be implemented in various applications where a process should be shut off if a threshold value of an analog signal is reached. The threshold value, hysteresis, and trigger direction can be easily set. Judicious analog design ensures reliable operation, and versatile functionality is built in without the need for programmable microcontrollers. A PCB layout is provided along with a component list for quick assembly. We use the circuit in our lab to monitor forevacuum pressure to protect turbomolecular pumps and UHV pressure during sample annealing.

Safe interlocking of a UHV system is desirable to avoid damage from inevitable disruptions coming from equipment failure or power outages [1,2].  In the operation of our surface science UHV system, we have come across situations when it would be desirable to abort a processes automatically based on UHV or forevacuum pressure.

In this shop note, we discuss a circuit that was recently designed and implemented to monitor the pressure of a forevacuum line using the common analog output of a pressure gauge.  It protects a sensitive magnetic bearing turbomolecular pump against a possible rotary vane roughing pump failure (which has proved to be problematic twice in the last decade of operation, once causing several thousand dollars of damage).  If the forevacuum line pressure exceeds 1.5x10-2 mbar, the circuit described here is used to close the UHV and forevacuum valves around the pump, and the pump is stopped.  We also use this circuit to monitor the UHV pressure in our preparation chamber so that sample annealing is stopped if the pressure exceeds 6x10-8 Torr.  This allows us to run a filament overnight without worrying about vacuum malfunction.

The circuit is designed to close a relay during “normal” operation so that current can flow to the device or filament.  If the control signal passes a trigger value, the relay will open and halt the current flow.  The circuit can be configured for “normal” operation when the input voltage is lower than a trigger (normal low configuration), or higher (normal high configuration) than a trigger.  The trigger value is easily set by a potentiometer.  One resistor modifies the hysteresis trigger value for the return of the control signal to its normal state.  The circuit can also be configured for single-shot mode so that the relay will not close again until the user activates a “set” switch.  A bypass switch is provided to keep the relay closed regardless of the control signal value.  In addition, if the input signal is unplugged, the relay will open after a time delay.  This functionally simple, computer-less, analog solution is reliable, robust, and easy to construct.
The implementation of the aforementioned features will be described in detail with additional information in supplementary material (following this text).  In the following description of its design, we refer to the sections of the circuit that are labeled and circled by dashed lines in Figure 1.

Figure 1: Circuit diagram of the interlock circuit.  Circled sections are described individually in detail in the text.
In section A, the combination of R­IN and CIN assume the function of a low-pass filter for the control signal with corner frequency fIN = 1/(2πRINCIN) (assuming RIN << RDIS).  RDIS is a resistor used to disable the output by pulling the input in the opposite direction to the “normal” state in case the control signal is unplugged.  The disable function occurs after a characteristic time τIN = RDISCIN (the exact time also depends on the threshold level being used).  We use RIN = 100kΩ, CIN = 1µF, and RDIS = 100MΩ for a filter frequency of ~1.6 Hz and automatic disable time of ~100s.

The bypass switch, SWBYP, is implemented in section B with a DPDT switch used to impose a “normal” state regardless of the input voltage.  The other pole of the switch is used to turn on a LED to indicate the status of the bypass (RLED = 2.49kΩ for a current of ~4mA, assuming a 2V diode drop).

Section C contains the trigger setting potentiometer, VRT, and a hysteresis resistor RH.  The hysteresis means that the trigger voltage seen by the comparator changes based on the state of the output.  If R1 is the resistance between the potentiometer wiper and ground, and R2 is the resistance between the wiper and the +12V rail, then the upper and lower thresholds are given by Vupper = 12V·R1/(R1+R2||RH), and Vlower = 12V·R1||RH/(R1||RH+R2), where || denotes the parallel combined resistance.  For a 100kΩ potentiometer centered at R1 = R2 = 50kΩ, a hysteresis resistor of RH = 220kΩ, the upper and lower thresholds are ~6.6V and ~5.4V.  Test points TP1 and TP2 allow for easy testing of these thresholds using a multimeter.  This is described later.

In section D, a 2N3906 transistor (Q1) is driven by the output of the LM311 comparator (U1) through ROUT = 10k which powers a relay, RY1.  A 1N4004 flyback diode D1 protects against the back EMF generated when switching off the relay coil.  RY1 is used for the single-shot configuration.  If single-shot operation is not needed, RY1 can be omitted, and the point indicated by a star in section D should be connected by a wire to the corresponding star point in section E.

The output relay, RY2 is located in section E.  If the relay is energized, LED2 is illuminated (current limited by RLED2 = 2.5kΩ).  In the case that single-shot mode is not needed, the set switch, SWSET, can be eliminated.  The board mounted relay can switch a device (up to 8A) soldered directly to the pins labeled DEV in Figure 2(a).  If a higher current is needed, an off-board relay coil can be attached to the auxiliary outputs labeled RY2 in Figure 2(a).
Figure 2: Printed circuit board layout (actual dimensions: 36x122mm). (a) Copper traces shown in black with component overlay (normal low configuration shown); (b) assembled circuit board (normal high configuration shown)
Sections F1 and F2 set the normal high or normal low configuration of the board.  If “normal” operation should occur with a signal lower than the threshold, the circuit should be wired as per the normal low configuration shown in Figure 1, making the following connections: a-d, b-c, e-g, and f-h.  These correspond to the blue and red dashed connections in Figure 2(a), labeled a through h.  If normal high is needed, the connections should be made as: a-c, b-d, e-h, and f-g, which is shown in Figure 2(b).  These connections switch the direction in which the disable and bypass features work, as well as the order of the inputs to the comparator.  We use a normal low configuration for our forevacuum pressure monitors with a Balzers TPG300, and a normal high configuration for our UHV pressure monitor with a Lesker IG4400.

Power supply smoothing capacitors C­­1 = 22µF, and C2 = 0.1µF are included in section G.

We produced the single-sided circuit board shown in Figure 2(a) in our lab using Pulsar Toner Transfer Paper.

At the time of assembly, the circuit must be configured for  normal high or normal low operation.  If it is not being configured for single shot operation, the points marked by a star need to be connected by a wire and the optional components listed in the parts list (following this text) can be omitted.

The threshold should be set in the following way: 
  • Connect a multimeter to the test points labeled TP0 (common) and TP1 (threshold voltage). 
  • Connect a wire to the +in terminal block. 
  • Apply DC power to the circuit
  • By touching the +in wire to 0V or 12V (the screws on the power terminal block are ideal for this), the state of the relay will switch, and the multimeter will read the threshold voltages.
  • Adjust the potentiometer and RH value (we mount RH on IC pins for easy replacement) until the desired thresholds are achieved.
In summary, this simple, versatile interlock circuit is easy to build and configure for a variety of applications.  It has improved the safety and robustness of our existing UHV system, and has reduced the risks involved with roughing pump failure and unattended sample annealing.

[1] J. P. Saint-Germain, G. Abel, and B. L. Stansfield, J. Vac. Sci. Tech. A 4, 2391 (1986).
[2] J. A. Polta and P. A. Thiel, J. Vac. Sci. Tech. A 5, 386 (1987).


Standalone unit

We have integrated two of these circuit boards into a larger rack-mounted interlock panel to add pressure monitoring functionality. Another board was assembled as a standalone unit, shown below, for annealing samples. All the parts, except wires and mounting screws, are specified in the parts list.

Parts List

The following table summarizes the parts used in the interlock circuit, along with their corresponding Digikey Part # and the cost of the part in Canadian dollars at the time of writing.

The parts indicated as optional are those that are used for the single shot operation and can be omitted if un-needed.

Digikey Part #
Input Resistor
100k resistor
Input Capacitor
1uF, 63VDC, film capacitor
Disable Resistor
100M resistor
Bypass Switch
On-On DPDT switch
Bypass enable LED
Orange 3mm LED
LED current limiting resistor
2.49k resistor
Threshold potentiometer
100k trimmer potentiometer
Hysteresis resistor
220k resistor
LM311 comparator 8DIP package
Comparator output resistor
10k resistor
Relay driving transistor
Flyback diode (optional)
Set switch relay (optional)
SPDT 12V relay
Set Switch (optional)
On-Mom DPDT switch
Relay indicator LED
Green 3mm LED
LED current limiting resistor
2.49k resistor
Flyback diode (optional)
Main relay
8A DPDT relay for main connection
Power Supply Capacitor
22 uF, 50V, radial, aluminum capacitor
Power Supply Capacitor
0.1uF, 100VDC, film capacitor

Terminal blocks (x7)
2 position 3.5mm terminal block

Device connector
Panel mount banana jack

Device connector
Panel mount banana jack

Power connector
2.1mm ID, 5.5mm OD barrel connector

BNC input
Isolated BNC

Translucent Polycarbonate Enclosure 150x80x50mm

Power supply
12V, 0.5A, switching DC power supply

PCB Layout

The PCB layout and component layout is shown below.  A PDF of the design in actual size is available here. The PDF has 10 layouts on it so you can make a large toner-transfer page full of them!!!

Wednesday, November 21, 2012

Resurrection of a Bose SoundDock iPod dock

I'd like to begin this blog by sharing something both useful and nerdy. Something about music and science and perhaps environmentally conscious at the same time...

Well, I was given a broken Bose SoundDock a while back.  It went "shhhhhhhhhhhhhhhhhhhhhhhhh"-(silence) when turned on.  The "sh" noise lasted only a few seconds.  No music, no sound once it fell silent.  Given the option to fix it and keep it or throw it away, I figured it might be worth fixing this beast (priced at ~$230, but worth nothing as delivered).

In this first post, I'll tell you about how I turned this trash into treasure.


Incidentally, while I was reading the label to figure out what this Bose product was officially named, I couldn't help noticing U.S. PAT. NOS 7,277,765 and D514090 on the bottom.  Thanks to Google's great Patent Search, I could have a good laugh at the bullshit contained in these documents.

The second one, "Sounds system for portable music player," is a design patent and makes just a brief claim:

The ornamental design for a sound system for portable music player, substantially as shown and described.

It contains several figures which I suppose secure Bose's design IP, including FIG. 1 shown above.  Such short claims do not seem unusual for design patents, such as those for this popular beverage maker, hideous but somehow unique grand piano designs 1 and 2 (good one Zeiser, Mr. Von Rohl will be really upset he didn't think of that!), and the curved body of cheese made of offset slices of cheese... yeah.

The first patent "Interactive sound reproducing" contains a little more content.  Its abstract describes something about an audio system that attaches to a computer...

An audio system attachable to a computer includes a sound reproduction device for producing audible sound from audio signals. The sound reproduction device includes a radio tuner and a powered speaker. The audio system further includes a connector for connecting the sound reproduction device with a computer. The computer provides audio signals from a plurality of sources, the sources including a computer CD player, digitally encoded computer files stored on the computer, and a computer network connected to the computer. The sound reproduction device further includes control buttons for controlling at least one of the computer CD player, the digitally encoded computer files and the computer network.
Let's see if this makes sense with what I know about the SoundDock:
  • "attachable to a computer" > you can stick your iPod onto its connector, I guess.
  • "producing audible sound" > not anymore!
  • "includes a radio tuner" > not that I'm capable of finding.  You?
  • "powered speaker" > check.
  • "connector" > iPod connector, yes.
  • "audio signals from a plurality of sources" > yes but not the CD source (thanks for killing the CD, Apple).
  • "control buttons for controlling at least one of the computer..." > it seems to me like there are only volume buttons.
Well, those patent claims are dubious... but so is the functionality of their product!  Ok ok, on with fixing it...


The first step when trying to fix electronics is to open them up and check for things that look broken.  Pretty obvious, but you should be aware of this: electronics run on smoke -- they will continue to operate normally until they have released all of their smoke.

The telltale signs of smoke leakage were obvious on the main board in the bottom of the unit:

The affected IC was made by International Rectifier and probably does some power reg function or other.  At any rate, the part number was totally burned off and rendered unreadable.

My guess was that the big computer-y looking chip with the bajillion pins on it did something smart and complicated and that I would have very little hope of fixing this board.  This computer-y chip probably talked to the iPod and allowed the control of its volume output or something relatively useless with regard to basic audio amplification functionality.  I thought that somewhere deep down in this SoundDock, there would have to be some simple amplifier whose workings I could understand and whose analog input I could just highjack.

Pulling off the front screen and unscrewing the heat-sink panel that lies between the two speakers, I found the board with the power amplifier on it.

The amplifier is a Philips TDA8922 2x 25W Class D power amplifier.  (Class D amplifiers achieve high efficiency using a neat pulse width modulation scheme)

Consulting the Data Sheet for the TDA8922, I noticed that pin 6 was a "MODE" pin used to select standby, mute or operating modes.  This is a common feature in Class D integrated circuit amplifiers since it allows them to be turned on/off by some control voltage to save on standby power.  I looked for the existence of a "MODE" pin because the "shhhhhhhhhhhhhh"-(silence) behaviour tipped me off: the power amplifier was clearly not broken (it made a "shhhh" sound), but something might be turning it off -- perhaps the smokey computer-y circuit discussed above.

Holding an oscilloscope to pin 6 showed that the voltage was around 5V while "shhhhh" came out, and then it dropped to 0V.  The MODE pin controls three regimes of operation:
  • Standby 0V - 0.8 V 
  • Mute 2.2 - 3 V
  • On 4.2 - 5.5 V (maximum voltage tolerated by MODE pin = 5.5V)
The strategy I had in mind for fixing the SoundDock by this point in the diagnosis was
  1. Remove the connection to MODE pin 6 and allow it to be controlled manually by a switch (i.e. force the amplifier into the operating mode)
  2. Figure out where the analog (music) voltages are in the circuit board and make them accessible by a connector.

Fixing it!

Mode Pin

I checked if forcing the MODE pin to be "on" helped by constructing this voltage divider to provide 4.9 V to pin 6.

The input impedance of pin 6 seems to be on the order of 5.5 kOhm = 5.5 V (max input voltage) / 1 mA (max input current).  The Thévenin Equivalent resistance of the above circuit is 0.36 kOhm (if I calculated it properly), so it should be able to supply enough juice to drive pin 6.

Here's what the resistor divider test apparatus looked like.

The red wire connects to pin 6 (the leg of pin 6 was ripped up with the help of a soldering iron and some tweezers so as to be disconnected from the original printed circuit board signal).  The resistors connect to +18 and 0V pads that I happened to find nearby (see description of J601 later on).

With the resistor divider in place to force the amplifier to be "on", I touched audio input pins 4/5 and 8/9 with some tweezers -- sure enough the amplifier clicked and buzzed, so it worked.

Finally, I transplanted this resistor divider near the power entry on the main board and took the red wire 4.9 V output and connected it via a switch (shown later on) to pin 6.  (if you want details on how to do this, let me know and I'll take it apart again and take extra photos... I'd feel honoured if you were interested in it)

Audio connection

The Philips TDA8922 has analog inputs on pins 4/5 (+/- in) and 8/9.  5 and 9 seem to be referenced to the circuit ground, so effectively, we are looking at connecting audio signal to pins 4 and 8.

These audio signals travel from the main board (with the fried chip) to the power amp board (seemingly working) through a flexible flat cable.  The connector on the main board is J601, for which I have mapped out the following connections:

After identifying locations on the main board corresponding to the L audioR audio, and ground signals shown above, I soldered some wires to them in order to inject some audio from a 3.5 mm headphone jack to be added to the front panel.  Here, blue = LEFT, red = RIGHT, black = GROUND.  Note how I cut the printed circuit board traces for the original L and R signals coming from the computer-y chip... follow from the point at which the wires are soldered and move slightly to the right - the traces are cut using a sharp knife.

The Result

Here's a view from the bottom of the modified SoundDock:
On the left, you can see a switch which manually sends 4.9 V to the MODE pin of the Philips TDA8922 to put it in "on" mode.  This is useful so that the speaker system can be turned off when plugging/unplugging things from the audio input to avoid loud clicks.

On the right, I have installed a 3.5 mm headphone jack which brings the left, right, ground (BLUE, RED, BLACK wires) to the places you saw above to inject audio signals into the circuit board.

The front panel of the BOSE unit had just enough room under the base to accommodate the new switch and jack... almost like it was built for this in mind ...

Final Notes

It's been working perfectly well for the last 4 months.  It's worth noting that the original iPod docking connector still works for charging, but since I disconnected the audio connection from the computer-y chip, it can't play audio through that connector anymore.  Another issue is that there is no volume control - you must be able to set the volume on the device you're connecting to it (a minor hassle).

One could consider wiring up the analog L and R audio pins from the iPod connector to the same place I showed above for the 3.5 mm jack.  This would allow for full music playing functionality via the attached iPod / iPhone - but you'd still have to set the volume on the device itself.

So far, I've found the 3.5 mm jack to make this unit more useful than it was originally designed to be:  I can plug in a laptop or iPad or other analog audio source now!

In the future, I might venture into adding a volume control knob on the front panel.

For now, I hope this helps you save a few tons of COemissions by giving new life to that decent sounding but completely broken SoundDock you might have lying around.