Friday, November 14, 2008

Project: Function Generator and Frequency Counter


This project was based on an article published in Everyday Practical Electronics magazine for a very flexible high speed combination function generator/frequency counter.

I built it because I was having great difficulty tuning a breadboarded DTMF tone detector circuit with my oscilloscope. I was convinced the problem was the inability to lock the triggering circuit on the correct tone, so they solution was to trigger the scope with a stable continuous frequency. Funny - by the time I built the circuit, I had completely lost interest in the original DTMF detection circuit.

Research into function generators revealed them to be expensive, even used on Ebay, so I decided to build one based on the EPE Magazine article (PIC-Gen July 2000 issue)

I cheated and ordered the PCB from EPE Magazine rather than etching my own (did I mention I really hate etching PCBs?)

The final circuit is identical to that published in the magazine, so I will not detail that except to reference the excellent source article.

My changes relate to the case, layout of the connectors and front panel, and the LCD module I used.

The front panel is arranged differently only because I decided to buy a different case (cost), and that I wanted to add a BNC connector wired to the TTL output to use as an external scope trigger.

The LCD module is different because I simply used the one I had on hand from a previous bargain purchase from my junk box. This required some fairly simple modifications to the assembly code.

As constructed, the circuit provides a fairly stable output from less than 1hz to about 10 Mhz. I say fairly stable, because there is some wobble on the scope display, and the frequency count has a tendency to drift with no load.

It does stabilize a bit under load.

I suspect that most of my stability issues are related to noise from my haphazard unshielded wiring scheme. One of these days I need to make a concerted effort at shielding and routing wires to reduce the jitter.

The hard part for building this circuit was acquiring the parts. MAX038 is an awesome chip, but its pretty hard to find. I don't recall exactly where I found it, but I do remember it was priced in Australian dollars and shipped from Hong-Hong - pretty interesting for a part from a company based in Dallas.

Originally I powered the circuit with a pair of nine volt batteries on the assumption that doing so would reduce problems with 60hz noise from the power line causing instability.

In 2008, after I built my CNC PCB Milling Machine, I machined a custom PCB to create the required split positive and negative supply from a dual 12 VAC wall wart I had in my junk box. I cut the custom connector off the wall wart and soldered the wires directly to the power supply PCB rather than buy and wire up a power supply connector. The circuit is no less stable with the AC power supply than it was on batteries, and its a lot easier to deal with.


The main lesson I learned from this one is to create the front panel art BEFORE soldering all the connectors. I did not do that, and have been too lazy to take it all apart to do a proper front panel. I thought when I built it that I would remember what all the switches did, but a couple years away ruined that concept.

UPDATE 12/29/2010:

As requested in a comment from jman, I have posted the updated source code, listing and hex file to my CNC milling machine Google source repository.   It can be accessed to browse at:  https://code.google.com/p/cnc-milling-machine/source/browse/#svn%2Ftrunk%2Fpicgen

Project: Kit96 PIC Programmer

My next project after the ring warning device was another kit. This one was for a programmer that was capable of programming the most popular PIC microcontrollers from Microchip, such as the now-obsolete PIC 16F84.

I got interested in the capabilities of microcontrollers from articles in the excellent UK electronics magazine Everyday Practical Electronics. At the time (2001) the electronic edition was available for the ridiculously low price of $9.99 for a year. They also sold back issues on business card CD-ROMs dirt cheap as well. I bought a bunch of back issues and subscribed for several years. It is an excellent magazine. In my opinion, better than any of the American publications, and even now its hard to beat the price for the electronic edition ($18.99).

While it is possible to build simple programmers on a breadboard, I decided I wanted something with some decent software and more flexibility to add new chips. At the time, kit 96 was the best deal. I purchased the kit from Dontronics, and added a few parts (wall wart and ZIF socket) from Jameco.

The construction was soldering on a PCB, and was completely uneventful. The directions were well written and easy to follow and the programmer worked perfectly the first time I tried to use it.

The programmer worked well at the time, but suffers from issues with operating system compatibility with each new version of Windows, and timing issues as processors get faster and faster.

