Posts Tagged ‘electronics’

VORs and SDRs part 3 supplemental materials

February 27th, 2015 15 comments

I recently posted part 3 of the VORs and SDRs series. In this video, I look into the instrument landing system (ILS), and how it works. I just uploaded the raw baseband data and GNU Radio companion document for anyone that wants to play around with it:

GNURadio Companion GRC file
Baseband data

My new Chinese laser cutter!

January 10th, 2015 No comments

For my birthday, my entire family chipped-in and gave me most of the money to buy a (relatively) cheap laser cutter directly from China. I had seen several Hack-a-day articles about these machines, and I’ve got experience with 3D printers, so I thought it was something that I could handle. Boy, did I have a lot to learn.

The path the slow boat from china took

The path the slow boat from china took

To begin with, I looked around on eBay and Alibaba. I noticed that 90% of the ~$1000 units are almost identical. There are occasional small differences such as pointing laser, whether it has a spring loaded “work clamp,” whether it has a raising-lowering bed, etc. I found one that claimed to have a larger bed than any other that I’d seen (mistake #1). I don’t know why I accepted that a machine that looked like every other machine out there would have magically increased the work size, but I did, and it doesn’t.

Because I was mentally set on this machine, I was willing to accept the shenanigans of the seller (mistake #2). The trouble began when their “free shipping to the USA” became $200. I thought “That’s kinda annoying, but not the end of the world.” The shipping charge was on par with other vendors. The next problem became that the $200 shipping was by boat, and F.O.B. (Mistake #3). Alibaba doesn’t support shipping by boat, and at this point the vendor and I agreed to leave the relative safety of Alibaba (Mistake #4). I requested a refund of my Escrow and it was granted.

A quick note about how Alibaba works, for the uninitiated. Alibaba is a marketplace, like eBay. Unlike eBay, however, Alibaba provides some additional protections to the buyer, and less so, the seller. When you purchase something from a vendor and make a payment you pay Alibaba directly, and that money is put into an Escrow account for the transaction. At this point, the Seller is assured that the money is there and they are guaranteed payment if they hold up their end of the deal. The seller, then, ships the product with an Alibaba approved carrier (like DHL, EMS, etc.). When the buyer receives the product and decides that it was accurately represented and meets expectation the seller is paid and the escrow is closed.

If you decide to leave Alibaba, it’s the wild, wild … east? The vendor really wanted to be paid by a wire transfer, which is the system that you see in spy movies. Bank account number, routing number, etc. The thing about a wire transfer is that there are NO protections. That money is gone, forever. If the vendor is feeling generous they may give it back if there’s a problem, but there are no systems in place for you to dispute it. There was no way I was going to go for that. I got them to agree to accept PayPal, which for all their faults does provide some buyer protections. Paypal makes their money by levying a surcharge on business transactions; the only way I got the vendor to agree to this was by paying the surcharge myself. In my mind, it was a worthwhile investment in insurance.

Ok, at this point I’ve paid the vendor and they’ve sent me vague information about when the ship will be leaving the Qingdao port. Then, one day I get an email from them about filing an ISF (10+2) form. I had no idea what this was, and I literally called the Port of Portland to ask them. They basically laughed at me. Apparently, the ISF is a form for a system that was introduced after the Sept. 11 collective mindless panic. Someone had the thought along the lines of “zomg, someone could put a bomb in a shipping container and blow up an entire city!” So, of course the government intervened and invented yet another complicated, expensive, process that can only really be done by a customs broker.

Now I need to find a customs broker. Off to Google… Whelp, no one has a ratings site for customs brokers. All my usual methods for deciding on a service provider fail. I find myself at the port of portland website and staring at a list of what seems like a hundred brokers. I literally choose one at random (mistake #5). I call their number and someone assures me that I’ve got plenty of time to file (Did I mention that you have to file the form three days before the ship leaves the last foreign port, and that failure to comply can be a $5000 fine?). I never hear from him again. Two days later I get a call at 3:00am from China. They’re calling to yell at me about the fact that my form hasn’t been filed and that I needed to do it right now. I calmly (lucky for them, my 1-year old wasn’t woken) explain to them that no one is awake or willing to take my calls at 3:00am. I’m not happy. The next morning I googled for “Customs broker portland oregon.” I choose the first link. My thinking is that google’s magic algorithms must know something more than random guessing. The new company is fast, responsive, and mostly a pleasure to work with.

Importing something substantial (I’m not sure what makes something substantial, but stay with me) is an expensive affair. The ISF form costs $35 to file. Great. Wait, I also have to become a customer of the brokerage company, $50. I need to have an ISF bond, $100. Don’t forget the customs bond premium, $45. Someone needs to enter the customs yard, $125. I haven’t even mentioned duty yet (this is what most people think of when importing), $26.50. By the way, any device that “emits radiation” has to be FDA accepted (they mean all radiation. Yes, I know that LEDs emit radiation, so do radios, you get my point), that’s another $35. So far were looking at about $400 in addition to my $200 shipping. Awesome.

You can see in the image above that the boat is going to Long Beach, California. Cool. I don’t live in California. The whole time I’ve been talking to them I’ve said Port of Portland perhaps a dozen times. I’m panicking a little. About two days before the boat is set to arrive in Long Beach, I get a call from a company at the Port of Long Beach. They were wondering when I would pay their fees. What? I wasn’t aware I had contracted with anyone at the Port of Long Beach. They had asked me about who my customs broker was. It seemed like this was the kind of thing that they could bill my customs broker for, and I had them do that. These guys charged another $160 of fees, including my favorite, the “Clean truck fee.”

Now, at this time (October 2014, and persisting now, into January 2015) there is a major bottleneck at the Port of Long Beach. My delivery was delayed a bit over a week because of this.

I was curious how I could get a shipment delivered to Long Beach, and have it go through customs in Portland. Apparently, it’s possible to move merchandise across the country that has not gone through customs. It just has to go to customs before it goes to the customer. That seems strange to me.

Anyway, the truck eventually got my package to Portland, and I drove up one day to get it (I had 2 days before I’d start getting charged warehouse fees). They put it on a forklift and surprisingly gracefully placed it in the back of my 4-runner.

All told, the cost for the machine was $700 + $200 shipping + $667 in customs fees. I feel a bit nauseous typing that out. Even more so when I add them and have to say that it was $1567 in total. Though, when I remember how much a decent laptop costs, I feel a little better. :)

The rest of my laser-cutter adventures were documented in video. Please enjoy the YouTube playlist below:

Laser water cooling, part 1: Peltier element theory

September 8th, 2014 No comments

I just ordered a laser engraver/cutter from China.  While I wait for the slow boat to come into port, I thought it would be a good idea to start preparing the infrastructure.  These products don’t include any hardware for the required water-cooling, other than a submersible pump.  Most people just say “just have a few gallons of water circulating, and you’ll be fine.”  I say “if it’s worth doing, it’s worth overdoing.”

In the spirit of overdoing it, I remembered that I had a peltier element-cooled fridge in my lab for a while, and that the parts were still kicking around somewhere.  Peltier coolers are really neat.  They can use an electrical current to drive a difference in temperatures on the opposite plates.  I found an interesting page with a simplified model for calculating their performance across a range of conditions.  It’s interesting to note that you can’t just drive it harder to move more heat.  Because the modules are consuming energy themselves, self-heating can (and often does) overwhelm the coolers ability to move heat.  After spending a couple days understanding the models, I discovered an error in the page, so I’m going to re-post corrected equations.

Computation of T1

This equation computes the temperature of the “cold side” of the cooler.  The model depends on several variables:

I = Drive current (Amps)

Rp = Cooler resistance from the data sheet (Ohms)

Q1 = Thermal load that we’re trying to cool (Watts)

C1 = Thermal conductivity from load to ambient (Watts/°C)

Cp = Thermal conductivity through the peltier (Qmax/ΔTmax) from the data sheet

Ch = Thermal conductivity of the heatsink on the hot side (Watts/°C)

T1 = Temperature of the object being cooled (°C)

T3 = Temperature of the ambient environment (°C)

I’m going to ignore P.  For now, it suffices to say that it’s a constant that models the peltier junction’s performance.  (Watts/Amp)

The article that I got this model from doesn’t really explain the terms at all, so I’m going to try to interpret the pieces of it.  First of all, the T3 term references the entire model to ambient.  If you used something else as a counterpoise, I’ll call it, to the peltier you could remove this term and model it.

The middle term models the heat flow out of the hot-side heatsink.  The numerators of this term are the thermal load (Q1) and the self-heating from the peltier cooler’s current (see Ohm’s law for the inspiration of this).  The entire term is divided by the thermal conductivity of the heatsink, Ch.  Thermal conductivity is a very useful specification, as it tells us the °C across the device per Watt.  In the case of a heatsink, that is referenced to ambient.

The first term models the heat flow from the load through the peltier.  Again, there is the Q1 term, as we have to get the thermal load through the device.  Second, we have half of the peltier’s self-heating.  My assumption is that only half of the peltier’s self-heating has to travel all the way through the device.  Finally, the -P*I term models the active cooling (the point of this whole thing).  These are all divided by the combination of the thermal conductivity of the load-peltier junction and the peltier’s internal thermal conductivity.

The upshot of this, is that we can model the performance of our system built around a given peltier junction given load, heatsink performance, and ambient temperature.


Now, let’s talk about P.  We can derive P entirely from information commonly found in peltier junction datasheets.  There really isn’t much more to say about this, just plug in the values…

The module I'm working with

The module I’m working with

Now, let’s make all of this a little less abstract…  The image above is the module that I’ve salvaged.  It’s easy enough to lookup the model number and get the data sheet.

Specification table

Specification table

Using the specification table, directly from the data sheet, we can calculate P to be 14.47 (for 25°C).  For now, let’s also choose some values for the other parameters.  Let’s say we want to cool a load that is producing 10 Watts, with a rather poor heat sink that has .2 Watt per °C of conductivity (would be listed as 5 °C per Watt as resistance).

T1 heat versus amps, with simple heatsink (blue) and ambient (green).

If we graph T1 versus drive current, I, we can see that the optimal current from the cooler is 0.8 Amps (red line).  Unfortunately, if we compare it to Q1/Ch (which would happen if we just put a heatsink on the load) it’s almost 6 °C hotter than without the peltier cooler…  boo.   The laser is estimated to produce about 200 Watts (20 times more than the 10 Watt example) of heat.  The problem, ultimately, is that the hot-side heatsink matters.  A lot.

T1 heat versus amps, with simple heatsink (blue) and ambient (green). With a better heatsink

T1 heat versus amps, with simple heatsink (blue) and ambient (green). With a better heatsink

Now, what happens if we find a much better heatsink?  They’re expensive, but you can find .1 °C per Watt heatsinks on Digi-key.  This would be 10 Watts per °C in terms of conductivity.  With the better heatsink, the cold side is down to -17 °C!  The heat sink is more than able to shunt the heat from the load and the cooler.

All that is obviously super-awesome, but what if we want to calculate what the ideal drive current is for a peltier cooler?  The Itec equation, above, will give us this information.  We still need the P and Rp terms from the data sheet, and the thermal conductivity of the peltier and the heatsink.  But, you’ll notice that thermal load and the ambient temperature are not factors in the equation.  Therefore, the ideal drive current (and, therefore maximum temperature drop) are not affected by those factors.

I hope this has been at least somewhat interesting.  Stay tuned for part two, where I investigate whether it’s really feasible (practically and economically) to move over 200 Watts with peltier elements.  Also, I’m planning some research into how to characterize the efficiency of radiators in liquid cooling setups.  If you have any insight, please leave it in the comments.  Also, I started to write a mac application to model peltier cooler systems.  I probably won’t finish it unless it seems like something people would want.  Leave messages in the comments if you would pay a few dollars for something like that.

BladeRF first impressions

March 19th, 2014 2 comments

BladeRFI recently got a pair of the Nuand BladeRF SDR transceivers, and I’ve got about a days worth of experience with them.  Of course, first thing’s first, I had to print the BladeRF Coaster by Piranha32.  This is especially so because there are a few large tantalum-looking capacitors on the bottom.  Before I had this printed, I used some small machine screws with bolts and made a quick set of standoffs.  The package came with a nice blue USB3 cable and a pair of SMA jumpers; I assume these would go to their transverter, which I don’t have, but they’re nice to have anyway.  There aren’t any instructions in the box, but for a product like this the assumption is that the user knows what they’re getting and how to use it.  This is a reasonable assumption, and I had no problem finding all the relevant documentation.

I’m an ardent mac user, and this sometimes poses a problem while using specialized hardware and applications.  It wasn’t until the last few months that the recent versions of GNURadio worked through MacPorts.  Luckily it does now, as does all the BladeRF software.  Going from nothing to a working software environment took minutes.  One thing that you have to make sure and do it download the most recent FPGA code, as you’ll have to re-load it every time you boot the BladeRF.

All software defined radios have an Achilles’ heel.  If the DC offset of the I and Q baseband signals isn’t minimized a constant “tone” at zero Hz will be up-converted to whatever frequency the final spectrum is.  Also, if the relative magnitude and phase of I and Q aren’t matched (and precisely 90 degrees) there will be a image of the desired signal mirrored across the up-converter frequency.  The BladeRF wiki has a short article that shows how to measure the correction factors to use to minimize these effects.  This article documents my attempt of deriving the correction factors for one of the two boards.

To start, I tuned the board to 450MHz.  Then, I decided that a 100KHz sine would be appropriate as a baseband tone.  What happens is that, in software, the 100KHz tone is generated, then it is up-converted to 450.1MHz.  The spectrum below is the result of that test without any corrections applied.  The spur resulting from the DC error is about 25dB down from the desired carrier, and the image is closer to 35dB down.  It’s not really that great.

blade uncal

Playing around with the values according to the instructions, I was able to improve these results quite a bit.  The DC error is now 58dB down from the carrier (ignore the marker table) and the image is almost 63dB down.  This is pretty respectable.  Now, there is another troubling question.  What’s up with the spikes in the phase noise?


I asked on the #bladerf room on freenode, and they agree that it’s not normal.  The spikes are exactly 7.8 KHz apart, so I would start looking for things that happen at that frequency.  I wish I had measured how distant the largest one was from the carrier and zero.  That could have been good to know.

phase noise

Oh, wait, I did :).  The main tone is 63KHz away from the main carrier and 37KHz away from zero.  There was some speculation that it could be artifacts from the quantization of the software-generated sine wave or that the tuning algorithm could be at fault.  For fun, I ran the same test without generating any sine wave at all, so all you’re seeing is a large zero tone from a constant DC offset.  I do think that the quantization explanation makes sense because that would manifest as phase noise, and the spikes are centered about the modulated tone, rather than the zero-spur.

constThe same artifacts should still appear there if there was any kind of a problem with the power supplies of the board, for example.  It seems very clean, and I’m happy with the phase noise performance of the board.  You’re probably seeing the phase noise of the rigol in this plot rather than the BladeRF.

In all, so far, I’m very happy this these.  I’m very excited about their potential.


Skyworks 65116 update

January 9th, 2014 No comments

It has been a while since I played with the Sky65116 amplifier boards that I built and wrote about.  Since getting my own spectrum analyzer, I’m now able to make much better absolute measurements.  The DSA-815-TG analyzer is specified as having 1dB of uncertainly across the span, and the SA that I have at work is essentially uncalibrated.

Video modulator output

Video modulator output (click for enlargement)

Not only do I now know that the absolute power out of the video transmitter at the fundamental frequency is about 5.5dBm, I can also see the first and second harmonics.  I don’t know why I didn’t see them with the other analyzer, but they are disturbingly large.  I believe the FCC requirement is that these harmonics should be more than 40dB below the fundamental.  By this criterion, the transmitter should not even be sold in the US.

The SKY65116 amplifier has close to 36dB of gain, and a 1dB compression point of 32.5dB.  The 1dB compression point is specified as the output power level at which the gain is reduced by 1dB.  The easiest way to show this is with the graph from the Sky65116 data sheet, shown below.  You can see that as the output power begins to approach 32dB gain drops quickly.  The goal is to not force the amplifier to operate in this region.  If you do, you’re likely introduce harmonic distortion and other nasty nonlinear effects (i.e. intermodulation products).

Gain vs. Pout curve

Gain vs. Pout curve

So, knowing that the output is +5.5dBm, and we want about +30dBm out of an amplifier with a gain of 36dB, we need to introduce 11.5dB of attenuation (30dBm – 36dB – 5.5dBm = -11.5dB) between the transmitter and the amplifier, at a minimum.  It’s easy to make 14dB attenuators with standard value resistors (4×150 ohm and 1×120).  I’ve been playing around with QUCS a lot lately, so I’ve provided a model for the attenuator.  It’s just about the most boring S-parameter model you’ll ever see…  Perfectly flat response at -14dB, but that’s what we’re after.

Simple 14dB attenuator model

Simple 14dB attenuator model

A while back, I had a bunch of these simple 5-pole filter PCBs made up.  I just left them blank until I needed them, and I made two of them into 14dB attenuators using the circuit above.  I had two extra poles, so I filled one with a 0 ohm resistor and the other with a 1uF DC-blocking capacitor.  The capacitor reduces the low frequency performance, but only less than about 1.5MHz.  It’s worthy the trade-off in my mind.

Constructed attenuators

Constructed attenuators

I went ahead and covered one of the attenuators with copper sheet just to make it more of a completed package.  I’m sure I’ll need to use it many times in the future.  I left the other open so I could unsolder it and make it something else if needed.  An interesting thing happened when I installed the cover.  The small ripple in the attenuation (around 500 MHz, see below) occurred only after I installed the cover.  I assume this is due to parasitic capacitance between the components and the copper covering.  It’s still only about 1dB of ripple, so I’m satisfied with it.

14dB attenuator performance

14dB attenuator performance

Anyway, back to the amplifier.  I’ve now got about -8.5dBm going into the amp ( +5.5dBm – 14dB), so with its 36dB of gain, I should expect to see +27.5dBm out of the amp.  That’s getting very close to the maximum input power on my SA (+30dBm).  It’s always better to be safe with these things, so I used the other 14dB attenuator between the amp and the SA.  Now, I should expect to see +13.5dBm on the input.  I maxed-out the input attenuation on the analyzer (another 30dB) and gave it a shot.  Note that the internal attenuation is calibrated out of what’s shown on the display, and I told the SA about the other 14dB of attenuation, so the power values shown on the display are referencing the amplifier’s output.

Transmitter after amplification

Transmitter after amplification

In the above image, you can see that we’re getting 27.5dBm out of the amplifier!  I love it when a plan comes together!  This is the value I calculated, right on the nose.  I promise that I didn’t work the math backward! :)  Again, it’s so painfully obvious that the transmitter is AM, rather than the VSB signal that it should be.

