Posts Tagged electronics

3D Printering

Ok, confession time.  I succumbed to the 3D printing fad thing.  I know.  I made fun of 3D printer fanbois in the past, but we got one at work.  Using it for a bit forced me to realize that they’re actually pretty cool.

My kit of reprap parts!

My kit of reprap parts!

I asked my whole family to chip in for a RepRap Prusa i3 kit for my birthday (in September, to give you an idea of how behind I am).  It came relatively quickly, but there were certainly some issues.  For one, everything smelled –very strongly– of cigarette smoke.  Luckily, it was mostly isolated to the outside of the packaging.  Once I unpacked everything, it went away.

Aaaarg! Two sets of threaded rods!

Aaaarg! Two sets of threaded rods!

Then, I discovered that I got two sets of threaded rods!!  That wouldn’t be so bad, except that I didn’t get any smooth rods!  I emailed the company, and they got a replacement set of smooth rods in the mail right away, but I still had to wait a while.  In the mean time, I figured that 5/16″ is awfully close to 8mm.  I bought some 5/16″ stainless steel rods from the hardware store to keep working on the printer.  The 5/16″ rods are undersized for the LM8UU linear bearings (they’re designed for 8mm rods), so there was extra slop in all the axes.  Eventually, the 8mm rods came in the mail, and I installed them.

There were a few other minor issues.  For one, the melamine material that was used for the main frame was thicker than the laser-cut slots.  I had to carefully trim the tabs so that they would fit.  It may be difficult to understand what I’m talking about without photos, but all that’s important to understand is that there were some attention to detail issues.

After printing for a while, I noticed another problem with the melamine.  It’s also used in the frame that holds the build platform to the Y axis bearings.  The frame material wasn’t strong enough to level the platform.  When I lengthened the screws on the low sides, the frame would just bend downward rather than moving the platform.  I found a place in town that sold me a sheet of 3/16″x1’x2′ aluminum for $5, from which I cut out a replacement frame with my scroll saw.

Other than those problems, everything went together smoothly.  One interesting thing about RepRaps (the models that I know about, anyway) is that they don’t really include something to hold your spool on.  I almost think it’s to give people something to design and print out of the chute.  My solution was to build a frame using aluminum channel stock.  I started with just the upright part of the spool holder.  Then, the spool spun a bit too easily, and it would unspool and catch on things.  The angled portion holds a dry sponge with a hole in it.  This has the dual purpose of wiping the dust off of the filament and providing a small amount of friction.

The reprap is all finished.

The reprap is all finished.

The green adapters on the spool ends are just bearing holders that help the spool turn more easily.  It was the first thing that I printed.  Here’s a very short video of it working:

 The final issue I had was with the GFCI circuit in my office.  I can’t figure out why I have GFCI there, but I do.  To add insult to injury, my firewall/router/server is on the same circuit.  So, every time the printer trips my GFCI, it takes down the internet and generally causes havoc.  I pulled my hair out over this one.  I replaced my (very expensive) GFCI circuit breaker and the printers power supply.

Trying to measure GFCI current

Trying to measure GFCI current

In the photo above, I’m trying to measure the peak ground current from the printer.  The fluke is on the mA setting with peak hold.  This is the highest reading I ever got, and the circuit didn’t trip.  It’s my understanding that GFCI trips when there’s about 30mA on the ground circuit.  My assumption at this point was that the shunt resistance in the DMM was limiting the peak current, therefore no 30mA spike and no trip.

The problem persisted for sometime, and I began to suspect the GFCI breaker.  I went to an electrician store, and the guy said that they can wear out.  After I replaced the circuit breaker, and $50 later, the problem got worse!  It would trip even when the printer wasn’t plugged in!  At least then, it was no longer an intermittent fault.  Now that I could reliably cause the fault, I at least had hope for isolating it.  I unplugged everything on the circuit and plugged in things one-by-one.  I turned out that a cheap power strip (the same kind as in the above photo) was the culprit.  Boooo.

Any way, I’m now a 3D printing convert.  But I promise I won’t be annoying about it. 🙂

, , , , ,

No Comments

Support for the Rafael Micro R820t tuner in Cocoa Radio

R820t tuner on a rtl-sdr compatible dongle, from eBay seller CosyCave

Relating to the rtl-sdr work that has been done, the E4000 tuner was the standard barer for a long time.  However, Elonics has discontinued this part, and it’s becoming difficult to find.  The popularity, and scarcity, of this part has encouraged sellers to offer products claiming to be built with the E4000 and are not.  Luckily, someone discovered the code for using the R820t tuner in the Linux V4Lin drivers.  They ported this code into the rtl-sdr source maintained by osmocom.

I just finished porting their code into Cocoa Radio.  Now, it’s possible to use my software with both the E4000 and the R820t.  On startup, Cocoa Radio will automatically detect which tuner you’re using and perform the appropriate actions.

