Lab Frequency Standard

I’ve been rather silent for a couple of months now, but I have been busy! This time it is a laboratory frequency standard! This project is modeled on the work done by Gerry Sweeney over on his blog. I have been assembling the various pieces needed for this build for several months now, and just recently decided to take the plunge and do the build.

It started off with a Rubidium frequency standard from Frequency Electronics, the FE-5680A. These can be purchased used off of EBay for ~120$ CAD. Buyers beware: I had success with my first unit, but others have not been so lucky. There are numerous configurations of this unit, with various features present or missing, including the 10MHz sine output. This project requires at a minimum the 10MHz out. Some units will have this via a dedicated BNC or SMA connector, others (like my unit) will have it present on a pin from a DB-9 connector.

The second most important component is the case which will house the completed project. I was originally going to choose a basic project box, but Gerry was pointed towards a distribution amplifier for video. Since the signal from the FE-5680 would need to be replicated on multiple outputs to be useful, some sort of amplifier was going to be needed. It just so happens that 10MHz lies in the range of off the shelf video amplifiers, and the model I got by Extron, the ADA 6 Component was perfect for the job AND was only 40$ on EBay.

Other than just putting the Rb standard in a box with a bunch of outputs, I wanted to have an indicator LED that lit up when the Rb was locked on 10MHz. My particular unit will pull a pin on the DB-9 connector LOW when the Rb is locked. A quick transistor circuit with a regulator feeding off a 17V supply and I had a small prototype board completed:

IMG_5579

Once I had the “interface circuit” figured out, I started laying out what the mechanical construction of the project would look like. I decided to use the case itself as a heat-sink and seeing as how the Rb standard likes to be warm (haha, non-heat-sinked, the case measures ~65C), I decided to mount it to the top half of the box:

IMG_5577 IMG_5578

The Rb standard requires 2 different power inputs: 5V and15-18V. The distribution amplifier also required 2 different power rails: 6.2V and 17V. I decided that the easiest way to power it all would be to pick up a 18.4V laptop power brick, rip the guts out, and add a LM317-based regulator to get the 6.2V to my existing interface circuit. I discovered that the Extron was actually using the 17V rail to power a buck converter-inverter circuit, so the 18.4V input didn’t change it too much.

IMG_5580 IMG_5581 IMG_5585 IMG_5587 IMG_5588 IMG_5589 IMG_5590 IMG_5591

I wired up a small wiring harness to go from the Rb standard’s DB-9 connector to the various parts of the interface board. I then modified the amplifier board to change the input/output impedance from 75ohm to 50ohm:

IMG_5582

Not having any 50ohm resistors handy (and they’re damn expensive as well!), I used 2 100ohm resistors in parallel stacked on top of each other:

IMG_5584 IMG_5583

I soldered in the coax to the center channel, and then jumped the signal from the center channel to the 2 other ones with some wire. This means I will have a total of 18 10MHz outputs on this standard 🙂

The testing and assembly:IMG_5593 IMG_5597 IMG_5598 IMG_5600 IMG_5601

I ran into one problem when testing, which was a deformed lower part of the sine wave on the outputs (all of them). You can see it on the oscilloscope to the upper right:

IMG_5602

I started probing around (“THOU SHALL CHECK VOLTAGES!”), and discovered that the negative rail to the op-amps was running at ~0.3V, which was not right. Running back through the circuit on the amplifier board I realized that I had flipped the 6.2V and 17V rails on the input connector after splicing it into my interface board. After switching them back, everything was working as expected!

IMG_5604

Turns out my frequency counter on the upper right is probably off by 0.5 Hz… not too shabby. There are a couple of things that need to be done: adding a heat-sink to the top of the case for extra dissipation and adding some passive ventilation holes on the top/back of the case and on the bottom.

New Power Supply

