dgiardini / rtl-ais

A simple AIS tuner and generic dual-frequency FM demodulator
Other
264 stars 90 forks source link

TCP LISTENER/Host network forward issue #35

Closed saikumarelab closed 1 year ago

saikumarelab commented 3 years ago

Hi, I'm an independent research scholar and I'm actually trying to receive the AIS signal reception. I could see the least signal reception compared to commercially available ais receiver in the market. I'm actually going a comparitive analysis on how effectively we could use the open source resource to achieve the requirements. So in this case I'm using commercial ais receiver with scan brand ais antenna Vs raspi integrated neolec nano3 sdr connected with scan brand ais antenna. I could see more signal reception at the commercial one than our open source. Also I found issue with tcp listener and network forwarder. The following command to run the rtl ais system is

rtl_ais -l161.976M -r162.025M -h192.168.0.9 -P10110 -n -R

It is not working...the static ip assigned to the same raspberry pi is 192.168.0.9

Whereas if I pass the following command

rtl_ais -l161.976M -r162.025M -T -P10110 -t120 -n -R

Everytime I need to open and close the socket to update the incoming string. So my question is

  1. How to increase the incoming signals or increase the accuracy of detecting the ais signals
  2. How to make the data forwarding to another ip address
  3. How to make the tcp listener always receive without closing the socket connectivity.
  4. Does ppm calibration helps us to increase the signals?

Could you please help me on this.

Thanks in advance. SAI

dgiardini commented 3 years ago

Hi SAI I'll quote your questions

How to increase the incoming signals or increase the accuracy of detecting the ais signals You'll need a good antenna suited for 162 Mhz. If your rig works fine with the commercial receiver that's good enough.

How to make the data forwarding to another ip address You could yo use UDP to send data to any IP address, even outside your LAN to the Internet. Don't use the -T flag and the data will be sent to the IP specified by the -h parameter. I suggest OpenCPN as application for testing, it could receive UDP data and be a TCP client as well.

How to make the tcp listener always receive without closing the socket connectivity. That is a work in progress. Recently a Mik3y, a github contributor, added a -k flag for keep open the TCP connections. I didn't merged yet because I can't compile the new code on Windows and I want to keep the thing portable. But if you are on Linux and need this, you can clone his code from here: https://github.com/mik3y/rtl-ais

Does ppm calibration helps us to increase the signals?

Absolutely ! This is the most probable reason you are not receiving messages. As analogy, think the dongle as an old radio receiver with a rotatory tuning dial off of place by some Mhz. If you know how much angle you have to add or subtract to the reading of the tuning dial, you can find any frequency with accuracy.

Analogously, all the rtl-sdr dongles comes out from the factory "out of tune"; but if you know the amount, you could use the ppm parameter to correct this and all will work fine. Think ppm parameter as mandatory!

Aside from all this, you don't need to specify the frequencies for the AIS channels.

Hope this helps

David

On Fri, Feb 12, 2021 at 12:25 PM saikumarelab notifications@github.com wrote:

Hi, I'm an independent research scholar and I'm actually trying to receive the AIS signal reception. I could see the least signal reception compared to commercially available ais receiver in the market. I'm actually going a comparitive analysis on how effectively we could use the open source resource to achieve the requirements. So in this case I'm using commercial ais receiver with scan brand ais antenna Vs raspi integrated neolec nano3 sdr connected with scan brand ais antenna. I could see more signal reception at the commercial one than our open source. Also I found issue with tcp listener and network forwarder. The following command to run the rtl ais system is

rtl_ais -l161.976M -r162.025M -h192.168.0.9 -P10110 -n -R

It is not working...the static ip assigned to the same raspberry pi is 192.168.0.9

Whereas if I pass the following command

rtl_ais -l161.976M -r162.025M -T -P10110 -t120 -n -R

Everytime I need to open and close the socket to update the incoming string. So my question is

How to increase the incoming signals or increase the accuracy of detecting the ais signals How to make the data forwarding to another ip address How to make the tcp listener always receive without closing the socket connectivity. Does ppm calibration helps us to increase the signals?

