LowPowerLab Forum

Hardware support => RF - Range - Antennas - RFM69 library => Topic started by: WhiteHare on January 13, 2016, 03:33:59 PM

Title: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 13, 2016, 03:33:59 PM
There are at least a couple documented cases where conducted EMI appears to reduce the RSSI of an RFM69 Moteino:
https://lowpowerlab.com/forum/index.php/topic,1008.msg6492.html#msg6492
https://lowpowerlab.com/forum/index.php/topic,1516.msg10695.html#msg10695

It's possible that other Moteino users are being affected by it but just aren't aware of it.  The first case is a Pi being interfaced to a Moteino (as in, for instance, a Pi Gateway).  The second case shows that the EMI could be coming in over AC ground from a random device that you may not have even thought about.  So, for those who might care, what's the best way to isolate an RFM69 Moteino from the issue?

The RFM69 on my Moteino is set at the 902-928Mhz frequency.  I don't know if other frequencies may be playing a role in affecting the RSSI on my Moteino, but  my current hypothesis is to mitigate conducted EMI at that frequency.  I did some hunting for a common mode choke, and the following seemed the best that I could find that was in-stock at quantity 1:
http://www.digikey.com/product-detail/en/CM0805A371R-10/240-2571-1-ND/1236451
It's surface mount and just 99 cents for quantity 1 on Digikey.  Attached is the impedence vs frequency plot.  C is the common mode curve.  N is the normal mode curve.  If you find or know of something better, please post.

I haven't attempted anything like this before, but my tentative plan is to use one of the above common mode choke on the power and ground line feeding the Moteino, and then use optoisolators for Tx, Rx, and DST if the Moteino is interfaced to another device, like a Pi Gateway or whatever.  I'm unsure, but maybe an alternative would be to use 4 of the chokes, with GND being the return line on all of them (?).  Some chokes can accommodate more than 2 lines, but I didn't get far with finding one that had good parameters.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 14, 2016, 04:36:59 AM
I stumbled across the following thread, which describes what *might* be another instance:  https://lowpowerlab.com/forum/index.php/topic,1207.msg7949.html#msg7949
In his case, he found that connecting Moteino ground to Earth ground made the problem go away.

If it works, connecting Moteino ground to Earth ground may well be the simplest and easiest remedy.  Therefore, assuming it works, are there any good reasons *not* to do that?
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: joelucid on January 14, 2016, 05:54:29 AM
Interesting. When I tested the low pass filter I didn't really get any quality results so I didn't post yet. I do get the periodic Rssi reduction when the moteino is in the Pi enclosure. When I moved it out on a breadboard to add the filter at first nothing seemed to improve. I connected a scope and the problem was gone. For a time I could reproduce the issue going away exactly when scope ground was connected.

However in the end the issue was gone even without scope. But immediately reappeared when I put the Moteino in the enclosure again.

As I said too confusing to even talk about by itself - but given the ground connection I thought I'd mention it. Unfortunately I'm too busy right now for further tests.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 14, 2016, 11:45:25 AM
No worries.  Thanks for the update.   :)

Boy, where are the EE's on this forum when you need them?  Seems like when basic 101 topics like this come up, they drop into perpetual lurk mode.   ::)

Anyhow, rather than directly connecting to earth ground I'm beginning to develop the impression that using a connection to earth ground that's low impedance only at high frequencies is a more conservative way to go.  However, given the already mentioned deficit of tips or guidance from any EE's, I've unfortunately got more reading to do.

Also, forget building your own low-pass filter out of discrete parts when you can buy compact, high-attenuation 3rd-order low pass filters on Digikey for 30 cents that are already nicely characterized for you.  Example:  http://www.digikey.com/product-search/en?vendor=0&keywords=m9936ct-nd  It can even handle 5 amps, so definitely no stress at the currents we'd be using.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: oric_dan on January 14, 2016, 03:43:46 PM
Quote
Boy, where are the EE's on this forum when you need them?  Seems like when basic 101 topics like this come up, they drop into perpetual lurk mode.
FWIW, don't underestimate the difficulty of this problem, :-). RF is magic, and guys who do that tend to be rather specialized, and with deep knowledge. I doubt many guys with EE degrees [like me] have any deep experience in this area. I've done consulting with embedded systems in nasty industrial environments, and EMI/ESD problems tend to tie people in knots, and can take a long time to fix. There isn't ever just "one" magic bullet that fixes everything. It's a systems-level problem that usually takes multiple fixes in various places. So, don't think it's an especially trivial [Basic 101] problem to solve. There are too many variables.

