V
V
Victor P.2018-07-25 15:21:47
Arduino
Victor P., 2018-07-25 15:21:47

How is communication with the raspberry pi set up via the Internet?

Good afternoon!
I recently started playing with robots and the final goal is to build a spider robot that I could control from a computer (phone).
I wanted to use the following architecture:
Raspberry Pi (one of the latest I have) acts as a brain and an entry point, it is not difficult to screw a camera, wi-fi / bluetooth / gsm module, and related sensors to it. Raise a full-fledged web on it. server and implement a high-level api (go forward/backward/rotate/shift).
A duin is connected to the raspberry via usb (actually, I have Iskra JS, but it doesn’t matter in this matter). I looked in the direction of ethernet, but it is quite possible to make friends with them simply via usb. This squiggle will only steer the servos, move the legs.
Accordingly, the plan is such that I connect from a computer to a web server on raspberries (at least through a browser), send the command "forward" via api, raspberries parse it into low-level ones and by whom. The port sends the Arduino how it needs to rearrange the sticks. But here I seem to have missed the fundamental condition, while my raspberry sits on the local network with my home computer, my router issues an IP address and I can see the web from the computer. raspberry server. If desired, I can order a static IP from the provider, configure the router accordingly so that I can see the raspberry web host on the Internet and manage the raspberry from any device via the Internet. But, if I install a gsm module and take the robot to the field, then it will not have an IP address, in which case I will not be able to make a web server, since, in fact, this is a mobile phone with an Internet connection,
Please correct me if I'm wrong.
As far as I understand, I need a third regular web. server from any host. On raspberries, you need a client that, if there is a connection, will hammer on this server and establish a connection via web sockets. When I log in from the computer, a two-way connection is also established with this external server, which, in fact, will work as a proxy, forward calls from the computer to the robot and drive feedback.
Do I have the right way of thinking or am I doing some kind of nonsense?
I will be glad to any thoughts.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2018-07-25
@Jeer

You need some external server that will always "know" how to access your device.
On this server, you raise the VPN server, on your raspberry, you raise the VPN client.
Now it does not matter - whether at home from a router via WiFi, or in the field through an access point on your phone via WiFi - your device will always be visible to the VPN server.
Well, in fact, on the VPN server, you forward the ports from the outside that you need to your raspberry through the VPN.

A
Artem, 2018-07-25
@ulkoart

Can communication be given to a file or bluetooth? if not, then you can communicate with an external ip through a server, for a start you can try free-dns or something like that, but IMHO $5 for a droplet on DO is not much, and domains are not expensive either.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question