One can never have enough power, and in even a small hobbyist electronics lab, one needs at least 2 supplies (to generate both positive and negative voltages simultaneously). The Power Designs supply that I first bought I liked a lot: fairly cheap on Ebay (~75$ shipped), 0 to 60V linear range (no range switching), has a max load of double its rated load and has a current limiting feature (important so as not to break your awesome devices under test!).

IMG_0460

Compilers Never Lie

Just a quick note about an annoying behaviour I found in the Ardunio IDE + compiler + toolchain. I was writing the following task scheduler and started off with the typical typedef of a function prototype:

typedef void (*callback_t)(void);

struct task_t {
 long interval;
 int lastScheduled;
 int nextScheduled;
 boolean oneShot;
 callback_t callback;
};

void setup() {
}

void loop() {
}

void addInterval(int intervalMicros, callback_t f) { 
}

void addOneShot(int delayMicros, callback_t f) {
}

This kept on throwing the following compilation errors in the IDE:

Scheduler:6: error: 'callback_t' has not been declared
Scheduler:7: error: 'callback_t' has not been declared

Weird, since there’s not even a USAGE of callable_t on those lines.  Sniffing a bit deeper, I found that the IDE actually pre-compiles my program (called a “sketch”) into a temporary .cpp file, which contained the following:

#line 1 "Scheduler.ino"

#include "Arduino.h"
void setup();
void loop();
void addInterval(int intervalMicros, callback_t f);
void addOneShot(int delayMicros, callback_t f);
void run();
#line 3
typedef void (*callback_t)(void);

struct task_t {
 long interval;
 int lastScheduled;
 int nextScheduled;
 boolean oneShot;
 callback_t callback;
};

void setup() {
}

void loop() {
}

void addInterval(int intervalMicros, callback_t f) {
}

void addOneShot(int delayMicros, callback_t f) {
}

Ah ha! The damn sketch “pre-compiler” was automatically forward declaring my two functions addInterval() and addOneShot() and this was creating an undefined forward usage of callback_t. Thank you Arduino IDE.

Another Nixie!

I found the first Nixie-Tube clock that I built from a kit so awesome, however the only problem was that it got requisitioned for the living room! So of course I had to order another one for my office.

Again, Pete from PVElectronics did a great job on getting the clock kit to me, and assembly went smoothly. Towards the final stages of the build, there is a step that tests all the tubes, the micro-controller and the high voltage generator with a test pattern that counts up from 0 to 9 and then cycles over. It was at this step that I ran into a weird issue where all of the tubes would display all digits when they should have been displaying 4 or 8. I finally isolated the problem to a single tube (although why it would affect all tubes was unclear at this point):



After Pete and I scratched our heads for a few days, we finally came to the conclusion that it must be some sort of internal short in the actual tube (weird!). He promptly mailed me a new tube + circuit mounting board and I was back in business and finished the clock:



And the color cycling:



And here are a few build pictures I took along the way:

IMG_0265 IMG_0268 IMG_0278 IMG_0279 IMG_0281 IMG_0282

 

 

And some shots of the questionable tube:

 

IMG_0290 IMG_0291 IMG_0292 IMG_0293 IMG_0294 IMG_0296 IMG_0297

And the test/debugging setup that I put together.  Here (and I’ve said this before) I’m using two of the test points on the board. I have soldered in two single-pin sockets so I can easily attach a breadboard/other test components to the live board:

IMG_0306 IMG_0307 IMG_0308 IMG_0309 IMG_0310

And the case being assembled:

IMG_0276 IMG_0277

USB to Serial Adapter Project

Not satisfied with the “typical” USB to serial cables that one can readily buy, I decided to design my own.  The basic reason was just another excuse to practice designing a circuit and laying out a printed circuit board (PCB), but to also create a very small unit that can be easily transported. I additionally wanted to have some sort of visual feedback of data transfer over the adapter, so two LED’s (receive and transmit) will address that.

The circuit design came from the application notes on the FTDI chip that I am using, the FT230X:

USB2Serial

