Hi,
I have an IoT project in which I need an Arduino A (Nano) connected to the Internet via WiFi to send data to a different Arduino B (Nano) over the Internet which is not in the same network. (say A is in your house and B is in your college/office.)
Is there any way I can achieve this?
All I need is to send data as fast as possible.
The data will be simple instructions like different voltage levels for controlling servos.
Thanks
1 Like
This is quite possible to do but first you need to add WiFi capability to the Nanos. Have you got something in mind for this ?
UKHeliBob:
This is quite possible to do but first you need to add WiFi capability to the Nanos. Have you got something in mind for this ?
Hi UKHeliBob,
Thanks for the quick reply,
Yes, I will be connecting the Nanos to ESP-01 wifi module so that they can connect to the WiFi networks. Also, I would prefer if the data is sent via a cloud as I have heard it is easier for transferring data but it is not a compulsion.
Can you please tell me how can it be done?
Do you have NodeMCU board like this:
which has built-in WiFi?
GolamMostafa:
Do you have NodeMCU board like this:
which has built-in WiFi?
No, I am using an ESP-01 module something like this
I am not using the ESP8266 as I am having an analog input and the second arduino is controlling servos
"Is there any way I can achieve this?"
Probably. Get it working at your house first on your network, then expand to communication between networks. I'd suggest you get a board with built in wifi instead of adapting wifi to an arduino. Note that running a personal server on a business network might be problematic.
zoomkat:
Probably. Get it working at your house first on your network, then expand to communication between networks.
how do I expand to communicate between different networks is the problem I am facing there are hundreds of tutorials for communicating on the same network but none for between different networks.
zoomkat:
I'd suggest you get a board with built in wifi instead of adapting wifi to an arduino.
A board with builtin wifi has 2 problems for me
- If the board is an ESP8266 I cannot have voltages higher than 3.3V and there is only 1 analog port.
- If I use a different board with WiFi on board they don't fit into my design (need them to be compact)
also it doesn't matter much if the WiFi is on board or not as long as it connects to the internet and transfer data.
zoomkat:
Note that running a personal server on a business network might be problematic.
This hardly bothers me as there is no business network involved.
"how do I expand to communicate between different networks is the problem I am facing there are hundreds of tutorials for communicating on the same network but none for between different networks."
So what is the network you plan to use to connect between the two devices? If it happens to be the internet, then you might start looking into dynamic IP services.
zoomkat:
So what is the network you plan to use to connect between the two devices? If it happens to be the internet, then you might start looking into dynamic IP services.
As far as I have researched most people have said to switch from a dynamic IP to a Static IP so there isn't any problem in connecting the two Arduinos
How do I expand to communicate between different networks is the problem I am facing there are hundreds of tutorials for communicating on the same network but none for between different networks.
As far as I have researched most people have said to switch from a dynamic IP to a Static IP so there isn't any problem in connecting the two Arduinos
3 options I can think of:
If it were me I'd get 2 VPN capable routers, one for each end, and set up a VPN between them. Having a VPN means there is private, encrypted communication between the 2 networks.
You can send the data over the internet without a VPN, to do this you need to forward ports in each router to the devices you are using. The data will be exposed on the internet and not secure, and forwarded ports are a security risk.
Both the above need static IP addresses, or, if not static IP addresses then be prepared to have to occasionally reconfigure for new IP addresses.
You might also investigate MQTT, which uses an internet located server, which means not having a static IP address should not be a problem. I've played with MQTT but not used it for anything. Seems simple enough to use. Plenty of discussion on here about it.
PerryBebbington:
3 options I can think of:
If it were me I'd get 2 VPN capable routers, one for each end, and set up a VPN between them. Having a VPN means there is private, encrypted communication between the 2 networks.
You can send the data over the internet without a VPN, to do this you need to forward ports in each router to the devices you are using. The data will be exposed on the internet and not secure, and forwarded ports are a security risk.
Both the above need static IP addresses, or, if not static IP addresses then be prepared to have to occasionally reconfigure for new IP addresses.
You might also investigate MQTT, which uses an internet located server, which means not having a static IP address should not be a problem. I've played with MQTT but not used it for anything. Seems simple enough to use. Plenty of discussion on here about it.
Thank you for the suggestion will look into it. 
So, you want to do this the hard way?
I would use a Wemos D1 Mini or NodeMCU on each end and communicate over a public MQTT broker.
There's a bit of latency using a public broker, but in my experience the data is sent usually in a few ms.
Agreed with regard to the use of MQTT
It is easy to set up using the PubSubClient library
@nova1323 - do you have the hardware required and if so can you connect the two Nanos to your wireless network ?
UKHeliBob:
Agreed with regard to the use of MQTT
It is easy to set up using the PubSubClient library
@nova1323 - do you have the hardware required and if so can you connect the two Nanos to your wireless network ?
Yes I have the required hardware and can connect the two nanos to my wireless network.
Looking into MQTT and how to use it.
UKHeliBob:
Nano 33 IOT perhaps ?
Unavailable in India at the moment and ordering it from arduino.cc will take a long time for delivery and as I mentioned I am approaching my deadline. So, I guess I am stuck with the old Nano and ESP-01 combo
Thanks for the help
SteveMann:
So, you want to do this the hard way?
I would use a Wemos D1 Mini or NodeMCU on each end and communicate over a public MQTT broker.
There's a bit of latency using a public broker, but in my experience the data is sent usually in a few ms.
I understand using a NodeMCU or Wemos D1 Mini would make things easier as the WiFi module is inbuilt but I have 5 analog inputs working simultaneously while these boards provide only 1 analog pin