I have since purchased a Pickit 2 USB programmer from Microchip Direct. It is a much better deal now than any of the kits, and has support in the MPLAB development environment that no third party programmer can touch. It even has support for in circuit debugging, and software to function as a logic analyzer or logic level serial port (perfect for combined serial port/programming from a single header - like my soon to be posted Tourette's talking practical joke circuit). I understand the Pickit 3 is now available, but have yet to see any good reason to upgrade (although I certainly would buy that now if I was just getting started)

Anyone want to buy an assembled and tested Kit96 programmer cheap?

Links:

EPE Magazine

Dontronics
Microchip - Manufacturers of PIC microcontrollers

Wednesday, November 5, 2008

Project: Ring Detector

This was the first project that I built from my own design for my own use.

Basically its a simple ring detector with a flashing LED and a reset button. It plugs into a basic analog telephone line. When it detects a ring voltage, it starts flashing the LED and keeps flashing it until it is reset by pushing the reset button.

I built this because, at the time, I had a basic analog phone at work with voice mail. I didn't get many voice mail messages, so when I didn't remember to check for messages. This was my solution. When I was away from my desk and the phone rang, the light would flash until I reset it. I would reset it after I checked my voice mail - problem solved.

Version 1
The first version was built in a basic project box with on a pad per hole PCB that was designed specifically for the project box. I purchased this one from Jameco as I did most of my parts back then.

As you can see from the image, I used basically a point to point construction technique on this version. Most of the connections were made using the extra leads from the components, which I soldered to the pads of the other component to which it was connected. I also used copper tape to make some of the connections. This process was fairly easy to do, but did require a bit of planning for the layout of the components. This is the only project I built with this technique, so clearly I did not find it too impressive.


The Top side of this board shows the basic component layout. The two white wires shown were cut from the momentary reset switch. The four pin header with one pin removed was for the power (battery for this model. The two pin header between the four pin header and the two electrolytic caps connects to the LED mounted in the case. The other two pin header on the top left connected to the phone line (RJ11 jack).

The complete unit fit into the project box with a 9V battery provide power. I used this unit successfully for months until the battery ran out and I decide to upgrade.




Version 2
PCB Board Layout

Final Schematic

Board Parts Layout


The final version was produced using the PCB layout available from the links above. I created this board using the toner transfer method with Press-n-Peel PCB Transfer film

Basically this stuff is a special blue polyester film that you print a PCB pattern on using a laser printer. Then using a household iron, you melt the toner off of the film onto your prepared copper clad board. Then you etch the board using a chemical process. I used Ferric Chloride from the PCB kit I purchased.

The process was pretty easy, and resulted in a pretty good board, but I really dislike chemical etching because the chemicals are pretty nasty to work with and dispose of. Others apparently like it as a process, and it is hard to argue with the ease of use or the quality of the results that can be achieved.

Credit for the ring detect circuit based on the 6N139 optocoupler and 2N3906 transistor goes to the now defunct Home Automator Magazine. The addition of the flashing LED and reset circuit are mine.






Project: Jameco Capacitance Adapter Kit


Once I bought all those random capacitors in a grab bag (Jameco part 163213 - Schwab's 3lb combination), I needed a way to quickly sort them out into values when some of them did not have any readable values on them (especially the small ceramic ones).

I solved that problem by buying the part #158001 kit for a adapter to measure capacitance on a normal DVM.

The kit included a PCB, and all of the parts needed to build it (except for the case). The kit is produced by Electronic Rainbow as part CA-1. It does its job well. Basically the circuit uses a 74HC132 a schmitt trigger quad two input NAND gate to create a pair of oscillators, and uses the unknown capacitance to alter the duty cycle of the PWM output to the DVM so it shows a different DC voltage proportional to the capacitance. Honestly, I am still not completely sure how it works.

The kit accomplished its purpose well - it gave me a chance to bone up on my soldering skills and build something that helped me sort some parts.

Now this pretty much just sits in a drawer. There really is not much need to measure unknown capacitors outside of my grab bag situation. When you buy them with known values it is not hard to keep track of them, and there is really not much sense in taking the time to desolder small capacitors for scrap boards because they are not that expensive.

Sunday, November 2, 2008

Project: The Prototyping Box


The first major project I built in late 2000 was a basic self-contained prototyping center integrated into a box that contains a power supply, an extensive prototyping area, and an array of common panel mount components such as potentiometers, switches, and connectors. The front panel of the prototyping area is show to the left.

The front panel has:
  • 7.25" x 7.5" 3220 point solderless breadboard
  • Power on/off toggle switch at the top
  • 5 way binding posts in various colors for the different power supply voltages (-12v, -3.3v, -5v, Common Ground, 3.3v, 5v, 12v
  • 2.1mm and 2.5mm coaxial DC power jacks
  • 8 red T1 LEDs
  • 8 toggle switches
  • On the left side: SPDT toggle switch.
  • Momentary pushbutton switch.
  • Rotary 2 pole 6 throw switch.
  • 1k, 10k, 100k, and 1M ohm linear taper potentiometers
  • 8 ohm speaker
  • On the right side,
  • Male and Female DB25 connectors wired in parallel
  • Male and Female DB9 connectors wired in parallel
  • 2.5mm Stereo headset jack
  • 3.5mm stereo headset jack
  • On the bottom I later added an embedded LCD digital voltmeter (DVM) with positive and negative 5 way binding posts, a switch to switch the negative leg between the black binding post or the power supply common, and a rotary range switch to select a range (20.0v, 2.00v, 200mv, 20.0mv). The power switch for the ATX supply also controls the DVM, so when the power is on the DVM is also on.
Almost all of the parts are wired to single or double row female .100 pitch headers which allow the jumpers to be directly plugged into the components from the prototyping area. The exceptions are the power supply binding posts and the DVM (in retrospect, that was a mistake - the power supply voltages should also have been wired to headers)

I used Insulation Displacement Connectors (IDC) and ribbon cable wherever possible in the construction, all the rest of the connectors were wired point to point and soldered (because at this point I was not willing to create printed circuit boards)

The bottom of the hinged top looks like this:
You will notice the 9V battery that is stuck to the underside of the panel. That is used to power the integrated DVM. By using a battery, I avoided common mode issues when measuring the voltages of the power supply. I have been using this for better than 5 years, and have yet to replace that battery.

At the bottom of the photo, you will see colored wires that go off the bottom of the photo. These are the power supply wires that connect to the ATX power supply via a female connector. Rather than cut the connector off the ATX supply and directly connect the wires, I purchased a 20 pin ATX power supply extension cable and cut it in the middle to get a female connector with wires I could connect to the binding posts. I removed the unused pins from the adapter to eliminate the risk of unused power wires inside the box. This removable connector allows me to easily swap out the power supply. Most of the rest of the bottom picture is uninteresting expect that you can see where I used ribbon cables and IDC connectors vs point to point wiring. In most cases where I used point to point wiring, I used crimp pins and connector housings from Jameco on the connectors.

The mounting panel is a sheet of fairly thick (0.062") aluminum sheet that I machined using various drill bits, a dremel tool, and a nibbler tool (which I strongly recommend). The panel mount parts are all mounted normally, while the parts that are not normally panel mounted are all epoxied in place from the bottom.

The panel is inset flush into a frame made of 1" x 2" x 1/2" pine. The aluminum panel is mounted to the pine frame via 8 wood screws, one at each corner and one in the middle of each side. The top of the pine frame is hinged to the bottom box section.

The box portion is made out of 1/2" pine and 1/8" hardboard (for the bottom). I created it large enough to house the ATX computer power supply and sloped the sides towards the front to make it easier to work with. The extra space is used for storage of various parts, connectors, etc.

The back of the box is routed and drilled to mount the ATX power supply so access to the fan power switch and connectors is available on the back of the box. When not in use, the power cord gets stowed inside the box.

I used an ATX power supply because I happened to have a couple of spares lying around, and the fact that it supplies a number of useful voltages at fairly significant current ratings. While I have seen many references to using a resistor to draw enough power to force the switching supply into regulation, I have not found that to be necessary for this particular supply. In fact, I found it unnecessary with every single ATX power supply I ever tested.

The wiring for the ATX connector is:
  • The green power on wire is connected to the power on switch on the front panel, Turning the switch on shorts this wire to ground which causes the power supply to turn on.
  • The grey power good signal is connected to an LED via a 220 ohm resistor to provide a visual indication of correct power on (and properly regulated power)
  • The black wires are common/ground. One is connected to the power good LED, one is connected to the power on switch, and one is connected to the black binding post.
  • The yellow wire is connected to the +12v Yellow binding post
  • The red wire is connected to the +5v Red binding post
  • The orange wire is connected to the +3.3v Brown binding post
  • The white wire is connected to the -5v White binding post
  • The blue wire is connected to the -12v Blue binding post.
  • The green binding - not sure what I was thinking when I bought it and put it on the board.
What I would do differently:

If I was to build this again, I would have made it smaller and lighter, with fewer fixed parts. Realistically very few of the permanently mounted positions ever get used. The potentiometers are used,as is the speaker, because they are more convenient to use as mounted.
  • The switches are rarely used because when prototyping a circuit I am much more likely to either use a small pcb mount switch directly on the breadboard, or just plug and unplug a wire.
  • The permanently mounted LEDs are never used, nor are the permanent switches. It is easier to plug a LED directly into the board and replace the switches as described above. Because of the need for a limiting resistor on LEDs and usually a pull up or pull down resistor on a switch, they just sit there unused. I would replace these with a breadboard module PCB that could be plugged directly into the board (more to come about these)
  • The rotary switch and DB9 and DB25 connectors are never used. It is easier to strip and tin the wires from a DB9/25 cable and plug right into the breadboard in most cases, and I just haven't designed anything that uses a rotary switch.
  • The same is true for the two coax power supply jacks and the stereo headset jacks. It is easier to strip and tin wires from a spare cable.
  • I would go with a more modular approach based on small single function PCBs that plug directly into the breadboard. (although honestly I only consider that now that making PCBs with my CNC PCB Milling machine is so easy)
  • I probably would have built a much smaller enclosure with regulated and unregulated battery driven power rather than the ATX supply. I would still include binding posts for connecting external power from a bench power supply. I intend to create a good dual/triple bench power supply in the future after which the ATX supply will be retired.
  • That said, the ATX power supply has served me very well. This project box also inevitably serves as the power for my projects until I get around to building a standalone power supply or finding an adequate wall wart in my collection. The reason to build the bench power supply and shrink the project box to a more reasonable size comes down to needing the desk space.