Thursday, December 24, 2009

Merry Christmas and/or Happy Holidays

The robots and I wish you a Merry Christmas and/or Happy Holidays as applicable

Friday, December 18, 2009

Pyoony the mini robot


Ok, I admit that, lately, I've spent enough time building gadgets that are only peripherally related to robotics. Time to build another robot. This one is going to be scratch built from some reclaimed and repurposed hardware: a dual tape deck out of a dead all-in-one system (below, at top), motors from a broken linear tracking turntable (below, at bottom), and other goodies from a lifeless HP inkjet printer (not pictured).

The turntable mechanism features a pair of small motors that would be ideal for a differential drive robot. For wheels, paper rollers from the inkjet printer, driven by some combination of pulleys and gears from the tape deck. With two drive wheels I'll need at least one caster. The pinch roller mechanisms off the tape deck should do nicely. The recovered parts can be seen below.



So that's the start of the inspiration. Now, what the heck do I want this thing to do, how big should it be, how long should it run? Time to define the problem, that is, write down my requirements for the robot, in good systems engineering fashion.
  • Size: 3 cubic inches, maximum
  • Weight: light enough that the motors can drive it around on hard surfaces
  • Speed: no slower than 3 inches per second
  • Run time: 10 minutes or more
  • Behavior: this is a long story

I've had this ancient TAB book (#1241), How To Build You Own Self-Programming Robot, for 10 or 15 years and it was ancient when I got it. It was written in 1979! In short it presents a simple mechanism for a robot to learn how to react to external stimulus, primarily wall collisions. I'd kind of like to try out this scheme on Pyoony. Check out this website for a learning robot based on the book.

I am also interested in playing with the subsumption architecture. I can probably do both of these things if the robot is flexible enough. I'd also really love it if I could figure out a way for the robot to find its recharging station and recharge itself. Maybe that is asking too much.

In short I want the robot to sort of drive around in the living room on its own with some basic reflexes to guide it, and mostly keep it out of trouble. Sort of like a bug. Since we have four cats, I probably have no choice to but to figure out a way for it to survive feline aggression...

Thursday, December 17, 2009

Heathkit IO-12

As you can tell I haven't been up to much electronics tinkering lately. My efforts have all been focused on servicing old audio gear, like my friend's BIC 920 turntable, my TEAC A-7010 reel to reel deck, and so on. You think those are old?

They're youngsters compared to the Fisher 400 receiver and Knight KG-250 amplifiers I recently acquired and plan to refurbish. They use vacuum tubes (aka valves).

Before I dig into those beasties I want to practice on this old Heathkit IO-12 oscilloscope. Yeah, it uses tubes, too. It's simpler, more room to work inside, and so forth.

Part of the refurbish work involves replacing very old capacitors to avoid shorts, opens, and out-of-spec havoc.


To find bad capacitors, I could use the ESR test harness I wrote about... I just have to build it first.

Friday, November 20, 2009

ESR Test Harness: Part 1


Because I recover electrolytic capacitors from junked electronics for hobby use, and because I restore vintage audio equipment with old electrolytics, I wanted a way to test these capacitors as they are known to have a short lifespan compared to other components.

Bad capacitors, if they aren't shorted outright, will show a high equivalent series resistance (ESR) so I wanted to measure ESR by building Stephen M. Powell's ESR test harness.

I figure this meter will save me money by letting me salvage caps and replacing only those that have started to go bad.

One can measure ESR of a capacitor by sending a small, high frequency square wave through it and looking at the wave form on an oscilloscope. Mr. Powell's circuit does just that, so I thought I'd share my build experience.

The Circuit

The circuit consists of two parts. On the left is the signal generator built around the good old 555 chip, designed to deliver a milli-Volt 100kHz square wave. It's design to be adjustable by way of the two variable resistors which control frequency and duty cycle as described on this handy 555 calculator webpage.
The right side is the test harness which simply drops the peak voltage seen by the capacitor and oscilloscope. The back to back diodes bleed off any DC charge on the capacitor to avoid overvoltage reaching the scope or 555 IC.


