jvde-github / AIS-catcher

AIS receiver for RTL SDR dongles, Airspy R2, Airspy Mini, Airspy HF+, HackRF, SDRplay and SoapySDR
https://aiscatcher.org
GNU General Public License v3.0
474 stars 76 forks source link

Automatic Gain Control #53

Open Taxom opened 1 year ago

Taxom commented 1 year ago

Hi Jasper! Is it possible to implement the Automatic Gain Control (ADAPTIVE_DYNAMIC_RANGE and ADAPTIVE_BURST) by type of what is implemented in DUMP1090-FA?

Thank you so much for the work!

jvde-github commented 1 year ago

Hi, I am not familiar with this software and implementation so definitely worthwhile to look into. I also saw recently this snippet: https://www.rtl-sdr.com/tag/automatic-gain-control/. Worthwhile to look into and great suggestion.

At the same time I am trying to create plots in the webpart to help calibrate the dongles. The PPM graphs are reasonably useful to calibrate frequency. The gain plot is rubbish and needs work.

I will definitely look into this. Thanks for the reference.

Taxom commented 1 year ago

I'm talking about it https://github.com/flightaware/dump1090/blob/master/README.adaptive-gain.md

jvde-github commented 1 year ago

Thank you

Taxom commented 1 year ago

It works very well for taking ADSB and since the types of signals and the conditions of reception are similar, in theory it should also work well with AIS.
Screenshot 2023-01-11 at 14-51-08 graphs1090 Performance Graphs

jvde-github commented 1 year ago

Good pictures to illustrate the approach. Need some time but will have a look.

Taxom commented 1 year ago

I also noticed something strange, immediately after the Ais-Catcher restart, there is a reception of distant and weak signals, but then they stop. AGC is turned off. Here are my settings: -d 00000162 -v 10 -M DT -gr RTLAGC off TUNER 38 -a 100K -s 1536k -p -1 -o 4 -u 127.0.0.1 10111

Taxom commented 1 year ago

9min after restart ais-catcher

Screenshot 2023-01-11 at 15-55-55 AIS-catcher MaxPi_AIS

Taxom commented 1 year ago

30min after restart ais-catcher These are not ships, but basic stations and navigation buoys, so that the signal level from them should be approximately constant. Screenshot 2023-01-11 at 16-16-52 AIS-catcher MaxPi_AIS

jvde-github commented 1 year ago

Is there a way to structurally test and repeat this, e.g. by recording a signal using rtl-sdr? I don't necessarily see anything from the two tables.

Taxom commented 1 year ago

I noticed this in the process of setting gain. It’s just that every time I change the gain level, I received a reception of weak signals, but after a short time they disappeared. I again changed of gain level and the situation was repeated, then I noticed that just restarting the Ais-Catcher is the same thing. I will still experiment with this and let you know how stable it is.

jvde-github commented 1 year ago

Please keep me posted. I have tested the decoder many times by running a file with a weak signal in an infinite loop and the decoding quality does not deteriorate in all my tests. This is also not expected as there is virtually no memory in this system.

The other culprit might be how we interface with the dongle. But if I run rtl_sdr and pipe the input into AIS-catcher the results will not change.

However, the effect you described I have seen as well in the past. Not in my current setup but I saw in a different system. Perhaps more accurate to say that I suspected it. I have given up trying to understand what was going on. For what system are you observing this?

I have seen other weird things. For example, when the processor load on my RPi increases the message rate drops. I have recorded 30 seconds at 162 MHz and increased the processor load after 15 secons. You see that this has an impact on the RTL-SDR signal: image

This is the CPU Frequency at the same time: image

Understanding and optimizing reception is very difficult, at least for me. In general I did observe better results for a Mini PC than the RPi and suspected it was the hardware and not software related.

I look forward to further insights if you find out more.

ROSTOCHE commented 1 year ago

The software works very well with an RSP1A. The only problem encountered is with a passenger Ro/Ro and therefore equipped with an A transponder. I only see it very rarely, whereas other boats equipped in the same way and located just alongside are perfectly seen. I've tried different values ​​at the LNAstate level with no noticeable change. At the level of the table of tables I have seen twelve boats... Is there a number limit for displayed boats? Thanks in advance for the responses.

jvde-github commented 1 year ago

There is no limit to the number of vessels displayed. I have ran it with Norwegian coastal data as input (~3000 vessels) to stress test and it still works then. So must be something else.

Are you missing the vessel in the webclient or also in the UDP output?

I find it difficult to say anything sensible. Is it one particular vessel? If you do capture the signal occasionally might be worthwhile to have a look at the signal level and drift in the output (-M DT -o 3 or -o 5) and compare that against the nearby vessels that you do receive. And start from there.

Worst case you might wat to run it with a simple FM decoder:

AIS-catcher -m 0 

This decoder receives less messages than the default one but less sensitive for frequency drift in a signal. You might also try to see if you can use a simple RTL-SDR dongle if you have happen to have that at hand.