What you've got here are 2 devices interacting with each other at close range, and neither of which is specifically designed for such operation. I imagine there are a few things you can do to help mitigate the problem, like power line filters and shielding, but you'd likely need an RF "expert" to really deal with it in a comprehensive way. In any case, I'd say try the more obvious things on the list, like you're already doing, and see what results you get.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: Felix on January 14, 2016, 04:06:17 PM
Boy, where are the EE's on this forum when you need them?  Seems like when basic 101 topics like this come up, they drop into perpetual lurk mode.   ::)

FWIW, don't underestimate the difficulty of this problem, :-). RF is magic, and guys who do that tend to be rather specialized, and with deep knowledge. I doubt many guys with EE degrees [like me] have any deep experience in this area.

+1 oric_dan
To say that EE/CSE guys are automatically supposed to have RF under their 101 belt is a bit of an overstatement.
Hardware is hard in general, and RF is the next order of magnitude harder.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: oric_dan on January 14, 2016, 05:06:18 PM
RF/high-speed analog/digital design is really more art than science or engineering. How's about "Black Magic". See the book, 384 pages of deep do-do. I'd say people learn this area mostly via direct experience, far beyond anything taught in schools.
http://www.amazon.com/High-Speed-Digital-Design-Handbook/dp/0133957241
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: Felix on January 14, 2016, 07:01:44 PM
Another excellent book on signal integrity is this: http://www.amazon.com/Signal-Power-Integrity-Simplified-2nd/dp/0132349795/
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 15, 2016, 11:30:18 AM
Another excellent book on signal integrity is this: http://www.amazon.com/Signal-Power-Integrity-Simplified-2nd/dp/0132349795/

Thanks for the pointer.  I read the first sample chapter online, and it was a lot more approachable than I had expected.  It claims "Once we identify the root cause of the noise associated with each of these four families of problems, the general solution for finding and fixing the problems in each family will become obvious."
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 15, 2016, 11:42:06 AM
Anyhow, as a brute force method, maybe connecting a Pi to a Moteino through a USB isolator would solve the issue.  There are a number of different models, with prices ranging from $30 to around $120.  I have no idea which might be the best, but the price itself is perhaps justifiable when you consider that the above book is $90.

On the other hand, when you add in the Pi cost, maybe instead just connecting to a PC is really the best "known solution."   ;)
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: oric_dan on January 15, 2016, 02:09:09 PM
The Bogatin book looks pretty good, and you can begin to see the complication here. The guy has PhD, 30-years experience in the specific area, and 300 publications, plus the book is 587 pages.

That being said, it's certainly possible that a few interventions will help the problem greatly. There are at least 3 means of interference:

- conductive - via direct wiring, where inline filters should help.

- inductive - short-range pickup due to wiring loops, such as connecting everything using silly Arduino jumper wires, and where the solution is to shorten the wires, use twisted pair to reduce the loop inductance, use shielded wires, use differential-signalling, etc.

- radiative - direct electromagnetic transmission at high-frequencies, and where shielding and physical separation are the first steps, followed by hi-frequency filters on I/O lines.

The problems also get compounded when you have signal wires coming to I/O pins via high-impedance pathways, eg from non-terminated open-switches, as they act like antennas for picking up noise. So, it's best to keep signal pathways low-impedance, eg always have moderately low-value terminating Rs to gnd on I/O pins.

As you'll notice, our Arduino and RPi boards essentially have none of these features designed in.

EDIT: forgot to mention, the guy has a website with probably a lot of useful information (unfortunately, the place is all about making $$$):
  http://www.bethesignal.com/bogatin/
You can see the topics he covers here:
  http://www.bethesignal.com/bogatin/product_info.php?cPath=88&products_id=833
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 15, 2016, 03:15:55 PM
Maybe it's more complete than what's in his 2010 book.  For instance, rather than four families of problems in the passage I quoted, now he's talking about six: "EPSI-01-40 The Six Families of SI Problems"



As you'll notice, our Arduino and RPi boards essentially have none of these features designed in.


Yes, and that could spell more opportunity for Felix if he wanted to sell solutions that were even further differentiated by being even further hardened against EMI/RFI.  Since the length and quality of the signal path matters, it may be nearly impossible for the RFM69 to remain unimpaired, to one degree or another, by EMI/RFI if just using regular arduino gear connected to an RFM69 using dupont jumper wires on a breadboard or with similarly cruddy connections.

So, it's best to keep signal pathways low-impedance, eg always have moderately low-value terminating Rs to gnd on I/O pins.