I prototyped a very simple version of the circuit on a breadboard and tested a few of my recovered capacitors (below middle). I did find a shorted capacitor (lower left), interestingly enough. I also saw the effect of a small capacitor integrating the square wave, resulting in a sawtooth wave (lower right).

Board Layout and Enclosure
Laying out the board without knowing where the board will be install is kind of a time waster. Eventually I may learn this lesson and, next time ...
  1. Rough out the layout enough to get a sense of the board dimensions,
  2. Select the battery source to add to the required enclosure dimensions, and
  3. Find an appropriate box that can fit the board and battery.
In my case I did most of the board layout, then selected a Hammond 1593P enclosure (the one I used for my Mini Function Generator project and pictured above right. Source: Hammond website).

The datasheet for the enclosure shows the board dimensions and mounting hole placement and with a little massaging the board layout was done.

From the function generator project, I learned to leave room inside the box for switches hanging down from the top of the case.

So I left a large section at the front of the enclosure unpopulated by components so I could mount the on/off toggle and an toggle to select testing of high or low ESR caps at the front top of the case. The BNC connector and the capacitor probes will exit the front panel of the box.

Then I thought it might be helpful to see if I could render the board in 3d and ran across Eagle 3d, an Eagle ULP script, which generates a POV-Ray file, pictured at the beginning of the article.

Installation was easy for both Eagle 3d as well as POV-Ray. To get the rendering to work I had to copy the include files (etc) out of the Eagle 3d's Eagle\ulp\Eagle3D\povray directory into the My Documents\POV-ray\v3.6\includes directory so POV-ray could properly include the files. It probably wouldn't hurt to copy the Eagle 3d ulp script into Eagle's ulp directory.

Rendering only took a few seconds even on this old 1GHz P4 machine.

Parts Purchase

Lately I've found it is a giant pain in the butt to buy components for these projects, especially the oddball ones. While I have a stash of most of the components required for this project, a few things need purchasing. I thought I'd play around with the Bill Of Materials script in Eagle. Simply run the bom.ulp script and follow the dialog prompts to save a txt file.

