Remote Access (IOT) to my Arduino via a smartphone

Hi,
I have an arduino mega with the wifi built in. The mega also connects to a 4D systems LCD screen.
At the moment I do not use any of the wifi functionality.
From the LCD screen I can control the programe within the arduino as per the code I have written.
This works perfectly.

Now I want to control the Arduino programe from a smartphone (IOT).
The LCD screen has control commands it sends to the Arduino to perform tasks and also reads data from the Arduino for feedback to the user.
Now I want the smartphone to replicate or at least code in parallel to the existing LCD control commands and feedback to/from the smartphone.

For example. The LCD will have a START button command that is sent to the Arduino, the Arduino performs something and provides feedback. With the smartphone how do I activate the same START command within the Arduiono code? Or, do i program a separate START command from the smartphone that is programmed in parallel to the LCD START command in the Arduino code.

RobCb:
With the smartphone how do I activate the same START command within the Arduiono code? Or, do i program a separate START command from the smartphone that is programmed in parallel to the LCD START command in the Arduino code.

Probably the latter, which, on reflection, is the same as the former.

Perhaps you should look at the various wifi client/server server setups available for your board.

Are you kidding me, this video is about a race driver, how does that help me with my issue

I don't suppose there is any point in asking which video you are referring to, is there?

Hi Nick,

So sorry about that. The layout of the forum tricked me. I do apologise.

There is a reply from Zoomkat that has the youtube video i am referring to. This morning when i read the replies i thought it was from yourself. Now, when I am reading the replies I notice it was from Zoomkat.

Again, sorry.

Oh, that video........
If Zoom can stay away from his stupid bloody car, you will find him very knowledgeable in the Arduino communications arena.

Looking back at your original, it would seem that you need to send the same commands you do now. You may have problems with a typical IoT service, as there is a limit on the update frequency.

"There is a reply from Zoomkat that has the youtube video i am referring to."

You talking about the video link in my "signature file"? That is something one can do if they don't worry about wrecking their toy. I've got 126k miles on mine and it has to last as probably the "last toy".

Now I want to control the Arduino program from a smartphone (IOT).

To answer, you need to decide whether the control you want from your smartphone is always going to be local or whether this control could be from anywhere (and thus requires Internet connectivity).

Local control means that you could set up the mega as a direct Access Point or you could connect it to your router for local area network access. In both cases you could then set up the mega to act as a local server.

If you want access to the Mega anywhere, which requires Internet access, then suggest you look at MQTT via an mqtt broker as this provides 2-way comms via publish/subscribe model. Other options (as there are libraries available) could be Google Firebase as this is quite a handy for smart phone apps etc.

Yes i do require internet access.
Is a client/ server setup

https://learn.adafruit.com/category/adafruit-io

There is a great swag of stuff on YouTube, mostly for ESP32, but equally applicable to your setup. While I made comment about update time, this may not apply with an MQTT setup.

Yes i do require internet access. Is a client/ server setup

If you require Internet access you may need to consider intermediary infrastructure, such as the cloud, as whilst technically possible, accessing your wifi enabled Arduino Mega (server) directly via the Internet from your phone is not advisable from a security point of view. Otherwise you would need to look at how your local router connects via the Internet and whether you have a fixed IP etc. for direct access from your phone (if treating that as your client).

If you want to avoid all that tinkering to get direct access, my recommendation would be for you to first consider what you can do with your phone (i.e. how are you going to get the client to talk with a server).

If you do not want to do any coding on the phone then maybe https://blynk.io/ would work for you.

If you want to use MQTT, as originally suggested, there are also plenty of mqtt utility apps available for your phone, which are free to use. The challenge here is finding a free or low cost cloud-based MQTT broker or setting up a broker yourself.

If coding via phone is on your list of todo's then another option is Firebase (as mentioned) as this integrates quite well with mobile app software dev etc. Another option is https://www.pubnub.com

You can also find Arduino libraries for either.

Another possible option is Peer to Peer (a bit like web rtc protocol). Something like https://www.nabto.com/ will do the trick. But this may involve coding and a cost.

If you want to switch to ESP32, you could consider the big cloud options such as AWS or Azure, etc. Libraries available here too and this will also help you set up the security certs etc.

Finally, another handy option for ESP32 only, which also includes a mobile app, a cloud-based broker and Arduino code (and has a free to use option) would be mDash: IoT Cloud

zoomkat:
"There is a reply from Zoomkat that has the youtube video i am referring to."

You talking about the video link in my "signature file"? That is something one can do if they don't worry about wrecking their toy. I've got 126k miles on mine and it has to last as probably the "last toy".

Nice video, I did not realise it was part of your signature.

Thanks everyone for the good advice.
There is a lot of information here that is all new to me and the issue for me is I don't really know which road to take.
It looks like I will need to do more research with the advice given.
Thank You.

If you want access from anywhere via internet, the various providers (brokers) are the best place to start as they have their own way, maybe their own libraries, and will provide examples specifically for Arduino. If they don't, you don't want to know them.