So, does that mean from an EMI/RFI standpoint that as standard procedure *all* unused pins should be connected to ground, each with its own dedicated resistor (220 Ohm)?
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: oric_dan on January 15, 2016, 03:46:03 PM
His 6 families on this page refer more to how to layout pcbs so you get good integrity for signals traveling "within" the pcb itself. I was referring mainly to control of EMI from off-board, and "between" different boards.
https://www.bethesignal.com/bogatin/epsi0140-families-problems-p-837.html?content=curriculum
- PDN apparently refers to Power Distribution network.
https://www.google.com/search?q=pdn+design
- the idea is, if you route the power and signal traces poorly, then you end up with inductive loops, like I mentioned, and present on the board itself. So, for instance, digital spike noise will be transmitted over into analog areas and produce a lot of ADC pickup noise, etc.
https://www.google.com/search?q=pcb+ground+loops&source=lnms&tbm=isch

Quote
does that mean from an EMI/RFI standpoint that as standard procedure *all* unused pins should be connected to ground, each with its own dedicated resistor (220 Ohm)?
Some people advocate that, but I was mainly referring to pins that have signals being brought to them via wires from off-board. Those wires are simply antennas.

For background info, Ruggeduino actually sells boards with a lot of protection built-in. More than I [personally] think is necessary for most Arduino applications. It's useful information in general, but also doesn't have a lot to do with the specific sort of EMI problems being discussed here.
http://www.rugged-circuits.com/ruggeduino/
http://www.rugged-circuits.com/10-ways-to-destroy-an-arduino

EDIT:
Revisiting your 220ohm R value, that wouldn't be a proper termination [ie, pulldown] as I was referring to. The pulldown basically gives a low impedance pathway to ground for external noise coming in via long signal pathway wires, better than having floating pins. You would probably want to use values here in the range of 1-2K minimum, up to 5-10K maximum. 220R would normally be too low for a pulldown.

However, it's not too uncommon for people to use 220-330R values for "series" R's in the I/O lines, to help protect against short-circuit and over-voltage protection. I have these myself on all of my own pcbs. You can see these on my Tredici-1284 board near the upper headers. I also have them in the FTDI Rx,Tx lines, and in the ADC channels. There is also a grounded bussed R-network right next to pins 31-40 on the chip, to create voltage-dividers on all of the ADC pins, so I can handle large voltages with the ADC.
https://lowpowerlab.com/forum/index.php/topic,1516.msg10573.html#msg10573
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 15, 2016, 06:13:08 PM
Another seemingly related thread: https://lowpowerlab.com/forum/index.php/topic,195.msg790.html#msg790
jgilbert appears to be reporting that the noise floor increases by 15-20dB when his Pi is turned on.  In contrast, JoeLucid reports that RSSI decreases by 15-20 on received packets in a similar setup.  *If* the automatic RSSI calibration uses the noise floor as the reference for RSSI (?), then would that explain what Joe observed?

Also, is it fair to say that jgilbert's dataset shows the actual link budget is reduced by 15-20dB when his Pi is online?  i.e. It's not just a perceived reduction, but an actual reduction?

