Problems with TCP connection via 4G dongle

Hi to everyone! I hope someone can help me.

I want to connect my drone via TCP using a 4G dongle mount on the drone, I already have all the setup with Pixhawk4 and Raspberry Pi 4. I already do flight missions via UDP connection, using the 4G Dongle for telemetry short distance missions, just for endurance flight time. I am using Mavproxy to do the UDP and TCP connection.

The steps I do to communicate the drone via TCP to the QGroundcontrol are:

mavproxy.py --master=/dev/serial0 --baudrate 921600 --out=tcpin:192.168.100.82:14550 --aircraft Mycopter

The IP is the RPI on the 4G router connection, I set the TCPin out that IP because I need that to receive en send the telemetry.

Then I create a TCP tunnel on another terminal on the RPI, using ngrok. I use this command:

ngrok tcp 14550

I select the 14550 port because I want to send and receive the information in that port of the drone that I use on the mavproxy command. It looks like this:

image

Finally, I go to QGround control and do a “common link” and create the TCP connection like this:
image

And In my terminal of the TCP show me that I made a connection but the QGround control Reject the server and never do the connection access that assigned port.

What I want to do is just Remote telemetry with 4G dongle mount on the drone, and communicate it with QGroundControl to another computer with a different Internet service.

2 Likes

Hey Alejandro,

My team and I have a lot of experience in this. There could be a lot of reasons that this is not working (many of which actually reside with the ISP you are using)

May I ask what Internet provider and 4G dongle you are using?

1 Like

Also, feel free to reach out to me at andrew.wilkins@ascendengineer.com

I respond faster on there

1 Like

and can post resolution here when done

1 Like

Hi Andrew!

Yes of course, I send you a email in a few moment.

Sounds great to me, I really like to share my knowledge to everyone😁

The IP you’re using 3.129.187.220, that’s the resolved IP address for 4.tcp.ngrok.io?

From the same machine that you’re running QGroundControl on, can you telnet to 3.129.187.220 15199? That’s a good sanity check to ensure you’ve got your tunnel working all the way through.

1 Like

Yes, IP address for 4.tcp.ngrok.io is 3.129.187.220.

Yes, I already made a ping to that IP:port in my computer, and the server receive the connection to the Rpi, the “ttl” show me the connections.

Have you tried specifically telnet 4.tcp.ngrok.io 15199? From another machine. It goes beyond ping - your mavproxy listener should be the one that answers you for that request. If you get data you don’t expect, then that’s useful problem solving data.

1 Like

Yes, I actually do that.

But mavproxy don’t create or send any information, just refused the network connection, but my server shows me the telnet is successfully connected.

I create another connection, and do all the before steps, and on my QGroundControl config this common link:

image

The shows me this

image

But the socket server receives the request, the one on the right terminal “ttl” I tried 7 times to connect, but the socket close the connection:

I am thinking the problem is this:

Do I need to paid maybe to allow the TCP addresses?

I’m seeing the same as you are if I try and set the same setup up. (netcat taking the place of mavproxy, but from a protocol level the same things should be happening). Seems like you’ll have to upgrade to paid to get a TCP connection across ngrok, like you said.

1 Like

Yes! But there is no other way to achieve that? (free option)

I am a 5th-semester mechatronics student in Mexico and I just want to apply this to a scholar project. But I need to do more research to find something free just for basics autonomous missions. If you know something or find anything that can help me I will appreciate that!

https://pagekite.net/wiki/Howto/SshOverPageKite/

There’s another service called PageKite which offers something similar. It’s going kind of deep here, but if you use PageKite and set up SSH HTTP proxying, you could then use SSH to provide port forwarding for you.

Details on SSH port forwarding here:

TCP 14550 → SSH 14550 → HTTP Proxy through PageKite → SSH 14550 → mavproxy 14550

It’s a bit convoluted and I’ve not tested it, but it might be possible (and free).

1 Like

Zerotier would be a good candidate here. Then you can simplify the ssh port forwarding.

2 Likes

Thank you so much! I am going to try both solutions, we keep in touch😁

It works perfectly with Zerotier!!! I am actually having long-range telemetry via 4G connection, in a few moments I am going to post my steps to achieve that! Thank you soooo much @ryanjAA

2 Likes

Did you get everything to work now? Could you share your solution?

1 Like

@DrDrone set up a virtual private network between the companion and GCS computer (i.e. install a VPN system like zerotier (opens new window)on both computers). The companion then uses mavlink-router (opens new window)to route traffic between the serial interface (flight controller) and GCS computer on the VPN network.

This method has the benefit that the GCS computer address can be static within the VPN, so the configuration of the mavlink router does not need to change over time. In addition, the communication link is secure because all VPN traffic is encrypted (MAVLink 2 itself does not support encryption).

https://docs.px4.io/master/en/peripherals/companion_computer_peripherals.html

ZeroTier great canidate instead of having to pay for a static ip. Nice

2 Likes