Close-up of the signal

Close-up of the signal

Now, just for fun, let’s dive back into the video signal coming out of the transmitter.  In the image above, I’ve put some markers on the various carriers present in the signal.  The luma carrier is in the center at 433.85MHz, which is where we expect it to be.  Marker 2 is at 437.45MHz, which is 3.6 (let’s call it 3.57) MHz away, matching exactly where the chroma carrier is supposed to be.  There’s no audio carrier, which isn’t a surprise because there’s no audio, though I wouldn’t be surprised to see the carrier.  Marker 3 is 19 MHz away; I have no idea what this is or why it’s there.  It’s not supposed to be.  Same with marker 4.  Oh, well…  that’s what you get with a shitty transmitter.

amplifier gain v. frequency

amplifier gain v. frequency

Now, what about those pesky harmonics?  The Sky65116 is a 390-500 MHz amplifier, so my hope is that the reduced gain by the first harmonic will attenuate the harmonics enough to bring them into compliance.  The graph above is the gain v. frequency graph from the data sheet.  It’s neither encouraging nor discouraging.  It’s difficult to infer what’s going to happen at 800 MHz when the graph stops at 500 MHz.  In the image below, it appears that I lucked out.  The first harmonic is 42dB down from the fundamental.  If I were selling a product, there’s no way I would send this out for compliance testing.  It would just be too risky, I’m not that confident in my measurements.  By my math, it would cost less than $2 in parts (single unit quantities) to make a decent low pass filter.  That’s the right thing to do.  When I modeled it (in QUCS, again), I calculated that the harmonics would be within compliance even without the rolloff of the amplifier.  With the rolloff, the harmonics would be well below the noise floor.

Harmonics after amplification

Harmonics after amplification

I’ve had a ton of fun redoing this experiment with my new spectrum analyzer.  I’m going to write lots more about the analyzer in the future, and I’m really looking forward to it.  Coming soon is an exploration of the skyworks low noise amplifiers.  Between these two products, I expect to have a solid video link over 1000 feet or so.