It did take a little while to finish this work, and there are several more tuners out there.  If you are desperate for support of a specific tuner, you can donate a device for the cause and I’ll try to support it.  By the way, Softshell uses the same code for tuning as Cocoa Radio, if you recompile softshell, it should include this new code.

All the relevant code and binaries are, as usual, available at github.  Make absolutely sure that you also update the softshell repository!

, , , , ,


Softrock application available

Here’s a compiled executable, including the rtl-sdr library, for those that don’t want to get the source on github and compile it.

Also, if anyone wants to design a logo, it would be much appreciated!


, , , ,


Weird return value discrepancies between Softshell and RTL-SDR

I’ve made significant progress porting over the rtl-sdr code.  I added printfs to every function that interfaces with the USB port so that I can compare what happens.  Everything seems normal, up until the gainControl function.  Once there, the returns from my application are usually about one digit off of the rtl-sdr code.  If anyone has any ideas, I’d love to hear them!

Link to the comparison spreadsheet.

, , ,


The enemy of any analyzer: Phase Noise.

That looks neat, but it’s very, very bad…

If there’s one thing that I was blissfully ignorant of before trying to build a spectrum analyzer, that is now an annoyance and borderline obsession, it’s phase noise.  Phase noise is exactly the same as any other kind of noise, but unlike noise on a DC signal, phase noise is mode like tiny variations in the frequency of the signal.

To get a little more specific, think about phase as a quantity that describes how far along the sine wave we are at any given instant.  It can be described in degrees, radians, or even if you’re a little radical, tau radians.  The idea is the same.  Phase increases until it “rolls over” at the end of the cycle.  It looks a bit like a sawtooth wave, assuming that we’re discussing a constant frequency, unmodulated wave.  Hopefully you believe me that phase noise looks just like noise superimposed on the sawtooth-shaped phase ramp.

Phase related to sine

I think the graphs above helps to illustrates the relationship between phase (above) and a sine wave (below).  I’ve re-scaled the phase so that it goes from zero to one over the range of one whole number.

In the frequency domain, phase noise is a little easier to understand, and see.  The graph at the head of this article is an extreme example of phase noise.  Really, there are two kinds of phase noise here, and one of them we can do something about.

PLL example (From a Linear Technology data sheet)

I tried really hard to find some nice graphics to use to describe, simply, the basic operation of a PLL-based oscillator.  The best I could come up with is the above diagram.  This was lifted from the Linear Technology LMX2326 PLL IC.  This is the same (or damn near) as the PLL chip that’s used in the analyzer.  The bottom left corner is the oscillator.  All it does it generate a single frequency set by the voltage coming into pin 6.  On the PLL chip, pin 2 is the output from the “charge pump,” which is how the PLL sets the tuning voltage.

PLO1 Schematic (by Scotty)

Unfortunately, the PLL in the spectrum analyzer isn’t this simple (if you can call an normal PLL simple!).  In the center, near the top, notice the Op-Amp.  The high-side supply to this amplifier is +20 volts (at least).  The reason for this is as simple as that’s what the VCO (voltage controlled oscillator) needs.  It isn’t possible for the PLL to produce voltages like this, so we need this extra supply.

VCO power supply noise

Now, the question is: “What happens when there’s noise on the +20 voltage supply?”  The waveform on the oscilloscope above shows about 20mV of noise on the 20 volt supply.  The frequency of this noise is about 20kHz. It’s no coincidence that the spacing between the peaks in the comb-like plot is about 20kHz.  What’s happening is that the noise on the 20 volt supply is literally modulating the output.  Incidentally, that’s exactly what you do if you want to frequency modulate something.

Now that we know what the cause is, what can we do about it?  If we eliminate that noise, we can fix the problem.  I had made a second 20 volt supply, and used cheap capacitors.  Apparently, when using high voltages (relatively speaking) the amount of capacitance decreases in cheap, small, ceramic capacitors.  I went back to the first supply I made, and added even more capacitance.

Better +20 volt supply

The lower trace is the new +20 volt supply, and it’s peak-to-peak noise voltage is about 3mV.  But the proof of the pudding is in the eating, so how does it affect the phase noise?

Much improved phase noise

It squashes it like a bug!  The above plot is almost textbook for phase noise.  The large peak in the center is representing the width of the final filter (I’ll get to that in a later post) and the skirt is caused by traditional phase noise.  If I zoom in to the center of that plot it’s easier to see:

close in phase noise

Here, I’ve highlighted another common cause of phase noise: PLL loop bandwidth.  This is the bandwidth of the filter that smooths out the pulses that come out of the PLL chip.

That’s all I have for now…  I’ve tried to make this topic, which is very technical and dry, interesting and accessible to those that haven’t spent the last 5 years trying to build a spectrum analyzer.  I hope you’ve enjoyed it.

If you want a much more in-depth and technical analysis, see Scotty’s website.


, , , , ,

No Comments