Hello everyone, For my girlfriends birthday, I want to build her a “friendship lamp”. Basically one of those lamps that has two lamp, and when one lamp is touched then the other lamp turns on. I plan on on using an arduino with WiFi equipped or an arduino with a WiFi module. The requirements for choosing an arduino/module is that both arduino’s must be able to connect to WiFi (at separate houses, so separate WiFi) and be able to communicate with each other. Essentially, when the button is pressed on one lamp, arduino sends signal to the other lamp (on separate WiFi) to pick relay to turn on the lamp. I did quite a bit of research and was unable to fully understand how the arduino’s with WiFi work and if it is possible for two arduino’s to communicate over separate wifi’s. I would greatly appreciate someone with more microcontroller knowledge to point me in the right direction. Thank you, I appreciate it! Charlie
This is definitely something two Arduinos can do. I would recommend using a standalone ESP8266 as an Arduino. They are cheap and super easy to get started connecting to WiFi. Also, ESP32 (next model up) has capacitive touch GPIO pins which would allow you to create a switch that is activated by just touching the lamp. I'm not sure if the 8266 does or not.
If you are hoping to communicate from one Arduino on a home network to another Arduino on a home network, I would also suggest that they both communicate with a central server on the public internet. While it would be possible to connect the two Arduinos directly, it would take a lot of network configuration that just doesn't make sense to do.
An ESP8266 based board is the way to go: get a NodeMCU or WeMOS D1 Mini board.
Look at Blynk for a way of sending messages over an MQTT server, this should be able to do what you're trying to accomplish.
The trickiest bit is probably the touch sensing, the TTP223 chip and touch sensors based on it may help you out. Place one or more of those sensors in your lamp, so when touching the lamp you're touching at least one of those sensors. There's no need to make the whole thing touch sensitive, just enough points so you will always touch one.
I do not know your level of knowledge on networks, but if you want the 2 Arduinos to communicate directly network to network you need to:
Give each one a static local IP address. On each router forward a port (same port on each) to that IP address.
You then send packets from one Arduino to the public IP address of the other one, using the port you forwarded in the router.
To find a port, search on the internet for something like 'commonly used UDP ports' and whatever you find, pick a different one.
An additional problem: your home routers have to be able to find one another. Most domestic supplies use dynamic IP addresses, meaning the address you're connected to can change at any moment. So it's very difficult to find each other. The most common solution to this is to set up a dynamic DNS - some routers have support for this built in, you have to get a DynDNS account to make this work (not free).