Could you please help me on this.

Thanks in advance. SAI

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

saikumarelab commented 3 years ago

Hi David,

Thanks a ton for your prompt reply. People like me expect these sort of support from the open source community and you are really supporting my research. Please find my comments below for your answers.

  1. The antenna which I'm using is SCAN brand AIS antenna
  2. If I use opencpn to merge the incoming udp and outgoing tcp client then I need to run the opencpn application on every start/boot for monitoring the ais strings. I'm trying to automize the rtl_ais command on boot so that when I power on the rpi, it should connect to network router and from there I'll get the ip address of rpi and use it in opencpn desktop applications installed on another computer of same network -> connect to rpi ip and port so that I'll start seeing the ais plot on opencpn map.

Is there any way where you can guide me to achieve this?

  1. I use neolec nano3sdr and when I run rtl-sdr -p for ppm error test I see the cumulative ppm is -2 in average. So in your rtl_ais command there is an option to add ppm error. I tried the same but I didnt find any changes except the reception process got slowed down.

Could you please help me to automate the ais reception at pi boot so that it connect to network and forwards the data to the same rpi ip and port 10110.

Thanks in advance

dgiardini commented 3 years ago

On Fri, Feb 12, 2021 at 4:47 PM saikumarelab notifications@github.com wrote:

Hi David,

Thanks a ton for your prompt reply. People like me expect these sort of support from the open source community and you are really supporting my research. Please find my comments below for your answers.

You are welcome

The antenna which I'm using is SCAN brand AIS antenna

Perfect

If I use opencpn to merge the incoming udp and outgoing tcp client then I need to run the opencpn application on every start/boot for monitoring the ais strings. I'm trying to automize the rtl_ais command on boot so that when I power on the rpi, it should connect to network router and from there I'll get the ip address of rpi and use it in opencpn desktop applications installed on another computer of same network -> connect to rpi ip and port so that I'll start seeing the ais plot on opencpn map.

Is there any way where you can guide me to achieve this?

You can send data to "all" your local network using UDP and the broadcast address of your LAN. That address is like the you RPI or any other device connected to your LAN, but with the fourth digit = 255.

If your IP is 192.168.0.9; the broadcast address is 192.168.0.255.

So you can use:

rtl_ais -p 75 -h 192.168.0.255 (75 is my dongle's ppm error )

and the data would be sent to all the computers to the LAN, even to the RPI itself using UDP and port 10110

After you test the parameters, for starting process on boot you need to add your working commands to the "/etc/rc.local" file in your RPI. Google a little about this.

So you can add to rc.local some lines like these:

rtl_ais -p 75 -h 192.168.0.255 & # <- don't forget the & !!! sleep 5 # give it some time opencpn & # start opencpn program.

I use neolec nano3sdr and when I run rtl-sdr -p for ppm error test I see the cumulative ppm is -2 in average. So in your rtl_ais command there is an option to add ppm error. I tried the same but I didnt find any changes except the reception process got slowed down.

The neolec nano3sdr claims a ppm error of 0.5 in theory you shouldn't need ppm correction. I used rtl_test -p and the values are close but differs from the real one by 5 to 10 units, which is significant. I suggest you using other calibration approach, you can even use a MS Windows program with the same dongle if you feel comfortable with it. There are many tutorials for that, just look for ppm calibration.

Could you please help me to automate the ais reception at pi boot so that it connect to network and forwards the data to the same rpi ip and port 10110.

Check above

Good luck !

Mbungurz commented 1 year ago

Hi @dgiardini im trying use rtl_ais and have same problem with @saikumarelab, my openwrt ip is 192.168.1.1 : 1234, when i use command Rtl_ais -n -h 192.168.1.255 -P 1234 it just aborted, how can i fix this?

Mbungurz commented 1 year ago

16777374700001553304937928052013 This is the result

dgiardini commented 1 year ago

Please test it sending messages to the openwrt IP i.e. 192.168.1.1. If that works, the error could be something related to your system confuguration, check your system messages in /var/log messages or equivalent .