I did a few tests with a bread-boarded version of this circuit. You will notice that there are 2 bread boards; the bottom one has the USB to serial circuit, the top one has an Atmega8 micro-controller with a some program that echoes back characters it receives on its serial interface (used for testing):

IMG_5304

 

A close-up of the USB to serial circuit:

IMG_5308

And the two circuits/bread-boards separated:IMG_5307

The other requirement was size: that whole circuit will need to fit within this little box:

IMG_5309

I have actually laid out the board, and so will be finalizing it in the coming days. I will write up another post with the board layout, 3D shots and a bill of materials. In terms of price, this will not be saving me any money over buying a pre-built adapter.

Electronics gear, Part 1 – The Meters

After spending both a bit of time and money, I have assembled a set of tools both new and used to help me on my path to learning a bit about electronics. This first post will be about the most basic of tools for any individual that is interested in electronics, the multimeter.

Agilent U1232A

Originally I was going to buy 2 meters, one high quality one for my primary meter and a secondary one for measuring simultaneous current or an additional voltage. To this end I purchased an Agilent U1232A (6000 count, basic DC accuracy of 0.5% + 2 counts) to use as my primary calibrated meter. I bought it at Active Tech for 150$ + shipping, and it came with a certificate of calibration. This was important to me so I would have some confidence when I test any other meters against it to see if they are calibrated. I have attached 3 shots of the meter measuring 100 ohm, 1K ohm and 10K ohm resistors (0.1%):

IMG_5294 IMG_5296 IMG_5293

 

Hewlett Packard 3478A

The second meter I picked up on Ebay for ~100$ + shipping. I was originally going to try and find another decent hand-held meter, but after seeing a review of the HP 3478A, I decided that I wanted to get a high-precision 5 1/2 digit (30000 count!) bench top meter. It can be found cheaper (I have seen it listed for 60$, but the auctions usually finish higher) but I figure if you can pick this bad boy up for less than 200$ shipping in, you’re doing good. This meter is old but an excellent purchase as the accuracy (as far as I can measure and test) is spot-on when compared against the Aglient meter. The basic DC accuracy of this meter is +/- 0.02% + 2 counts. Again, I have attached some shots of the HP meter measuring the same resistors as above:

IMG_5288 IMG_5290 IMG_5291

You will note that I used the 4-wire measurement function of this meter to measure these resistors. This allows the meter to remove any resistance from the test leads themselves (which ended up about a 2.5% error). Also, you may have noticed the “non-standard” test probe connector for the current measurement on the bottom right of the meter face: this was due to a the fuse holder/connector piece being missing (something I hadn’t noticed in the pictures of the meter on Ebay). I looked around, but even these HP meters being sold “for parts” were 100$+ and Agilent does not stock this part any more. I hacked on a binding post with a 3A fuse behind it and that solved that! So beware: when looking for this meter on Ebay or any other second-hand site, MAKE SURE you get the current socket + fuse holder!

 

Fluke 27/AN

The last meter that I picked up on Ebay is a Fluke 27/AN for ~70$ + shipping, although it can be found cheaper: I have seen them for as low as 50$ for this version.  It is the “worst” of the three: a 3200 count instrument, +/- 0.1% + 1 count basic DC volts accuracy. So it is more accurate than my Agilent (in theory) but has less resolution than the Agilent. The reason I bought this meter was to have a nice solid, built like a tank meter that I would be confident enough to use with mains testing (if need be) and would be rugged enough to use outside the “lab” environment. It also has a 10A current range, which is handy (since the HP can only handle a maximum of 3A). With a rated 900 hour battery life, this meter is the one that I would trust to be working when I need it. Below are some shots of the same resistor measurements as above:

IMG_5299 IMG_5297 IMG_5298

 

As a final test, here is a shot of all three meters connected to the same power source (DC voltage). As you can see, they are all almost exactly the same (of course the HP will have the most resolution, so we can ignore the least significant digits):