[Edit: jgilbert doesn't show enough of the code that surrounds his call to readRSSI for me to know for certain, but I'm assuming he was operating the RFM69 in continuous mode, rather than packet mode.  Is that the proper way to do it?  Plainly, the packet mode isn't going to tell, because the datasheet says that measures the RSSI during the preamble.]

[Edit2: At least from my point of view, measuring whether there is a change in the noise floor seen by the RFM69 radio is the next step in deciding whether this is a significant problem or just a problem that appears worse than it is.  I'd take jgilbert's dataset as at least prima facie evidence that it's the former not the latter.  Has anyone here drawn a different conclusion?]
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 17, 2016, 12:29:49 AM
I've tested the following, and it appears to implement Perky's clever idea for getting a stream of real-time RSSI without needing to switch to continuous mode and without needing to receive packets. 

Add the following into your main loop to print out a baseline stream of RSSI :

Code: [Select]
  radio.writeReg(REG_OPMODE, (radio.readReg(REG_OPMODE) & 0xE3) | RF_OPMODE_STANDBY);  //Put RFM69 into standby-mode
  radio.writeReg(REG_RSSITHRESH, 0xFF);  //set RSSI threshhold as low as possible
  radio.writeReg(REG_OPMODE, (radio.readReg(REG_OPMODE) & 0xE3) | RF_OPMODE_RECEIVER);  //Put RFM69 into receive-mode
  Serial.print("   [RX_RSSI:");Serial.print(radio.readRSSI());Serial.println("]");

You will need the following in order to compile:
Code: [Select]
#include <RFM69registers.h>

If you wish, you can drop the above into the gateway example code.  It assumes you already initialized your radio to how you want it (frequency, bandwidth, etc.) in setup.  In setup, you'll want to set your serial baudrate as high as you can.

If you can do better, feel free to post.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 17, 2016, 08:44:41 PM
I did an experiment where I ran the above code both with and without the same EMI source that I used previously (see the OP), and there was no discernible change.  I'm not sure why that would be, unless perhaps there's no automatic gain calibration going on (as there appears to be when measuring the RSSI that's tied to actual packet reception).  In any case, on its face, I take it as good news.   :)  I'm now wondering to what degree, if any, Moteino Rx would suffer if run without automatic gain calibration (assuming that's even possible).  Perhaps there's a chance (?) that doing so could serve as a stopgap which is better than nothing until there is a proper EE solution (e.g. for combination Moteino and Pi Gateway).

What ultimately results from the automatic gain calibration?  Is the result simply picking an LNA Gain Setting in Table 12 of the SX1231H datasheet, or is it something else altogether?
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: emjay on January 18, 2016, 08:46:54 AM
@WhiteHare,

From the datasheet:
Quote
The receiver is capable of automatic gain calibration, in order to improve the precision of its RSSI measurements. This function injects a known RF signal at the LNA input, and calibrates the receiver gain accordingly. This calibration is automatically performed during the PLL start-up, making it a transparent process to the end-user

AGC aka Automatic Gain Control is a different beast entirely.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 18, 2016, 12:26:03 PM
@WhiteHare,

From the datasheet:
Quote
The receiver is capable of automatic gain calibration, in order to improve the precision of its RSSI measurements. This function injects a known RF signal at the LNA input, and calibrates the receiver gain accordingly. This calibration is automatically performed during the PLL start-up, making it a transparent process to the end-user

AGC aka Automatic Gain Control is a different beast entirely.

So, by "a different beast entirely," I take it you mean that "calibrates the receiver gain accordingly" is completely unrelated to "Automatic Gain Control" and does not influence it in any way?

Maybe nothing more can be done.  I'm definitely very close to throwing in the towel on this.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: oric_dan on January 18, 2016, 11:56:12 PM
WH, I'm interested in listening to what you're doing here, but am buried in writing software for my robot tank RoBurt. It's taken me months of work and trying out different platforms until I finally have something working even half-well. The program is over 60 pages now. So, not enough time to delve into this too. I know very little about the radio operation, and it would take a lot of playing around to come up to speed. So, it looks like you're the guy, good luck :-).
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: emjay on January 19, 2016, 02:56:55 AM
@WhiteHare,

AGC is simply a control loop to keep the magnitude of the received signal reasonably matched to the capabilities of the stages from the mixer onwards. Kinda Goldilocks - not too large else clipping will occur, not too small else the signal gets buried in the noise.  For this chip, the AGC choice is quantized into some fairly broad chunks, predefined as LNA gain settings.  Recall that FSK is essentially constant carrier amplitude - this approach works well for shortish packets: measure the energy in the channel during preamble, compute the best gain block size to match the mixer linearity requirements, lock this in for the duration of the packet (and as an aside, update LnaCurrentGain for interested observers when time permits)

Automatic gain calibration is to ensure the RSSI dB value you read out has some connection with reality.  Chip tolerances can be surprisingly large for absolutes (just look at the spread of T estimate on the chips that retain access to a temperature sensor).  So as described, at some convenient start up, a known signal is injected into the gain chain and some offset register adjusted to make the answer look right.

Note that I've just shot myself in the foot there - how can there be a precise 'known signal' to inject without the same tolerance issue?  Techniques include laser trimming of the raw die during chip functional probing or post packaging adjustment by writing to eprom calibration registers.

Here you hit an event horizon - it isn't documented, may not even be described accurately. Why? Because this may be touching on an area the vendor wants to keep close to his chest. It's a competitive world out there!
Many of the puzzling aspects could be resolved by seeing the code run by the internal state machine e.g. when do the externally visible registers actually get updated?

Regretably, that just isn't going to happen. 
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on January 29, 2016, 06:58:28 AM
Most conducted and radiated EMI is caused by common mode noise on signals entering or exiting a box. If you tie your box ground to digital ground with a very low DC and RF impedance (large, fat and very short connections) at the point a signal exits or enters the box the common mode noise is significantly reduced. On the power leads a capacitor (e.g. 470nF) with a low RF ground connection to chassis (short, fat connections) tends to get rid of a lot of power-line conducted EMI. A 5mm wire will have significant impedance at RF frequencies and will do very little to stop it, you need wide, fat and very short connections.
Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: emjay on January 29, 2016, 09:36:56 AM
Hmm - better put those decoupling caps on a diet.  Anything in the uF range is no longer a capacitor above a couple of MHz, it's an inductor!  Parallel up with 0.1uF, 0.001uf and 47pF for decoupling to be effective up to the 1GHz needed.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 29, 2016, 03:36:03 PM
Most conducted and radiated EMI is caused by common mode noise on signals entering or exiting a box. If you tie your box ground to digital ground with a very low DC and RF impedance (large, fat and very short connections) at the point a signal exits or enters the box the common mode noise is significantly reduced. On the power leads a capacitor (e.g. 470nF) with a low RF ground connection to chassis (short, fat connections) tends to get rid of a lot of power-line conducted EMI. A 5mm wire will have significant impedance at RF frequencies and will do very little to stop it, you need wide, fat and very short connections.
Mark.

1.  Just how fat and how short does it need to be? 

If 5mm is already too long, then I guess that by itself might explain why the 47-ohm antenna "short" I tried seemed to work so poorly.   ::)

2.  Unrelated:  Since the RFM69's radio is being driven by a 32Mhz crystal, does that make it more likely that the RFM69 could be getting EMI/RFI directly from the rest of the Moteino, which, IIRC, typically operates at 8Mhz?  I guess the hypothesis would be that whatever up-converts the 32Mhz crystal frequency up to 915Mhz might be upconverting whatever noise/harmonics there might be also.

Maybe a ghetto way to test the hypothesis would be to see whether the Moteino can receive a distant node while the RFM69 is in Listen-Mode, with the rest of the Monteino asleep, that it can't otherwise receive with the Moteino fully powered on?  Such a test would be easier said than done, I realize.  Perhaps someone reading this has proper instrumentation and could check for it directly without resorting to ghetto methods.

However, if it turns out to be true, then it would be good to know: for instance, maybe running a modified Moteino at a much lower speed, like 1Mhz, would yield reduced EMI/RFI?  If such a modification were made, it could at least be tested for effect using the RSSI measurements being discussed on the other thread.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on January 29, 2016, 05:56:58 PM
I've just had a look at the Moteino schematics.

Switching noise may well be getting into the radio due to lack of decoupling, and changing the MCU frequency may have an effect. The first thing I would try though is add some decoupling caps to the MCU power pins (low inductance connections as close as possible to the pins, use 100nF multilayer ceramics). Ideally a ferrite filter too if you can. Putting a decoupling cap and ferrite filter on the radio's supply could also help.

Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 30, 2016, 02:20:08 PM
Would removing the voltage regulator and powering directly from a battery accomplish the same thing?  Or would the decoupling caps still be advisable even there.

We're starting to narrow down the source(s).  Maybe, though, it's already nearly as good as it will ever get.  -121dB is the lowest RSSI that I can recall measuring so far, and that's pretty close to the -127dB theoretical limit (well, the lowest that the hardware can represent anyway).

Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: emjay on January 30, 2016, 05:51:48 PM
@WhiteHare,

Chasing those last uV of RF noise can be a challenge. An alternative path would be to switch to battery power and provided you can buffer up enough readings, put everything in an 'Altoids' tin.  Right now you are still seeing a combination of several noise sources:

 * Internal to the RF chip
 * Conducted hash through power, asynch etc connections
 * EMI coupled into the RX pin (I'm assuming your solder blob is at ANT, not the chip RX pin)

Completely encasing and switching to battery power will substantially reduce the last two.

Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on January 30, 2016, 10:13:32 PM
(I'm assuming your solder blob is at ANT, not the chip RX pin)


Yes, see attached photo.

An alternative path would be to switch to battery power and provided you can buffer up enough readings, put everything in an 'Altoids' tin. 

I agree.  I'm thinking I could buffer the readings into the non-volatile memory and then play it back from there after opening the can.  So, I'm slowly inching my way toward that.  Perhaps we'll get lucky by going these extra steps and identify a cause that can be mitigated.  Anyhow, there's no way of knowing without pressing on a bit further.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on January 31, 2016, 06:30:52 AM
Changing to battery could help. There are two issues here I think. Conducted interference, where reducing the source noise and ferrite filtering on the MCU and radio power pins will help, and radiated noise. The Vdd is tracked, meaning switching noise from gulps of current that the MCU takes on its power pins are forced to travel in loops under the radio module, those are magnetically coupled near field interference sources for the radio. You'll need some decoupling very close to the MCU's power pins to reduce those, that would also help E field coupling as well.
Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 01, 2016, 04:47:26 PM
By itself, changing to battery didn't make much difference:
http://pastebin.com/v45TquBG
No USB connection, and DTR wired to ground.

Now, here are the RSSI measurement results taken inside a sealed metal can while running on battery power (obviously, no USB connection) and with the Moteino DTR pin wired to GND:
http://pastebin.com/iGDFq869

Do you see any meaningful difference?

So, that clears up one theory.  Whatever noise or RFI there may be can't be coming  from coming outside the metal can.  Whatever EMI/RFI there may be originates within the metal can, and the only thing there is a battery connected to Vin and GND on the solder tacked Moteino, and a dupont wire connecting the DTR pin to GND.

So, at least that narrows the list of possible causes.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 01, 2016, 05:28:25 PM
There is an MCU directly underneath the radio with no decoupling on its power pins, no ferrite filtering on Vdd, tracked in Vdd and no ferrite filtering or decoupling on the radio's power pin. Have you eliminated the MCU's switching noise from this?

Also the noise floor will depend on the width of the RxBw filter, you should program that to the narrowest possible.

Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 01, 2016, 11:29:34 PM
There is an MCU directly underneath the radio with no decoupling on its power pins, no ferrite filtering on Vdd, tracked in Vdd and no ferrite filtering or decoupling on the radio's power pin. Have you eliminated the MCU's switching noise from this?

Also the noise floor will depend on the width of the RxBw filter, you should program that to the narrowest possible.

Mark.

If someone can suggest specific part numbers from, say, Digikey, I can order them and try them and then post the outcome.

I haven't yet removed the Moteino's voltage regulator, but that's something I can try soon.  I can also try narrower bandwidth settings.  The settings used in the above test were:

Code: [Select]
Radio Configuration:
====================
Receiver-Mode(RX)
Packet Mode, FSK modulation scheme
[ActualBitrate] 4799.760bps = nominal bitrate of 4800bps
[theDccFreq] B10 (equals Semtech default)
[RxBw] 10416Hz
  [RxBwMant] 24
  [RxBwExp] 5
[theDccFreqAfc] B100 (equals Semtech default)
[RxBwAfc] 50000Hz
  [RxBwMantAfc] 20
  [RxBwExpAfc] 3
[FDev] 5004Hz
[frequency-center] 915000000Hz
[regLNA] B1001
  [LnaZin] B0 -> Input Impedance = 50 ohm (Warning: Semtech default is 200 ohm).
  [LnaCurrentGain] B1 -> G1
  [LnaGainSelect] B1 -> G1  (Note: Manually selected.  AGC disabled.)
                   ^Warning: does not match Semtech default.
[regAFCFEI] B10000
  [FeiDone] B0 -> FEI is on-going (i.e. not finished).  Matches Semtech default.
  [AfcDone] B1 -> AFC is finished (i.e. not on-going).  Matches Semtech default.
  [AfcAutoclearOn] B0 -> Invalid, because AfcAutoOn is not set.
  [AfcAutoOn] B0 -> AFC is performed each time AfcStart is set (i.e. not each time Rx mode is entered).
               ^Matches Semtech default.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 02, 2016, 11:47:57 AM
My experience yesterday (https://lowpowerlab.com/forum/index.php/topic,961.15.html), which unknowingly re-lived gkientzy's experience (https://lowpowerlab.com/forum/index.php/topic,961.15.html) actually gives me some hope that at least some of the cause might be a "noisy power source".  I say "hope" only because that's something which is within the realm of things that can more easily be changed for the better if it turns out to be what's creating the issue. 

So, to check that hypothesis, I'll be unsoldering the default Moteino voltage regulator and try powering directly with two AA's instead.  Then I'll be checking two things for effect: 1.  ambient RSSI measurements, like those above and 2. whether or not I still need the DTR to GND wire in order to properly initialize the lowpowerlab flash memory.



Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 02, 2016, 12:41:41 PM
Hmm..  Looking at page 37 of the datasheet for the flash memory (https://www.winbond.com/resource-files/w25x40cl_e01.pdf), it gives two different operating voltage ranges: 
2.3 to 2.7v
and
2.7 to 3.6v

Anyone happen to know which voltage range is applicable for the Moteino R4?  I'm guessing the second one (2.7-3.6v), if only because it runs at 3.3v, but if it were based on frequency, then I'm thinking maybe it's the first one (2.3-2.7v).
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 02, 2016, 01:05:45 PM
The spec just specifies maximum SPI clock frequencies Fr and fR for two voltage ranges. For the voltage range 2.3V to 2.7V Fr and fR are 80MHz and 33MHz respectively, and from 2.7V to 3.6V Fr and fR are 104MHz and 50MHz respectively. Given the SPI is driven from an ATmega328 chip you're not going to get anywhere near those maximum frequencies, I think the max you could get out of it is 5MHz (half the 10MHz processor clock).
Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 02, 2016, 01:38:15 PM
Thanks for clearing that up.   :)  So, I take it that the acceptable voltage range in the Moteino's case for the flash memory is actually the union of those two ranges, which would be 2.3v - 3.6v? 

By the way, that would also mean that the practical lower limit voltage for wireless programming is 2.3v.  The atmega328p and the RFM69 are each good down to 1.8v, which means that if running on battery I should add code to check voltage levels prior to (and maybe even during) wireless programming. 
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 02, 2016, 04:41:34 PM
I removed the Moteino's voltage regulator and am powering direct from two AA batteries in series, but:
1.  I still need to tie the DTR pin to ground or else flash won't initialize when battery powered.
2.  No obvious improvement in RSSI either.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 03, 2016, 05:13:07 AM
Just a thought, have you tried sleeping the processor and waking up on a RSSI interrupt? Just wondering whether you can quieten down the processor during the time it's sampling (this technique is used to get the best from microprocessor's A2D converters).

Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 03, 2016, 10:12:07 AM
Good idea.  I haven't tried it, but it sounds worth looking into. 
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 03, 2016, 11:42:39 AM
I do wonder, though, whether the RFM69 module, or perhaps even the SX1231H chip itself, is capable of doing any better under even near ideal circumstances.  For example, for all I know maybe thermal noise (or something else) dominates the sx1231H below -121dB.  I've presupposed that it should be capable of doing better, but an existence proof would at least establish that we aren't hunting for unicorns. 

So, as a "Plan B," I'm trying to imagine how to test for that.  Notionally, I'm thinking of a brute force experiment something like the following:
1. Run the RFM69 module on its own independent battery power supply, and with all IO done via optical couplers.
2. Connect the DIO0 line to a load switch that can ring a buzzer if it goes high.
3. Put the RFM69 into listen-mode with a very low RSSI threshhold (maybe -122db to start with, as so far -121db is the lowest that I've seen) and a long enough sleep period to provide ample time to execute step #4
4. Initiate listen-mode, and while the RFM69 sleeps, disconnect the optical couplers from the atmega328p, and stick the radio assembly inside a sealed metal can.
5. Time how long it takes for the buzzer to ring (if it rings at all).

If the buzzer rings right away, during the first Rx period of the listen-mode cycle, then  I'm inclined to think it would prove nothing more can be done.  If it doesn't ring at all, after some TBD number of listen-mode cycles, then I could ratchet down the RSSI threshhold and repeat the experiment until it does, and that would establish the "best case" target to aim for in a more practical design.

It would only be worth doing if it the results were conclusive.  Would the above decide the matter, or would there remain room for doubt?
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 03, 2016, 12:08:29 PM
Thermal noise, receiver bandwidth and inherent noise floor figures of the receiver all contribute, and it's a little complicated to work it all out. Here's an article giving an idea of what is involved:
http://www.highfrequencyelectronics.com/index.php?option=com_content&view=article&id=553:receiver-sensitivity-and-equivalent-noise-bandwidth&catid=94:2014-06-june-articles&Itemid=189
Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 03, 2016, 02:26:37 PM
Thanks for the interesting article.

The RFM69 datasheet says "High Sensitivity: down to -120 dBm at 1.2 kbps".  Can you impute from that the lowest (or perhaps average) RSSI's we can expect to measure when there is no actual signal?  For instance, the article says:

"The required ratio of signal power to noise floor is known for certain types of modulation. For an analog FM land mobile radio system using 25 kHz channels, the receiver must have approximately 4 dB more signal power than noise power. This represents a carrier to noise ratio 4 dB." 

It would be helpful to quantify the magnitude of the noise that we suspect we may be able to eliminate.

So, to illustrate, if the RFM69 were a "FM land mobile radio system using 25 kHz channels" (which it isn't, since it's using FSK, but again just to illustrate the point), then I suppose the noise floor would be at -124dB, and, at least on average, we would not expect to see an RSSI lower than -124, right? 

So, maybe all we need to know is the "required ratio of signal power to noise floor" for FSK.  I don't happen to know, but maybe someone here does?

In any case, the current measurements would seem to suggest that the noise floor is actually higher than -120dB, and I guess that's why we suspect there is interference which might be eliminated, so as to get us to a more fundamental noise floor that, on average, is some number lower than -120dB.  Correct?

The point of asking is that it might quantify the amount of noise that we could theoretically eliminate given the spec of the RFM69.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 03, 2016, 02:42:48 PM
Interestingly the app note you posted in a different thread regarding using the sx1231 (not sx1231h) to meet FCC regulations lists some sensitivities which are not as low as you might expect (one uses Fdev 5kHz, RxBw 10kHz with sensitivity quoted at -113.9dB). It's possible there's some specmanship going on.
http://www.semtech.com/images/datasheet/fcc_digital_modulation_systems_semtech.pdf

Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 03, 2016, 07:05:07 PM
Are you referring to the first entry in Table 1 of that document?  There the quoted bitrate in that instance is 4.8kbps, and the SX1231H datasheet does list -114dB as the sensitivity for that Fdev and Bw at 4.8kbps. 

I am just now noticing though that in order to get to the -120dB sensitivity, as compared to the regular -118dB sensitivity at 1200bps, you need to "Set SensitivityBoost in RegTestLna to 0x2D to reduce the noise floor in the receiver."

I wonder what the downside is to using it?  i.e. why not just always have it set to "reduce the noise floor in the receiver"?  Looking at Figure 8 in the datasheet reveals there's some kind of trade-off such that higher sensitivity comes at the cost of lower linearity, but unfortunately I don't have an intuition as to what the significance of that is.



Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 03, 2016, 09:27:53 PM
Good news!  By enabling SensitivityBoost and by using Perky's RFM69 1200bps radio configuration numbers (https://lowpowerlab.com/forum/index.php/topic,1434.msg10454.html#msg10454), the Moteino R4 with the solder tacked antenna produces the type of very low RSSI numbers that, on their face, seem plausible for a Semtech radio that alleges -120dB FSK sensitivity:

http://pastebin.com/wNnBxaVH
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: emjay on February 04, 2016, 06:44:02 AM
@WhiteHare,

Quote
I wonder what the downside is to using it?
Nothing comes for free - the Rx current consumption goes up significantly, so this would be a potential issue for battery powered nodes.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 05, 2016, 03:26:58 PM
Since no one had any specific part recommendations,  :(, I went ahead and ordered the choke and 7 different EMI filters that I linked at the beginning of the thread.  I probably didn't do a good job spec'ing or choosing them, so it's very nearly a shot in the dark.  Be that as it may, now that I'm able to read ambient RSSI on the RFM69 all the way down to -127, I'll try them out as best I can and see if any of them yield noticeable improvement when running from a DC voltage source that's mains powered and with other possible interferers on the same circuit.  I also have a rig I can use for testing purposes to insert components between the radio module and the atmega328p and other board components to test the choke and filters for effect if used in that way.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: joelucid on February 11, 2016, 11:31:59 AM
Hey WhiteHare,

interesting investigations - I'm just now catching up on all the RSSI posts of yours. Did you already get a chance to try the parts you ordered?

I still like the idea of a esp8266/moteino board as simple install server and internet gateway. But your numbers looked like I'd have to expect a significant RSSI degradation. Not quite as bad as it is periodically with the Pi. But I would consider an impact of -12 or so pretty significant. Esp. now that I'm putting a few TH Motes based on the lower power RFM69CW together.

Joe
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: WhiteHare on February 11, 2016, 12:26:35 PM
Did you already get a chance to try the parts you ordered?


Not yet.  The choke turned out to be so tiny I'm not sure yet how I'm even going to solder it.  If I put it on a breakout board, I'm afraid it may undermine its effectiveness.  I may have to shelve them until someday, when I learn how to make my own PCB's.  Unfortunately, I don't think "someday" will be soon!
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: Felix on February 12, 2016, 02:32:51 PM
Sorry if this is totally random, but I think it has some value with respect to the overall topic:

Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: perky on February 12, 2016, 06:04:07 PM
A little simplified, but OK for basic understanding. This is mainly about cross coupling and EMI within a circuit, we're also concerned with how this gets coupled onto the power supply wires, and what happens where the signals enter or exit a box. For that minimising common mode noise is very important. The Handbook of Black Magic should be in all engineers' libraries  ;)
Mark.
Title: Re: Best way to isolate/mitigate conducted EMI affecting an RFM69 Moteino?
Post by: Felix on February 17, 2016, 04:27:12 PM
Another video about EMI in relation to signal integrity:

https://embed-ssl.wistia.com/deliveries/c8dde81c580b65be8538587acc77ddc999443ee8/file.mp4

More of these videos here (https://www.protoexpress.com/blog/eric-bogatin-designcon-2014/), (DesignCon 2014 by Eric Bogatin).