B4R Question Arduino over the internet

Discussion in 'B4R Questions' started by ALEX BISSARO PITTA, Sep 20, 2018.


    ALEX BISSARO PITTA Member Licensed User

    How can I connect Arduino with my cell phone over the internet by using 4G or another wi-fi connection? I'm using udp connection by the way.

    Should I make any changes on B4R and B4A program?
    I have a modem1 with external IP and a wi-fi router2 connected to arduino by means of ethernet cable.
    Should I make any port forward configuration on the router, VPN connection? What is the right way? How to do it?
  2. Peter Simpson

    Peter Simpson Expert Licensed User


    ALEX BISSARO PITTA Member Licensed User

    Thanks Peter.
    The only problem to me now is that the application is ready and already running on local network. I only needed to make it work by outside the LAN.
  4. Erel

    Erel Administrator Staff Member Licensed User


    ALEX BISSARO PITTA Member Licensed User

    What' I undestood from this tutorial is that I need to turn my PC into a server by means of B4J application. Right?

    Nowadays I'm sending the Udp packets from B4A to B4R directly and vice versa, only locally.
    In this way probably I need to reconfigure all the UDP_SendPackets and UDP_ArrivedPackets to have the server beetween B4A and B4R. Right?

    Is there no other way without creating the B4J server?

    Please feel free to correct me.
  6. tigrot

    tigrot Well-Known Member Licensed User

    It should be pubblicly accessable.
  7. lemonisdead

    lemonisdead Well-Known Member Licensed User

    I wonder if the mobile network operator wouldn't filter any UDP packet
    tigrot likes this.
  8. tigrot

    tigrot Well-Known Member Licensed User

    Probably it does...
    lemonisdead likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

    No. You don't need a PC at all.

    You need to understand the process required to open a PC to the internet and do the same thing for your Arduino.
  10. mark35at

    mark35at Well-Known Member Licensed User

    Give your Arduino a fixed IP and then on the router, delegate a through port which goes to this IP. Connecting to your external IP with this port should take you directly to your Arduino.
    Mostez likes this.
  11. iCAB

    iCAB Well-Known Member Licensed User

    Based on your configuration, things may vary

    1. Arduino connected to local area network.
    In here to reach the Arduino, you will have to do this

    • Configure your cell phone or whatever device is sending data to the Arduino, to push packets to your internet external IP address and to a specific port ( as an example use port 5000 )
    • Configure the Arduino with a static IP address on your local area network ( as en example:
    • Configure your router to forward port (5000) to the Arduino fixed IP Address ( )
    • make sure the port is not blocked by the router firewall.
    Your system will work no different than on a local network

    2. Arduino is connected to the internet directly using the cell modem and if the SIM is M2M, you will need a middleware or at least a known configuration. Also in this case, you need to know that many operators limit the incoming traffic (meaning how long the listening port stays active after the last message sent by the device).

    ALEX BISSARO PITTA Member Licensed User

    I'll try to make the port forwarding from the cell phone to arduino.

    How the arduino will know wich external address to send information back to the cell phone? Should I configure something in the arduino?
  13. tigrot

    tigrot Well-Known Member Licensed User

    I use a small program on my web server, which replies with public address of the calling client.

    ALEX BISSARO PITTA Member Licensed User

    99% of the time I'm using the app inside my local home automation connection, almost never by outside.
    It's not the most fancy way, but as the app is only for my own House Automation, I decided to keep a local unused cell phone at home installed with Host Teamviewer. Whenever it's necessary I connect any external device (cell phone or computer) to my local host cell phone doing whatever I want.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice