Wednesday, June 30, 2010

DIY Oscilloscope

For one of my projects I need to measure the frequency of an oscillator. I don't have an oscilloscope, and buying one is prohibitively expensive. I looked for alternatives, and I was intrigued to find a surprisingly full-featured and very inexpensive DIY oscilloscope kit made by JYETech; I got mine at NKC Electronics. The oscilloscope is built around an ATMega64 CPU running at 16Mhz. The oscilloscope can sample AC or DC signals up to 5M times/second, and has a variety of other nice features which cover a broad range of hobbyist uses.

This blog posts details my experience assembling and testing this oscilloscope kit, at revision 062.

This is an average complexity project, you'll need to be pretty comfortable with soldering in pretty tight spaces (around 1mm between leads). You'll need a good soldering iron, or even better a temperature controlled soldering station -- I use the XYTronic 379, which is excellent and sells for around $50 (click on any image below to see a larger version):

You'll also need the following tools:
  • Rosin core solder
  • Helping hands -- very helpful for holding the board while you solder some small components
  • Flush cutter -- essential for trimming leads underneath the LCD to make it fit
  • Long nose pliers
  • Multimeter -- essential for testing intermediate voltages during assembly

The oscilloscope kit is tiny -- a little bigger than your palm:

In it you'll find the following (in clockwise order):
  • Instruction sheet -- this is one piece of paper with URLs to more information online
  • LCD screen
  • Bottom- and Top- cover panels
  • Mainboard
  • Components
The mainboard comes with all surface mount components pre-soldered, which is really nice: some of these components are extremely tiny (a couple of millimeters), so soldering them would have been a nightmare.

Important note: the mainboard the revision number printed in the upper-left corner -- if you are following these instructions to assemble your own oscilloscope, make sure that you have the same exact version otherwise the steps may not match and you can damage the board!

The components can be grouped into categories as follows. First, we have the actual electronic components

  • L7805CV voltage regulator (3-pins, with a screw attachment at the top)
  • Heat-sink for L7805CV
  • 1x 470uF capacitor
  • 5x 100uF capacitors
  • 1x 0.1uF capacitor (orange)
  • 1x 100mH inductor (2 pins, round, no other markings on it)
  • 1x 1N4001 diode (smallest component, white stripe at one side)
Then we have the switches and external connectors:

  • 9x push-button switches with 9x white caps
  • 3x slider switches (3 positions)
  • 1x RCA input jack
  • 1x power jack
  • 1x RS-232 male connector
  • 3x male connectors
The screws and pins that will hold everything together:

And, last but not least, the wires and connectors for the rudimentary probe you'll be using with your oscilloscope:

As I mentioned above, the documentation that comes with the oscilloscope is sparse, so you'll also want to open the following URLs in your browser, or print them out and have them nearby:
  • Detailed parts list: this lists all the parts above along with the names referenced on the schematic.
  • Assembly notes: this shows the final placement of the electronic components on the mainboard, referencing the parts by the names in the detailed parts list above.
  • Voltage reference chart: this shows the expected voltages you should see on the board after you assemble it; very useful for testing your work before you finalize it, as well as visuall verifying the placement of parts.
There is also a helpful discussion board where you can search for answers or ask questions.

First, some definitions:
  • The back of the board is the side that has all the chips and surface-mount components
  • The front of the board is the side that will hold the switches and LCD later on
Start by installing components on the back of the board. The first component is the power adaptor. The leads are large, so you'll want to use a higher temperature on the iron and a fair bit of solder on the other side:

Take the voltage regulator and bend its legs using the long nose pliers at the joint:

Align the voltage regulator with the heat-sink, place the legs through the 3 holes at the top of the board, run the screw through the hole in the heat-sink (it is threaded, so you'll probably want to use a screw-driver), and put a washer on the other side. Solder it, then use the flush cutter to cut it as close as possible to the mainboard.

Take the diode and bend its legs using the long nose pliers as shown:

Place the diode on the mainboard in the D3 slot, with the white stripe towards the right (this is essential: the diode only works in one direction). Solder it:

Insert the 470uF capacitor as shown. This is the largest capacitor by size, so you can't miss it. The capacitor is electrolytic, so it's essential to get + and - correct: the capacitor has a grey stripe on it that indicates the - (negative) lead; the other lead is the positive lead. Insert the positive lead in the hole on the mainboard that has a square shape, and the negative lead in the hole that has a round shape. In this case, the grey stripe will be pointing down, towards the power plug:

Insert the other 5x 100uF capacitors as shown on the schematic. They are all the same size, so order doesn't matter, but placement, just like above, does matter. The capacitors are denoted on the schematic as C10, C14, C15, C16, and C32, along with the position of the + lead.

Important note: the C14 position is wrong on the schematic, you will want to put it in reverse, that is to say with the + lead towards the right, and the grey stripe (- lead) towards the left:

Bend the leads on the ceramic capacitor (orange) as shown:

Then place it on the right side of the board:

Install the probe connector opposite the power connector. Just like the power connector, it has large leads, so it will need more solder than usual:

Optional: install the RS-232 connector in the middle of the board. This connector can be used to hook-up the oscilloscope to a PC and take screenshots of its LCD. If you'll never need this feature, you can skip installing this, it will also make your life easier later when you install the LCD:

Short the leads across D4 (green wire, circled in the diagram below).

Important note: this step is missing from the official documentation:

It's now time to power-up the oscilloscope and do a preliminary test. You'll need a 9V DC power supply, where the jack is center-positive and outer-negative. Plug it in, and, using your multi-meter, measure the DC voltage at the "+5V" hole indicated with a red arrow in the image above. The multi-meter should read 5V DC. If it doesn't, something is wrong, the most likely causes are:
  • You got the polarity wrong on one of the capacitors.
  • You got the polarity wrong on the diode.
  • One of your solder joints is loose.
Go back and carefully check your assembly, cross-reference with the schematic, and keep testing the voltage at the "+5V" hole above until it's right.

Once you get the voltage right, install another lead across the "JP1" connector, as shown below:

Check the "+5V" voltage hole again -- it should still read 5V DC. If it doesn't go back and check the capacitors and solder joints.

Now turn the board on its front and install the 9 push-button switches: their leads are springy, so they should snap into place, after which you can solder them. The orientation of the switches across their 4 holes doesn't matter:

Install the 3 slide-switches. Their leads are asymmetric, so they only fit in one direction:

You are now done with the mainboard for the time being. Pick up the LCD assembly and look on its back: you'll see a row of holes with labels:

Place the long strip of leads into these labeled holes, by inserting the shorter end into the holes (the longer end will go into the mainboard.) Solder them onto the LCD assembly, taking great care to keep the leads perpendicular to the LCD board, otherwise the LCD assembly won't fit right on the mainboard.

Important note: be sure to insert the strip of leads into the labeled holes, and not the other ones!

Important note: this is the hardest, most delicate part of the whole assembly. These holes are about 1mm apart, and the LCD board's holes are not pre-soldered. You need a steady hand and patience. The helping hands tool should come in handy here. A technique I found works reasonably well is to get one of the leads soldered correctly, holding the rest at the right position and angle; once you get that done, soldering the rest should be easier:

Solder the two other 2x lead strips at opposite ends of the row of holes opposite the one you just soldered. These leads are not electrical contacts, they just hold the LCD in place on the other side. Pay close attention to solder these in perpendicularly as well:

Using the flush cutter tool, cut one of the leads as shown in the image. This is because the hole into which it goes on the mainboard is obstructed by the heat-sink as shown:

Now solder the LCD assembly on the front side of the board. The LCD assembly can only go in one direction, don't force it.

Important note: you will need to use the flush cutter to cut all leads of components sticking out through the board behind the LCD very flush to the board, otherwise you risk shorting the LCD!

Screw together the two halves of the metal posts that will hold the panels above and below the mainboard. The shorter metal post goes on the front of the mainboard, the longer metal post on the back:

The final assembly should look like this:

Now comes the moment of truth: plug it in, and, if all is well, it will go through the boot sequence like this:

Place the white-caps on the push-buttons, and, using the 4 remaining screws, assemble the top and bottom panels like this. If you find that the push-buttons are sticky after installing the panels, either trim the white-caps with a knife, or loosen the screws a little:

You're almost done! The last step is to assemble the probe:

Strip the ends of the red and black wires -- these will connect to the alligator clips. Be careful to slide the shrink-wrap tube and alligator clip cover on each wire before finalizing the assembly:

Do the same with the larger black coaxial wire, and connect it to the RCA plug. Just like above be careful to slide the shrink wrap tube and RCA cover over the wire before finalizing the assembly. Connect the red wire to the inner coaxial lead (leading to the center jack), and the black wire to the outer coaxial lead (leading to the outer shield):

After everything is assembled, slide the shrink-wrap tubes over the connections and use a hair-dryer on high to shrink them into place.

Let's test that the oscilloscope can actual measure frequencies! Turn it on, and plug the probe into the RCA jack. Set the oscilloscope as follows:
  • Using the SEC/DIV button, set it to "1ms"
  • Using the LEVEL button, set it to "i"
  • Using the V.POS button, and the +/- buttons, slide the Y level down towards the bottom of the screen
Now connect just the red alligator clip to the upper-left corner hole on the mainboard marked "500Hz/5V pp" (this hole is also marked on the top panel with the same indicator):

The oscilloscope should show you a 500Hz square wave:

You might consider getting a better probe, I like this one.

Post a Comment