Author Topic: AGC always selects maximum gain  (Read 5660 times)

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: AGC always selects maximum gain
« Reply #15 on: April 05, 2016, 06:18:06 PM »
Quote
must be something that's conducted rather than RF.

That's the conclusion I already arrived at due to my earlier measurements. But it got more puzzling after this data: It's something that does not cause the noise floor to increase significantly (when compared to a simple usb power source). Yet it significantly decreases received signal strength periodically.

I've pretty much given up on the Pi. Not only after helping a friend reinstall the 3rd one after corrupted flash. I think the ESP8266 gw will be much simpler and more reliable. This datapoint was posted just for completeness sake.


joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: AGC always selects maximum gain
« Reply #16 on: April 06, 2016, 11:01:04 AM »
I did some tests on the noise structure of a moteino hooked up via FTDI cable to a MacBook using RFM69 standard settings. I measured RSSI over the course of a second and recorded which values appeared how often. The histogram is pretty interesting (first column -RSSI * 2, second column Count):

Code: [Select]
131 ->   1
135 ->   1
147 ->  25
148 ->  35
149 ->  57
150 ->  89
151 ->  29
152 ->  26
153 ->  36
154 ->  14
155 ->  22
156 ->  40
157 ->  19
158 ->  19
159 ->  60
160 ->  48
161 ->  69
162 -> 114
163 ->  49
164 ->  58
165 -> 164
166 -> 105
167 -> 120
168 -> 324
169 -> 186
170 -> 200
171 -> 435
172 -> 208
173 -> 164
174 -> 231
175 ->  77
176 ->  87
177 -> 193
178 -> 142
179 -> 174
180 -> 437
181 -> 312
182 -> 442
183 -> 1000
184 -> 500
185 -> 436
186 -> 551
187 -> 150
188 -> 137
189 -> 256
190 -> 120
191 -> 109
192 -> 272
193 -> 133
194 -> 127
195 -> 236
196 ->  95
197 ->  76
198 ->  83
199 ->  21
200 ->  21
201 ->  20
202 ->  11
203 ->   3
204 ->   4
205 ->   1
206 ->   2
207 ->   1
209 ->   1
217 ->   1
218 ->   2
221 ->   2
235 ->   1
252 ->   1
253 ->   1

Note how broad the range is. If one uses the upper boundary (~147 = -73 dBm) as floor one loses a lot of dynamic range. Also note just how noisy this is. On a battery node I get an upper boundary of ~207!

If you want to use AGC/AFC you still need to set a fairly low RSSIThresh so you preserve dynamic range. When you get a noise RSSI detection that mistakenly starts RX you need to notice and restart RX. That can be done with RXTIMEOUT2.

It gets pretty complicated and nobody has really noticed any pain from always running the amp at max gain. So unless AFC is necessary it might be ok to keep the current behavior.

There's seems to be an opportunity here to create a low noise Moteino that doesn't have these issues. Or at least a low noise gateway.

Joe

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: AGC always selects maximum gain
« Reply #17 on: April 06, 2016, 02:28:10 PM »
I wonder how much it even matters.  The gateway won't be battery powered, and the nodes will mostly be listening, but on batteries.  It might increase their transmits, but....

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: AGC always selects maximum gain
« Reply #18 on: April 06, 2016, 03:40:00 PM »
Quote
I wonder how much it even matters.

The case where it matters is a sensor installed in a difficult location. When it sends updates the gateway won't be able to take full advantage of the receiver's sensitivity exactly because it is AC powered and suffers from noise.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6462
  • Country: us
    • LowPowerLab
Re: AGC always selects maximum gain
« Reply #19 on: April 06, 2016, 04:28:38 PM »
Quote
I wonder how much it even matters.
... it is AC powered and suffers from noise.
What noise do you mean?

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: AGC always selects maximum gain
« Reply #20 on: April 06, 2016, 04:41:05 PM »
Quote
What noise do you mean?

If you just take RSSI readings during RX while nobody is sending anything you can measure the background noise. In this thread I've documented how the background noise is significantly higher in AC powered Moteinos than in battery powered ones.

The worst results were when powered via FTDI adapter from a macbook. There's a difference of 30 dBm between the top of the noise floor of a battery powered Moteino and one powered from the mac (that's 3x the difference between W and HW).

Since these readings are higher than your RSSI threshold the AGC is performed while no signal is being sent, resulting in erroneous results. That's not too bad since it causes the amp to always be set to max gain which seems to be ok even for strong signals.

But the noise they represent will also cause bit errors when trying to receive weak signals. Say if you're trying to rx a -110 dBm signal with -80 dBm of noise at the receiver.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6462
  • Country: us
    • LowPowerLab
Re: AGC always selects maximum gain
« Reply #21 on: April 07, 2016, 08:11:31 AM »
That to me sounds like a very noisy environment either caused by a poor power supply or massive EMI from your macbook.
50-60hz AC should not cause that type of noise all by itself. For instance in my SwitchMotes I don't see what you report at all and they sit in electrical boxes with a AC-DC supply (SwitchMotePSU) right underneath. They work great.

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: AGC always selects maximum gain
« Reply #22 on: April 07, 2016, 08:17:56 AM »
Quote
That to me sounds like a very noisy environment either caused by a poor power supply or massive EMI from your macbook.

Yeah the mac is by far the worst culprit here. All other supplies I've tested are much better. Also you wouldn't notice this with your settings necessarily. At least the order of magnitude I get from non Mac power supplies. This is important for long range scenarios where you want to receive down to -115 dBm or so. That so far I can only make work with batteries. With a normal power supply you should be able to go down to around -100 dBm.

But a common mode choke, a ferrite bead and smaller decoupling caps might make it work on AC as well. 

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: AGC always selects maximum gain
« Reply #23 on: April 07, 2016, 10:19:44 AM »
As a quick and easy fix for the mac book (or similar) scenario, I wonder whether a USB isolator might help.  No kidding, there used to be one called "The Decrapifier", though I'm not sure whether it's still manufactured or not.  One of the RTL SDR vendors (the one who makes/sells a modded version with a 1ppm crystal) recommended it. 
« Last Edit: April 07, 2016, 10:34:40 AM by WhiteHare »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: AGC always selects maximum gain
« Reply #24 on: April 07, 2016, 03:31:02 PM »
Potentially yet another instance of the cycling 20db RSSI phenomena:  https://lowpowerlab.com/forum/index.php/topic,814.0.html
With benefit of hindsight, it's unfortunate he wasn't more detailed about his test conditions.