IMG_5285

All in all, for a couple of second-hand meters, I am very pleased with the overall accuracy (assuming that the Agilent I have is reasonably well calibrated, since I am using it as a transfer standard). I do not have a meter that can measure temperature, so that might be the next thing to look for!

MOSFET Driver Board, Rev C

It is said that one should learn from one’s mistakes. In the process of learning how to design and get a Printed Circuit Board (PCB) manufactured, I have indeed made a few mistakes. I would like to share them with you here.

First, a quick update on the board that I was designing. My requirement was to be able to drive a spinning light assembly (pictured below) from a micro controller (MCU). Rather than use the traditional relay-based system (which would use a transistor to achieve MCU control) I decided to design it using a MOSFET (a big ‘ol voltage-controlled switch). I also figured that this would present a good opportunity to learn how to design and lay out a very simple PCB.

Always, ALWAYS, Double-Check Your Work

I don’t know if I can emphasize this more: a core theme in all of my mistakes during this project have been due to this. My first board, Rev ‘A’, suffered from a major circuit design error that occurred when I moved my circuit design from the bread board to the schematic CAD tool (I got the circuit backwards: I needed one that worked with a “NPN” transistor, but designed one that worked only with a “PNP” transistor).

Here is my awesome not working circuit (Rev A):

MosfetDriverBoard-RevA

Here is the corrected circuit with the motor BEFORE the NPN MOSFET:

MosfetDriverBoard-RevC

My second revision, Rev ‘B’, was not manufactured; it had the corrected circuit design, but I wanted to tighten up the physical PCB layout so I created Rev ‘C’:

IMG_5160

I had this revision manufactured. The mistake that I should have caught on this time was the adjustments I had made to the hole diameters for the terminals (for the inputs and outputs); I had forgotten to adjust the copper (called “annular ring”) around the holes to make them larger as well. This wasn’t a show stopper, as I was able to solder the components on the board still, but it was borderline.

As an aside, I noticed that the front solder-mask (the blue color) was not uniform between boards; some were blue and others were slightly blue-greenish, about half and half. I also noticed that the silk-screening was less than awesome on all the boards. Note that this board was Hot Air Solder Leveled (HASL) and NOT gold plated like the first revision board.

IMG_5158

 

Thou Shall Check The Data Sheet. Again.

The second biggest mistake that I made was not re-checking the foot prints (the “physical” sizing of a component) during and after I completed the layout of the PCB. DO THIS. It avoids embarrassing mistakes such as holes that are too small to fit the leads of a through-hole component. You should also re-check the pad/leads in the data sheets to make sure they fit with your component symbols and circuit design. Don’t assume anything!

Always Have a Reason

When you place a component, connect a trace, add a connection, always have a reason for doing so! This will prompt you to ask yourself why you are doing this and perhaps lead you to discover a mistake in the making.

Test Points

This board was a bit too small to warrant test points (PCB pads that are designed specifically to be accessible to probes for testing properties of your circuit) but remember to think about adding them in. This can make debugging a malfunctioning circuit much easier later on. Also remember that it may be a good trade-off when designing a prototype device to take a little more space but offer debugging facilities such as test points and wire jump points.

Remember To Add Your Name!

If you truly are happy with your design and PCB layout, then you won’t mind putting your name, date, revision information and other useful identification information on the PCB. Do it! This will make differentiating board revisions easier as well as identifying you as the designer. Take some credit!

 

Board Update

Just as a quick followup, I have received my first circuit board in the mail today, and I must say, I am kinda impressed at the quality of the work done in producing the boards.  I give much thanks and props to the people at iTead Studio:

IMG_5088

And a little comparison with our long friend (this will date this post if anything will):

IMG_5089

There are couple of little issues with the board, but none of them are due to the manufacturer, just due to my in-experience 🙂  So ~20 boards for $63 shipped and delivered in about 2 weeks.  Pretty good 🙂