greatscottgadgets / hackrf

low cost software radio platform
https://greatscottgadgets.com/hackrf/
GNU General Public License v2.0
6.27k stars 1.49k forks source link

USB(?) interference via antenna from the lowest frequencies to above 190 MHz #544

Closed alinanorakari closed 4 years ago

alinanorakari commented 5 years ago

Steps to reproduce

  1. Connect Ant500 and extend it
  2. Connect HackRF One with stock USB cable that came with HackRF One
  3. Tune GQRX or GNU Radio to 90-100 MHz
  4. Set gain to 24 dB IF and 30 dB BB
  5. Observe FFT or waterfall

Expected behaviour

smooth noise floor, random irregular noise pattern if any

Actual behaviour

regular spikes and spurs and static noise characteristics as can be seen here

screenshot 2018-11-05 at 03 56 21

Also very distinct noise around 480 MHz where USB 2 has its clock frequency

screenshot 2018-11-05 at 03 58 07

Additional info

The strength of both the regular noise patterns and the peaks around 480 MHz can be influenced by covering the cable with my hand, where covering the cable makes the noise pattern more prominent but reduces the intensity of the peaks around 480 MHz.

The noise is not visible when no antenna is connected, but it will always roughly scale with the strength of FM reception, even with antennae that are not tuned to the FM spectrum.

The noise will also entirely disappear when connecting HackRF to analog cable directly, even though the FM stations on there have a similar signal strength to the ones picked up via antenna. The noise floor is then smooth as expected

The computers I tested with are:

Noise intensity and characteristics are very similar on both machines

Version information

Operating system:
MacOS 10.14

hackrf_info output:

hackrf_info version: unknown
libhackrf version: unknown (0.5)
Found HackRF
Index: 0
Serial number: 000000000000000087c867dc2b53b45f
Board ID Number: 2 (HackRF One)
Firmware Version: 2018.01.1 (API:1.02)
Part ID Number: 0xa000cb3c 0x006e475a

Gqrx version 2.11.5
GNU Radio 3.7.10.1

alinanorakari commented 5 years ago

I've purchased a 20cm shielded USB Type C to Micro USB cable in an attempt to reduce both length of the cable and amount of plugs in the hopes it would make the phenomenon better.

Yikes! It makes the problem about 20 dB worse than the USB Type C to USB Type A adapter + USB cable included with HackRF.

screenshot 2018-11-05 at 19 26 21

Any suggestions as to how I can remedy the interference problem would be greatly appreciated.

unixpunk commented 5 years ago

Have you tried this with another antenna yet? Or an antenna (connected via cable) that is not near the device/computer like the ANT500 is by its nature?

alinanorakari commented 5 years ago

Yes. I've tried an antenna stand with 2m RG58 cable that came with my NooElec NESDR SMArt kit, similar to the one pictured here: sku_5188_1

I made a conscious effort to stretch the cable as far as possible with the computer and the HackRF across the room

I've also tried walking around with this solution in hand using the telescopic antenna. Curiously the noise always seemed to increase/decrease with the FM signal strength.

I can very easily and repeatedly demonstrate that the noise gets considerably worse as soon as I put my hand on the USB cable. This screenshot shows me repeatedly touching and letting go of the USB cable. The same doesn't happen when I touch the coax cable

screenshot 2018-11-06 at 04 10 39

P.S.: This screenshot is with the 2m coax cable attached and the NooElec telescopic antenna at the other end of the room

alinanorakari commented 5 years ago

Another curious thing I've just observed:

There is one radio station in particular (the one I'm tuned to in all my screenshots) that will come in worse when there are no cables near the USB cable connecting the HackRF. As soon as there is another cable (e.g. my laptop's power cord, connected to the laptop or not) running parallel to the USB cable the HackRF is connected with, the reception of this particular weak station gets noticeably better, raising it further above the noise floor.

screenshot 2018-11-06 at 04 35 48

This suggests to me that the USB cable of the HackRF itself acts as a kind of antenna. Would I be correct in that assumption?

alinanorakari commented 5 years ago

Another test: This is me touching the USB cable first diectly at the computer, then increasingly closer to the HackRF in steps of about a hand's width apart. You can see the amplification of the interference gets worse the closer to the HackRF I touch the USB cable. None of this can be seen when I touch or cover the HackRF directly with my hand, or when I touch the coax cable.

screenshot 2018-11-06 at 04 30 24
cjheath commented 5 years ago

Try with the HackRF and laptop sitting on a metal bench (or kitchen sink?) to provide capacitive ground coupling between them. This will reduce pickup via the USB cable. Also, is your laptop running on batteries or power pack, and have you turned off other potential sources of local interference?