I imported this file into OpenOffice Calc using fixed width separation and added a left column to indicate the items I needed to buy: a couple of switches that will fit in the 17mm vertical space between the top of the board on the bottom of the enclosure, the enclosure itself, some power resistors, and probe wires (possibly also banana jacks if I use removable probe wires, and a trim potentiometer in a size I don't have.

Next: Part 2

Friday, October 23, 2009

Edward Isaac Bot: Sketchbook 5

The weird third eye thing on this alternate sketch of EIB is supposed to be a Polaroid sonar transducer. But much has changed in the last 15 years in the way of robotic rangefinders.

Pokey uses Sharp GPD12 infrared rangers (right) which provide surprisingly accurate results. They determine distance based on the angle of reflection. They're cheap, only $12 each, and they're small, maybe 1.5" x 1/2".

There is a whole family of IR rangefinders, each with a unique (but somewhat limited) distance range. The GPD12's 4"-30" range seemed ideal for measuring distances within the firefighting maze in which Pokey competed.

Modern sonar systems are significantly smaller and also inexpensive, about $30 for something like the Devantech SRF04 Ranger (right). The device is about 2" x 3/4" and includes the driver circuitry on the back of the board.

This particular model uses a separate transducer and receiver. However, you can also get single transducer/receiver models. This device can measure distances from 3cm to 3m!

Of course in the 1990's, tiny cameras with any kind of image processing fell into the realm of impossible or unaffordable.

The CMUcam2+ (left) is able to do high contrast color tracking, all in a 2.25" square package. How times have changed!

There are a number of sources for this gear. I got a sonar ranger from Radio Shack when they were having a sale. I got my Sharp rangers from Acroname (the source of the pictures and info above; no advertising affiliation with the company, I just like 'em).

Saturday, October 3, 2009

Slowing Down

I have a lot of irons in the fire and up to various stuff that I can squeeze in between the time when baby girl goes to sleep and when I do. Or occasionally during a lunch hour.

I'm in the midst of several electronics projects: IR repeater, oscilloscope calibrator, ESR test harness, ideas for a mini robot made of audio parts. You'll see posts on these in the ensuing weeks and months.

Meanwhile I've been fixing a vintage receiver with some help. I'm helping out someone in South Africa diagnose and repair an oscilloscope. And I've got a stack of non-functioning audio gear I want to work on, like an all-tube Fisher 400, a Yamaha CR-2020, and much more.

I've also got some prep work to do for hunting season, some work to do on the Jeep (both stories for my other blog). And my hobby fund needs to fatten up a bit...

So I need to slow the pace of posting here to give myself a break. Most likely you'll see articles every other week instead of weekly, at least for awhile.

Friday, September 25, 2009

IR Repeater: Part 1


Our Tivo, satellite receiver, and DVD player are on a shelf at the front of the living room, partially obscured by a sofa making it difficult to control them with remotes. I could go and buy an infrared (IR) remote extender (aka IR repeater), but what fun is that when I could build one? Plus, I want to use IR signaling for robotic communications so here's a perfect learning opportunity.

Requirements: The repeater will have to allow for very reliable control of these three devices, it should be aesthetically pleasing or at least unobtrusive, fairly small, and run for months off a pair of AA batteries.

How Infrared Remote Works

The oscilloscope trace at the right shows the digital signal from the remote. There are multiple coding schemes for remote control like pulse, space, and phase encoding.

Some systems represent binary data in long and short pulses, or pulse coding. Others represent binary data as long and short spaces between fixed length pulses, or space coding. Phase coding represents data by way of signal transitions. The beauty of this IR repeater is that it doesn't really care what coding scheme is used; it simply passes the signal along*.

To avoid interference with ambient light, IR remote controls modulate the light signal at somewhere in the vicinity of 38kHz. That way the receiver isn't fooled into thinking some random flash of light is coming from the remote.

So we need a way to detect pulsed 38kHz IR light and convert that into logic pulses then repeat the signal as pulses of 38kHz modulated infrared light. Detecting IR remote signals and converting them to logic signals is exactly what IR detection modules are for, like the Vishay TSOP32138. An astable multivibrator and an infrared LED handle the rebroadcast.

The Circuit

After searching the web, I settled on a circuit from this website as a starting point. After some tweaking and experimenting I arrived at this:

The circuit, as you can imagine, breaks down into three sections, the receiver, the transmitter and, not pictured above, the power supply.

The receiver consists of an IR receiver module with an active low signal. This signal is inverted by a simple small signal BJT (bipolar junction transistor) as an input signal to trigger the transmitter.

The transmitter section consists of, no surprise, an IR LED, which is driven by another transistor. The LED is pulsed on and off at approximately 40kHz by a pulse generator circuit with a 555 timer IC at its heart. I'll fine tune the modulation in the near future.

The power supply will eventually consist of 2 AA batteries, for their compact size and energy density, and a voltage regulator to provide 5V to the parts that need it. For now I am using a 9V battery and a good old-fashioned 7805 linear regulator. I'll address power reduction in a later article.

The good news is the prototype circuit (see pic at the beginning of this post) works pretty well with our DVD player and satellite receiver. But we also have a TiVo and the TiVo is not happy.

TiVo Problems
When in operation, the repeater renders the TiVo remote utterly non-functional. I found an explanation at this website by Edwin Olson.

*Apparently the IR module is distorting the signal, so it isn't truly repeating the signal verbatim as I had originally hoped. After dragging out my trusty, massive Hitachi V1050F oscilloscope and after fiddling with knobs awhile, I finally duplicated Mr. Olson's results.
You can clearly see that the module is adding extra delay on the falling edge of the signal and virtually none on the rising edge. Hm, well, this is a bit of a problem. Stay tuned to see how I end up solving it. I can't wait to find out! :)

Thursday, September 17, 2009

Oscilloscope Calibrator: Part 3

Power Supply

The last item on the list for the oscilloscope calibrator is an AC to DC power supply. I couldn't really design that earlier because I wasn't sure what supply voltage and current would be needed for the amplitude amplifier. Now I do.

With the design settled on a 12VDC supply, and with some SPICE modeling, the supply needs to deliver at least 20mA. Meanwhile, a 5VDC, 0.5A supply should be enough to drive the TTL ICs.

To get regulated DC power, we need to convert line AC voltages to lower AC voltages, rectify AC signal, filter the ripple, and feed it to voltage regulator ICs.

Converting AC to AC

The first step is to convert a 115V, 60Hz AC signal into a much lower AC signal, 12VAC in this case, since 12V transformers are very easy to source like this 450mA one from Radio Shackicon for just over $6. I may upgrade to a higher capacity transformer in the near future to ensure the entire power supply can safely deliver more than enough current.

Converting AC to DC

Time to convert the 12VAC signal to DC. Before we can do that, we have to rectify the signal, that is, convert the negative voltage swings of the AC signal to positive swings. Typical rectifier diodes are 1N4001 thru 1N4007, each with a progressively higher voltage rating. Pick a voltage rating that is at least 2.83 x Vrms (in our case 12 x 2.83 = 34V). Hook up the diodes into a bridge rectifier topology. Or, use a bridge rectifier IC.

The output from the rectifier is not DC yet. The waveform's ripple needs to be filtered using large electrolytic capacitors. Select capacitance based on the desired ripple factor or just use the rule of thumb of 1000 to 2000µF per amp.

Choose capacitor working voltage with a safety margin above the peak to peak voltage of the rectified waveform. Multiplying the RMS (root mean squared) VAC by 1.414. In our case, 12VAC (RMS) has 16.968V peaks. I chose 35WVDC.

So now we have a nearly pure DC signal. It's good enough for the rectifiers (whose data sheets may tell you what ripple factor you need to engineer for).

Regulating DC

We'll now use a voltage regulator to smooth out the DC and fix it fairly precisely at the desired voltage despite varying load. Linear regulators are very popular and simple to use and come in several voltages, including 5V and 12V. The LM7805 does 5V and LM7812 does 12V. We'll use each for this power supply.

Linear regulators need a DC signal that is about 3x higher than the desired output voltage. The voltage difference is burned up as heat by the regulator. So if there's a big difference between the input voltage and output voltage (like 16V to 5V) a heat sink is required or we need to supply a lower voltage level to the regulator. I may end up selecting a separate 6VAC transformer.

Another capacitor can be added across the regulator output to ground to provide reserve current for increased demands. Usually something like 100uF/amp is suggested. When the circuit is turned off, the charge in this capacitor will dump back into the voltage regulator. To prevent this, a rectifier diode is placed to bypass this current from the output to the input terminals.

Lastly, small capacitors, 0.1µF to 1µF are placed close to the regulator body across input and ground and between output and ground, to reject noise.

Switch and Additional Protection

Use a polarized plug. This is the standard for most modern electronics to avoid shocks. To turn the power supply on and off, put a switch on the hot wire going to the primary windings of the transformer. Place a fuse inline on the hot side, between the plug and the switch. Pick a fuse that is about 2X the normal current requirement. Use a slow blow fuse.

Finding out the max current on the primary side is a question of finding the ratio of voltages (120/12 = 10 in my case) and then using that to figure out the current requirement. With two 2A regulators, the primary will see 200mA; 2 x is 400mA so the next closest size is 0.5A. If I find that inrush current that charges the large capacitor causes the fuse to blow, I can always size it up a bit.

Finally for surge protection, a Metal Oxide Varistor (MOV) is placed in parallel between hot and neutral, after the switch. Select one with a maximum continuous voltage of 20% more than the normal line voltage (for 115V, a 135V rating would work).

So here's the finished schematic. I have to build this circuit before I can test the amplitude section, because I don't have any other 12V supplies available.

I decided to try my hand at PCB fabrication for this portion of the project. Here's a picture of the rectifier / regulator board. It's almost completed. The transformer, MOV, fuse, and power connector are going to be external to this board.

Part 1: Signal Generator
Part 2: Amplitude

Part 4: coming soon


Thursday, September 10, 2009

Simple DIY PCB Drilling

The next step in DIY printed circuit board (pcb) fabrication after designing the pcb layout and etching the PCB is drilling the holes. Drilling holes was much easier than I anticipated, probably because I chose the right tools.

PCB Drilling Tools

I needed mini carbide drill bits and a Dremel drill press / workstation or one like it (recommended by one online forum for DIY PCB fabrication).

The cheapest source I found for drill bits was this 50 piece grab bag from Harbor Freight, which took forever to arrive. Still, it contained a number of useful sizes for PCB drilling. The commonly used sizes appear to range from: #71 (0.026" / 0.66 mm) through #56 (0.0465" / 1.18 mm). They work beautifully.

I already had a Craftsman rotary tool and chose the matching Craftsman drill press for $40. Some suggest these hobby drill presses have too much side to side slop and will break drill bits. After drilling hundreds of holes in dozens of boards, I disagree. I believe the mechanism is tight enough and easy enough to use for PCB drilling.

In the picture below, you can see the rotary tool, drill press, drill bits, PCB, and a drilling map I made to tell me what size holes to drill and where.

Selecting Drill Bits

Not all holes in the PCB are the same size. Larger power devices like rectifier diodes and regulators use larger holes than, say, tiny capacitors or 1/8W resistors.

If you're new at this, here's a good way to get started. Hole sizes are automatically captured by Eagle based on the components' packages.

After creating your PCB layout, Eagle can generate Gerber and Excellon NC drill files, normally used by a drilling machine. The files needed translating to a human readable format: a drill map like the one below.

Here's an example NC PCB drill file. All the NC codes can be found here.


How do we get from the NC drill file to the pretty map above? For starters, the file defines drill sizes (0.028" and 0.032"), then for each drill size, a list of X,Y coordinates is listed for drilling.

If we translate the NC drill file into a comma-separated file format (.csv), we can use Microsoft Excel and OpenOffice Calc to plot x,y points in a scatter plot that then becomes a map of your PCB's holes.

I wrote a fairly simple perl script (download here) to convert the NC drill file into a .csv. Each set of holes is described by two columns for X coordinates and Y coordinates. And each pair of these columns has a heading with the drill size. The pairs of columns (holes) for each drill size appear left to right.

After drilling some holes
Simply create a scatter plot using multiple data series with each series corresponding to the set of holes for a given drill size. Make sure the name of each series contains the drill hole size. You'll end up with a chart like the one I've included above.

Note that your PCB drill map is a mirror image of your PCB!

Quicker PCB Drilling

After you've done this a few dozen times you can eyeball the PCB pad and determine a reasonable drill size. The quick and dirty approach for selecting drills: use ~.027" bits for small holes like 1/8 watt resistors or small caps, ~0.031" bit for medium like transistors and 1/4 watt resistors, and ~0.038" for big holes like pin headers and 1/2 watt resistors.

Time to Drill

Pick a drill size (slightly larger is better than too small, like 0.042" for 0.040") locate the holes of that size on your PCB chart printout, map to the actual PCB, and drill away.

Don't do anything dangerous. Use eye protection. Be safe! Your safety is YOUR responsibility.

I was able to pretty easily line up the drill bit with the hole. Set the drill height fairly close to the board to make it easy to line up. Use lots of light, too. The wickedly sharp drills running at high rpm cut through the PCB like butter. I don't tend to drill slowly or linger. It seems to work best drilling the PCB quickly. Half a second at most in a smooth motion.  It was far easier than I expected. The right tools make any job easier.

Tinning the PCB traces
Tinning the Traces

You might want to tin the traces after drilling to prevent corrosion over time.

I slathered plenty of paste flux on the traces and applied a very thin layer of solder to each of the traces as well as the lettering. This prevents the traces from tarnishing.

I recently learned that paste flux can be washed off with mineral spirits, leaving a clean board behind. I use a toothbrush dipped in the stuff.

Niggling Details

The pcb mounting holes are too big to drill with any of my mini drills but I decided to drill pilot holes using my biggest bit and then chase those on my larger bench top drill press. I now generally standardize on #4 size holes and have a drill bit that works great for this size.

The finished board
While it would be really swell to trim the PCB square and pretty, I lacked tools and techniques on this first board. A dremel with a cutoff wheel is slow and throws dust everywhere. I now use a bench top belt/disc sander from Harbor Freight. It's fast and I get nice square edges.

I decided to put a "silkscreen" layer on the top of the board using laser print transfer. Do this before you add flux!  The results were acceptable and the labels were a big help in swiftly populating the board.


And that's it. I'm done! It was really satisfying fabricating my very first PCB! Since then I've designed and fabricated many boards. Had I known it was this easy and cheap I would've tried it a long, long time ago.

Friday, September 4, 2009

Oscilloscope Calibrator: Part 2


We left off having reverse engineered the Heathkit IG-4505's easy parts, the clock and frequency divider, and designing and prototyping functionally equivalent circuits. I think this was easy because I like digital logic circuits about 10 gazillion times better than analog circuits, but that is what is next: the amplitude amplifier. Ok, it's not really an amplifier.

Now that we have a nice pulse train of selectable frequency, it'd be nice to be able to calibrate the oscilloscope to correctly read volts/division. So the amplitude of the pulsetrain needs to be converted from TTL 5V levels to 100V, 10V, 1V, 100mV, 10mV, and 1mV.
Here's how the IG-4505 circuit (above) does this. The pulse signal comes into the bottom transistor (Q3), lower left in the diagram below. It drives the rest of the circuit on or off at the same frequency as the pulsetrain. When this transistor is conducting it shorts out the circuit, disabling output current and voltage.

The top transistor (sources from a 120VDC supply. We'll look at the top transistor later, but in short, it supplies the voltage and current to a series of precision resistors.


So what do the resistors do?So long as Q3 isn't conducting, and current is flowing from Q2 through the resistors, they're used to drop voltage in 10X steps from 100V to 1mV. The resistors are 90k, 9k, 900, 90, 9, and 1 ohm, in order from left to right. We have to ensure 100V is present at the 90K resistor, and that the right amount of current is passing through the resistors. If so, the first resistor will drop 90V leaving 10V. The 9K resistor will drop 9V leaving 1V. The 900 ohm resistor drops .9V leaving 100mV and so on.

Constant Current / Voltage

But how to guarantee the 100V at the 90K resistor? We put a 10k potentiometer to drop just the right amount of voltage to leave 100V left over for the rest of the resistors. That means that more than 100V has to be available to the calibration potentiometer. That's where the Q2 transistor, and zener diode, come into play.
A 10k resistor in series with Q2 and a 110V zener diode guarantees that 110V appears across the collector of Q2 to ground. The set of resistors, then, always see almost 110V (less the voltage drop across the transistor and the D2 diode). As you recall the resistors' total resistance adds up to 100k plus up to 10k for the calibration potentiometer.

The 470 ohm resistor biases the transistor, and base is connected to a voltage that is 0.7V below the emitter voltage, due to the D2 voltage drop. I believe this is a kind of feedback. If too much current is drawn through D2, it's voltage drop would increase, meaning less voltage seen on Q2's base, which would decrease collector/emitter current. I think. Please feel free to provide any information you may have. All I know is that with the D2 diode, the current is much more stable with changes in Rtest than without.

So current is approximately fixed, thus the voltages / amplitudes are approximately constant, even with order of magnitude variations in input impedance for whatever is receiving the pulsetrain. Most 'scopes have around 1Mohm impedance. How do I know voltages and currents are approximately constant?

SPICE Experiments

I played around with this circuit in LTspice to see if I could understand it a little better. I converted the circuit to work on 12V and output 10V thru 1mV amplitudes, since most scopes I've ever encountered max out at 5-20V/div.

It uses a 2n2222 NPN transistor and a 10V zener for the reference voltage. Rtest models the input impedance of an oscilloscope being calibrated (or really any device hooked up to the calibrator.

Operating point results for Rtest=1M are as follows. Just about what we want. Voltage is right around 10V. I could get it there by tweaking Rcal further. Current is about 1mA.

V(vcc): 12 voltage
V(ref0): 9.95418 voltage
V(ref1): 0.994523 voltage
V(ref2): 0.0994523 voltage
V(ref3): 0.00994523 voltage
V(ref4): 0.000994523 voltage
I(Rcal): 0.000995518 device_current

It looks like the D2 diode really helps stabilize the current / voltage drop; I'd left it out early on and found current and voltage varied considerably more.

With the diode, the circuit model works beautifully, holding current and voltage within very tight tolerances regardless of massive swings of input impedance of the oscilloscope (Rtest) as you can see from the logarithmic plot of Rtest vs V(ref0) below.

Even several orders of magnitude change in Rtest won't change the reference voltage by more 1%. As long as Rtest stays within 1K to 1M, the reference voltage changes under 0.1% ... not bad!

Rtest V(ref0) % change
1M 9.95418
100K 9.95342 -0.008%
10K 9.95258 -0.016%
1K 9.94639 -0.078%
100 9.90896 -0.454%
10 9.86791 -0.867%
1 9.85833 -0.963%

Most scopes have similar impedance, but in case I want a reasonably regulated signal generator for a variety of loads, this behavior is quite desirable.

Interface With Pulse Signal

The only thing left is to experiment with Q3, the transistor used to switch the voltage through the resistors on and off. All it's really doing is taking the TTL-level pulse signal from the frequency divider circuit and using that to periodically short the current from Q2 to ground.

In SPICE, we can model the pulsetrain as a PULSE type voltage supply. I arbitrarily chose a supply with a 10us on time and 20us period, 5V peak output. I'm feeding this signal into the base of a 2N2222 through a current limiting base resistor (ideally I need to spend a little time calculating to ensure the transistor is in saturation when it is on). Here's the LTspice circuit diagram.

Using transient analysis, I plotted the 10mV and 1mV nodes to demonstrate. Looks like it should work fine. At least in theory!

Et Voila

I can now prototype this circuit, but I'll need a 12V power supply. Fortunately, that's a cake walk to build by comparison to this circuit and I'll cover it in the next article. I'll revisit the amplitude selector circuit and pulling the remaining circuits together in the final article.

Part 1: Signal Generator

Part 4: coming soon

Friday, August 28, 2009

Simple DIY PCB Etching

Want to fabricate printed circuit boards (PCB) at home, cheaply, quickly, and easily? So did I.

The tips on these sites worked for me but I have learned more. Read on....
Experimentation and perseverance help. It's ok if you goof up a few times; I did. Hang in there and you'll be a DIY pcb etching guru soon! Find out what works for you, and you're set.

Start with a small, simple circuit and stick to single sided traces! My first circuit was for a 12V/5V dual power supply circuit for another project. It uses only a handful of components.

The design layout fills a 2" square area, using up only a fraction of an already cheap (under $4) PCB blank from the local Radio Shack. In case the etching went poorly, I had enough PCB material to try it a few more times.

PCB Layout and Design
How did I do the printed circuit board layout in the first place? I like to use CadSsoft Eagle which does integrated schematic drawing and PCB layout. I can offer a some tips:
  • Use wirepads (search for wirepad in the Eagle libraries) or pin headers for external interfaces not appearing in the schematic, like the transformer secondary wires, in this case.
  • Use the DRC dialog and Restring tab to change the size of pads; bigger pads are better for manual drilling.
  • Put all traces on the bottom layer so when you print the transfer you can uncheck "mirror"
  • When you print the PCB transfer, hide all the layers you don't want to appear as copper traces, then print with the "black" checkbox option set (see picture to the right)
  • For off-board components like rotary switches, create a custom package in the Eagle library comprised only of wire pads but using the correct schematic symbol.
  • Include dimension lines in the transfer print but make them at least 16 mil.
  • Create fill areas (pour regions) with Eagle, particularly for GND, instead of leaving lots of blank spaces on the PCB.  Saves etchant and time etching. It also saves time laying out the board.
Example of using Eagle Fill Area (Polygon) for GND
    Single Sided Impossible?  Cheat!
    Can't figure out how to fit all the traces on one side?  Cheat!  Use jumper wires  as in the board above and below. Many of the consumer electronics I've taken apart use bus wire.  It's quick to install since there's no insulation to strip.

    Jumper a trace on the "top" of the board with pads.

    • Add two pads where you want your jumpers. 
    • Change their name to match the net you're trying to jumper (e.g., VCC).
    • Draw a trace between these pads on the "top" side of the board (red) to represent the wire
    • Draw traces on the bottom side (blue) to the pads.
    • When you print the PCB (see below) hide the top layer.
    • Drill the holes, and run wire between these two pads
    Magazine Paper Transfer
    Several websites give tips on laser printing on magazine paper and transferring to the printed circuit board. Laser printing (and photocopying) uses melted plastic instead of ink. By applying heat heat, the plastic melts itself to the PCB, then the magazine paper can be soaked in water and rubbed off, leaving the laser print behind as a mask for the etching solution.

    A few companies provide store bought solutions for transferring trace masks to the PCB but those are obviously more expensive than using scrap magazines. I haven't tried them yet.

    Ricci Bitti's website gave the best advice. Printing on magazine paper was no problem and you can easily see the matte laserprint on the material.

    Toner transfer, ready to iron onto the PCB

    Here are some additional tips:

    • Cut down the magazine paper and tape it to scrap laser paper to prevent jams
    • Use the "Wool" (1 below Cotton, 2 below Linen) setting on your iron
    • Use green ScotchBrite pads for cleaning, abrading the PCB
    • Clean the board with acetone (carb/choke cleaner)
    • Apply moderate pressure, and slow circular movement on the iron for about 60 seconds.

    Et voila, after six or more failed attempts, I finally got a good transfer!

    A few of the traces are a little blotchy, but none of the pads are. The fine detail turned out beautifully. Like you can see in the picture, the tiny printing and the crosshairs in the corner drill holes retained their detail.

    I've since found better results when using traces no wider than 32 mil with good results at 24 and 16 mil. Smaller traces are unlikely to work well. You can repair any flaws in the transfer with a fine tip or ultra fine tip Sharpie permanent marker which conveniently resists etchant.

    The common chemical of choice for DIY PCB etching is ferric chloride and that's what i use. You can get it from Radio Shackicon. Use suitable disposable gloves to keep the FeCl off your hands. They stain everything yellow. You don't want to look like a Simpsons character. Work in a well ventilated area.

    To speed up pcb etching times, I now use a hot water bath. Put the FeCl in a small disposable tupperware tub. Put water in an electric skillet (I use my reflow skillet). Of course don't use it for food anymore! Put the tub in the water, and heat up the water to somewhat below the "warm" setting.

    Boards usually etch in about 15-30 minutes. Don't let it go too long or it'll etch through the toner. So check it after 15 minutes and ever 5 minutes after that. I no longer use the FeCl-soaked sponge method. Too messy!

    Once your pcb etching is complete, dip the board in water to rinse and neutralize the FeCl then wipe off the toner with acetone (spray carb cleaner) and a paper towel.

    On my first fabricated board (below) the etching worked really well and even the smallest printing came out perfectly. There were a couple of small spots of toner that separated leaving tiny spots on a couple traces that were a little etched.


    Pseudo Silk Screen
    You can do your own "silk screen" printing on the top layer, too. But without real silk screen.  Just use the toner transfer method to transfer printing onto the top of the board to show what components go where.
    • In Eagle, hide all layers except tplace, dimensions, tname, tvalue, and tdocu
    • Use the 'smash' function to enable moving and resizing the labels
    • Add any other text you want (name, copyright, copyleft, whatever)
    • When printing, select print in black and select the mirror image checkbox
    • It's best to drill holes before you silkscreen; it gives you something to align to.
    • Align the printed image to the board and holes.
    • Toner transfer the image onto the blank side of the board.
    Try to do a better job of aligning your "silkscreen" than I...
    After fabricating many printed circuit boards over the last few years since I first wrote this article, I've been etching more surface mount boards using 16 mil traces with 0805 and 0603 size SMD components, as well as SOIC, SSOP, SOT-223, SOT-23 and 0.6mm QFP packages! Not bad for DIY, eh?

    Here's a couple examples that turned out very nicely. The ability to transfer such fine detail opens up a world of possibilities in board design. I used a Reflow Skillet to populate both boards. I've since started using my Weller station with fine tip along with fine SMD tweezers for the small passives.

    16 mil traces with 0603 SMD components.
    Board populated with 0603, TSSOP-8, etc
    With a little experimentation and perseverance in the face of multiple failures, I was able to reliably etch my own through hole and surface mount printed circuit boards. If you follow these tips, you'll soon be doing the same and a new world of hobby electronics will open itself up to you..

    But hey if you got this far and still don't feel comfortable trying it, then give a try. I highly recommend them and use them all the time. Affordable and outstanding quality.

    Next: Drilling