alinanorakari commented 5 years ago

Capacitive ground coupling via a kitchen sink improved the noise significantly! (Moving away from any possible RF interference did nothing, I tried in the middle of a cemetary)

screenshot 2018-11-06 at 18 21 08

Alright! What can I do to make this effect more permanent? I hope I don't have to carry a sheet of metal with me everywhere I want to use my HackRF.

alinanorakari commented 5 years ago

It makes no difference if the laptop runs on battery or is plugged into wall power by the way, forgot to answer that part

alinanorakari commented 5 years ago

Dang, I'm sorry I have to drag this out, but the previous test was with the sink at work.

The sink at home as well as a metal baking tray have no effect. If anything they make it worse

N8AUM commented 5 years ago

Buy one of those cheap usb dongles and see how it reacts.Good luck,N8AUM

Sent from Yahoo Mail on Android

On Tue, Nov 6, 2018 at 12:26 PM, Peter Marquardtnotifications@github.com wrote:
Dang, I'm sorry I have to drag this out, but the previous test was with the sink at work.

The sink at home as well as a metal baking tray have no effect. If anything they make it worse

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

alinanorakari commented 5 years ago

I have an RTL-SDR dongle. It exhibits the same kind of interference.

Something else I just tried: I got my fingers on an FM band stop filter, and it eliminates the FM signals as expected, and also the interference along with them. That's both with the ANT500 and with the telescopic antenna connected via 2 meters of coax cable.

I've also tried on a third computer now, a 2016 MacBook. The interference looks the same there as well. The interference also looked almost the same at work on my MacBook Pro, several km from here. I'm not the only one using Macs with HackRF though, so this can't be a Mac thing, right?

alinanorakari commented 5 years ago

Just out of curiosity, how does the FM band look for you people around 97 MHz with the amp off, IF gain on 24 dB and BB gain on 30 dB?

unixpunk commented 5 years ago

I checked this last night and for me the band looks similar to your screenshot for when you put things on the sink at work. Quiet except for the actual stations, no spikes every N khz or whatever. I'm running PC though and my HackRF is in a metal case that houses the portapack with it. I also don't have the original cable, I use a cable from monoprice that has a built in ferrite choke and gold-plated connectors.

alinanorakari commented 5 years ago

My HackRF is in the plastic enclosure it's usually sold with. Do you think things could improve with it in an extruded aluminum enclosure?

unixpunk commented 5 years ago

Do you have the shielding/cage added to the hackrf board? I would suggest doing one of the two, either add the cage/shield or get the metal case. One option is more work but far less money than the other. (I have both)

alinanorakari commented 5 years ago

I'm prone to damaging electronics when I do fiddly work on them, so I'd rather shell out extra money for the enclosure and not worry about any damage I could deal. Installing the shield sounds hard

cjheath commented 5 years ago

Shielding is unlikely to improve things, because you're seeing conducted interference from the USB, and from the whole shebang not being earthed. There are two things you should do about it:

For a CMC, you can simply take the antenna co-ax two or three turns through a clip-on ferrite, or pass the connector and cable several times through a toroid if you have one large enough (make sure it's ferrite not iron core though). The CMC allows your antenna to pass what it sees (from its local ground) into the PC+HackRF, even though those are on noisy ground.

You can also try a CMC on the USB lead, or just use a better one that has a choke built-in. That'll isolate a noisy PC from the HackRF (which still needs to be earthed)

cjheath commented 5 years ago

If you want to know whether a shield will help, try the HackRF inside a cake tin (cut small holes for the USB and antenna leads). But this is really only for externally radiated noise, probably not your issue. The on-board shield protects the receiver from noise radiated from the rest of the HackRF.

However, your symptoms are caused by a noisy PC/laptop (noise on the USB ground), and lack of an earth on the HackRF. Isolate the HackRF with a CMC and earth it, use a CMC on the antenna too if you can, and you'll find the problem vanishes.

alinanorakari commented 5 years ago

I tested if I could find surfaces in the house and in the street where reception would get better like on the sink at work, but all I got was various patterns of interference

I'm posting these in the hope that someone recognizes a pattern that suggests a solution

HackRF and Laptop on the hood of our car (signal went crazy)

screenshot 2018-11-06 at 23 12 17-hood

In the middle of the street holding the HackRF an arms length away from the laptop, then close

screenshot 2018-11-06 at 23 06 02-street

On a solid wood surface

screenshot 2018-11-06 at 22 50 10-solid-wood

Putting it and the laptop onto the metal railing of our balcony (signal went semi crazy)

screenshot 2018-11-06 at 22 49 26-railing

On various surfaces in the kitchen (sink, stovetop, press board work surface)

screenshot 2018-11-06 at 22 48 31-kitchen
cjheath commented 5 years ago

You can stop with the location tests! I suggested the sink because it's probably earthed (your home must have plastic plumbing) to see if it looked like conducted or radiated noise. You clearly need an earth, and to isolate your HackRF from the noisy laptop.

alinanorakari commented 5 years ago

Thank you @cjheath As english isn't my first language, with station earth you mean earth as in ground from e.g. plumbing, right? Where would I connect it to? The SMA thread?

alinanorakari commented 5 years ago

If I understand the schematic all three SMA connector threads share common ground with the rest of the device, so I could make a grounded SMA connector minus the center pin and connect it e.g. to clkout, correct?

cjheath commented 5 years ago

Plumbing is a good start, otherwise your house power earth (connect a single short earth wire into a 3-pin socket). The best place to connect on the HackRF is the shield of the antenna input. You could solder an earth connector to the base of the antenna SMA socket.

First though, I'd be looking for a USB cable with a CMC built-in (the lump in the cable). Does yours have this?

alinanorakari commented 5 years ago

It doesn't, the device came with a cable that has no lumps. I do have one ferrite core but if I understand correctly the choke has wire wound around it, which obviously is a difference.

I'll be looking for a cable with chokes on both sides as you described

cjheath commented 5 years ago

Passing the USB cable even once through a toroid will help, better if you can do two or three turns. Or use one like these: 20181107_094911

dominicgs commented 5 years ago

I agree with @cjheath, I strongly recommend using one of those cables if you see this issue.

alinanorakari commented 5 years ago

I found a Micro USB cable with two chokes on either end today and was excited, but it makes the problem worse than it is with the included cable.

included cable:

screenshot 2018-11-07 at 20 44 56

cable with chokes:

screenshot 2018-11-07 at 20 44 09

These screenshots were taken seconds apart in the same location with the same settings.

I also tried a makeshift ground wire, holding one end to the ground of an outlet and the other to the thread of the antenna SMA connector, but either I wasn't able to make a connection or I did make a connection but it made no difference.

Can I be doing anything else wrong here? I feel like this has the potential to be really stupid user error given that none of the advice worked so far and you're very likely operating HackRFs much longer than me. Just to make extra sure I'm not messing something up on the software level here, these are my settings. Can somebody please confirm that my Gqrx setup looks sound?

screenshot 2018-11-07 at 20 59 19 screenshot 2018-11-07 at 20 59 30 screenshot 2018-11-07 at 20 59 45

(more Msps make it worse, fewer make it slightly better)

alinanorakari commented 5 years ago

I've tried six more cables today, with choke, without choke, direct USB-C to Micro B, via adapter, via powered and unpowered hub. This is the absolute cleanest signal I can get and I'm super frustrated

screenshot 2018-11-08 at 19 41 02

I've also tried a fourth laptop with not much more luck

James-Brown commented 5 years ago

Peter. I haven’t followed this whole thread but does the ‘hair’ go away when you turn off the RF Amp? If so I would bet of an amplifier that is oscillating.

From: Peter Marquardt Sent: Thursday, November 8, 2018 10:50 To: mossmann/hackrf Cc: Subscribed Subject: Re: [mossmann/hackrf] USB(?) interference via antenna from the lowest frequencies to above 190 MHz (#544)

I've tried six more cables today, with choke, without choke, direct USB-C to Micro B, via adapter, via powered and unpowered hub. This is the absolute cleanest signal I can get and I'm super frustrated

I've also tried a fourth laptop with not much more luck

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

alinanorakari commented 5 years ago

All of this is with the RF amp off. If I turn the RF amp on it looks exactly the same but about 10-15 dB stronger

barto- commented 5 years ago

You could try to install an optional RF shield. Check this video https://youtu.be/IQ_I8q3IUFs

alinanorakari commented 5 years ago

To summarize:

The cleanest signal is still with the included USB cable. All other USB cables I've tried now, including the one with two chokes, produce a noisier signal. There's only one other cable in the bunch that also performs the same as the included cable.

A powered USB hub didn't help.

I've not been able to get a clean signal without the spurs on five computers, four of them laptops, four of them running macOS and one running Ubuntu.

Gqrx and GNU Radio agree on the FFT spectrum and they both show the spurs. I can also clearly hear it in the FM demodulation of weaker stations

The spurs disappear with no antenna connected or with a cable connected directly to the analog TV cable that also serves FM radio stations. Those come in super clear with no spurs in sight and a baby smooth noise floor.

The spurs are always there when an antenna is connected (except when a FM band stop filter is present), even in different locations (e.g. at home, at work) and with most electronics around turned off or far away from other electronics except the laptop. There is also no difference whether I use the ANT500 connected directly or another telescopic antenna connected via 2m long coax cable.

It happens with the laptop on battery power and powered via wall plug.

An RTL-SDR dongle exhibits similar (but differently spaced) spurs.

… taking all of this into account there are a few common denominators left that I can think of.

alinanorakari commented 5 years ago

Here's one more thing I've just tested and which got me thinking:

The difference between the following two screenshots is that for the first screenshot I've misused an AM loop antenna (at 24 gain IF, 30 gain BB) and in the second one I tried matching the energy and FFT as closely as possible with the ANT500 extended (at 16 gain IF, 18 dB gain BB)

screenshot 2018-11-08 at 23 43 19 screenshot 2018-11-08 at 23 53 15

The spurs are almost absent using the antenna meant for AM radio, even at higher amplification levels. This got me thinking. I've read that an antenna can pick up signals well if it's the length of one wavelength, half a wavelength or a quarter wavelength. (Entering solid half-knowledge territory here)

Could this mean the spurious signals interfering with my HackRF must come from around 208 or 416 MHz since they're absent with the AM antenna?

Continuing that thought this would strengthen the theory that the component actually picking up the noise is the antenna, and in the light of everything else I've tested I know it's highly dependent on the cable, suggesting the cable is transmitting the noise. Since the USB 2.0 bus frequency of 480 MHz still seems to be the likely source and regarding the cable as a transmitting antenna, and assuming similar wavelengths calculations from above apply to sending antennae it would make sense that the length of the cable has something to do with the amount of noise present (along with its shielding I assume, but I can't measure that easily).

Does that help me solve my problem?

alinanorakari commented 5 years ago

… and following that train of thought, which length of USB cable would be the worst possible at transmitting 480 MHz?

cjheath commented 5 years ago

The spurs are probably all harmonics. Of whatever the spacing is. What is it?

On Fri, 9 Nov 2018, 10:34 Peter Marquardt <notifications@github.com wrote:

… and following that train of thought, which length of USB cable would be the worst possible at transmitting 480 MHz?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mossmann/hackrf/issues/544#issuecomment-437195649, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAGp6ROF8h5UuO7XsA07kZDrtz3Z4pdks5utL9pgaJpZM4YNtP9 .

alinanorakari commented 5 years ago

It looks like they're pretty much spaced 48 kHz apart, which incidentally is also the audio output's sample rate. What does that mean?

alinanorakari commented 5 years ago

I have to revise my answer, those are the coarse spurs, if I increase the HackRF's sample rate I can also see fine spurs which fall into an 8 kHz raster

alinanorakari commented 5 years ago

Here's a close up of the spurs. The ones at 48 kHz intervals are fanned out while the ones at 8 kHz intervals are sharp

screenshot 2018-11-09 at 23 04 03
alinanorakari commented 5 years ago

I've had the unexpected opportunity of talking to the former Director of National System Development for Cellular One about this. He said this is very likely heterodyning. He said my working theory about the USB cable transmitting (resonant close to a quarter wave of 480 MHz) and the ANT500 receiving (close to a half-wave of 480 MHz) isn't far off. I'm on the right track about varying the length of USB cable in order to reduce the interference but since we don't know the primary heterodyne component I'm left to trial and error.

So I've decided to introduce as much trial into trial and error as I can. Perhaps I can build a variable length USB cable.

I'm learning a lot about RF and It's exciting

cjheath commented 5 years ago

I have the RF shield off mine because I expect to replace an MMIC soon. I see a lot of regularly-spaced (8KHz) spurs filling the frequencies between 27MHz and 33MHz. I think they're very likely from an internal source. Also spurs on 10MHz multiples running up to a couple hundred MHz (possibly from the new TCXO I just added?) I'll let you know what I find as I experiment further. I haven't tried connecting one of my large external antennas yet, for example.

alinanorakari commented 5 years ago

I see the 10 MHz spurs you describe as well.

The strength of my spurs in the FM band seems to be very dependant on the antenna connected, and they disappear in certain cases. I'm therefore assuming that it's not an internal component causing them

alinanorakari commented 5 years ago

I've tried two 1.8m USB cables that resulted in terrible noise. The USB cables yielding the best signal to noise ratio so far are 1m and 90cm. I'm going to try to confirm my cable length theory with more cables close to 1m in length.

I'm also braving up and installing an RF shield, even though my observations point towards it coming through the antenna. My soldering skills are not the best but I figured it should be doable and an RF shield certainly won't make it worse, right?

cjheath commented 5 years ago

You're probably aware of this, but a more efficient antenna that's not receiving the spurs will push them down in relative level. So you need to look at the absolute level to know what's going on. Also, making a shield doesn't require soldering, if your board has the clips for it. It just requires some accurate metal bending and careful trimming.

alinanorakari commented 5 years ago

So far three telescopic antennae which were all tuned to somewhere in the FM spectrum received the spurs at pretty much the same absolute level. My point of reference is one particular FM radio station that just about comes through the spurs with the best USB cable. I'm judging my USB cables by both the absolute intensity of the spurs in dBFS and by the intensity of my reference radio station in relation to the peaks of the spurs (and audible quality of the WFM demodulated sound)

My observation so far is:

To be honest I don't know if my board has clips for it or how they would look. With clips do you mean the holes in between the solder pads as can be seen in this image? https://camo.githubusercontent.com/fc5fea2c0ccc11b91ce651b812bc1d6cd0fbbfc9/68747470733a2f2f7261772e6769746875622e636f6d2f6d6f73736d616e6e2f6861636b72662f6d61737465722f646f632f4861636b52462d4f6e652d6664302d303030392e6a706567

cjheath commented 5 years ago

I assume you aren't using AGC (input settings) but setting RF and IF gain manually.

I mean the clips on the dashed RF boundary trace in this photo. 20181113_103325

alinanorakari commented 5 years ago

Yes, always the same gain settings: no RF gain, 24 dB IF and 30 dB BB. Those are the gain settings that make my reference FM radio station come in the clearest with the good cable. I'm also always cross-referencing against the good cable just in case other outside effects (e.g. atmospheric phenomena) changed how well this particular station is reaching me.

I didn't know some boards had these clips. I'm going to open my HackRF's case when I get the shield so I won't know until probably Saturday, unless there's another way to find out

cjheath commented 5 years ago

I replaced the blown MMIC in my HackRF, and (possibly coincidentally) the 8-KHz spaces spurs between 27 and 33MHz have gone - whether or nor the MMIC is enabled, and whether or not the metal shield is fitted. I have a TCXO now, and so 10MHz and most of the multiples have a significant spur - but oddly enough, they don't get worse when you touch the TCXO pins. Here's the Sydney FM broadcast band, using a little interior antenna:

hackrf fm

The shield does lower the noise floor by 2 or 3dB at 100MHz, but I hadn't noticed spurs there anyhow. So as far as your problem goes, I'm out of ideas.

One thing to note, this MMIC is only intended to work above 100MHz. The HackRF doesn't seem to work at all near 1MHz, with or without the MMIC enabled. I haven't worked out what the realistic lower limit is. Perhaps with an external HF pre-amp, 1MHz would be usable.

alinanorakari commented 5 years ago

OK so this is what my FM radio spectrum noise floor is supposed to look like, huh?

My sample size of possible USB cables has grown so much that I can now confidently say 0.9-1.0m length seems to be close to the sweet spot, 1.6-1.8m are terrible and 0.2m-0.4m are also terrible, all pretty much regardless of cable quality.

I'm pretty certain I'm not the only one using a HackRF and its included USB cable with a recent 2018 MacBook Pro Touch Bar, a 2012 iMac or a 2016 MacBook. Shouldn't there be more reports about this in that case? Since those computers all show the spurs all the time in repeated tests … could my HackRF be defective?

alinanorakari commented 5 years ago

Speaking of TCXOs … my HackRF is off by -25ppm, could that be related to the spurs? As far as I can see a new TCXO is plug-and-play. Put it on the respective pins and it's in use instead of the built in oscillator. It couldn't hurt to try one, right?

cjheath commented 5 years ago

Right. Not quite plug and play, I had to bend two of the ISP pins down to clear the oscillator can. I don't know if TCXOs are available with different geometry. If I need to use ISP (hopefully not) I'll fit right-angle header pins out the back of the board.

On Thu, 15 Nov 2018, 06:59 Peter Marquardt <notifications@github.com wrote:

Speaking of TCXOs … my HackRF is off by -25ppm, could that be related to the spurs? As far as I can see a new TCXO is plug-and-play. Put it on the respective pins and it's in use instead of the built in oscillator. It couldn't hurt to try one, right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mossmann/hackrf/issues/544#issuecomment-438797911, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAGp7S1F_TfNAIU96qDriil3vqKpopCks5uvHY8gaJpZM4YNtP9 .