4

How would I find a device on the local network? I'm building an IoT device that needs to find another device connected to the same network.

There will be two ESP8266 modules that need to communicate with each other on the local network, how would I achive this?

Using mDNS doesn't work router just gives it a generic name.

I was thinking about storing the local IP in a database on my server but that seems very cumbersome and wouldn't work if it failed to establish a connection.

The devices will be using the ESP8266 and interfaced with an Android application.

Adam
  • 143
  • 3
  • 18
  • 1
    Does your WiFI module have capability of showing the IP addresses connected to it? – David Kasabji Apr 07 '17 at 11:40
  • Yeah, it's able to. – Adam Apr 07 '17 at 11:41
  • 1
    What does this have to do with Android? What is 'interfaced with an Android application'? – greenapps Apr 07 '17 at 11:45
  • 1
    `The devices will be using the ESP8266 `. Unclear. You have two devices? And both have an esp module attached? – greenapps Apr 07 '17 at 11:48
  • It will have an application to send alerts to the user, if needs be the app could facilitate the pairing process while the phone is on the local network. Yes, there will be two ESP8266 modules. – Adam Apr 07 '17 at 11:49
  • 2
    Easiest way would be to assign IP addresses by using DHCP reservations on your router. – leetibbett Apr 07 '17 at 13:37
  • @leetibbett Is it possible to do that without logging into the router? – Adam Apr 07 '17 at 14:08
  • 2
    No it isn't. If you are trying to hook these to networks that are not under your control, you have other options. mDNS (multicast DNS) should work even though your router doesn't see the correct name. If your devices require Internet access anyway, then you could also use a web service. You could create your own UDP broadcast/multicast. – leetibbett Apr 07 '17 at 14:22
  • 1
    sadly, there is no easy answer of the kind you're looking for... – dandavis Apr 07 '17 at 19:47
  • @leetibbett Yeah, I thought as much, I'll just have them make contact with my web service then. – Adam Apr 08 '17 at 06:59

1 Answers1

0
  • Open your router admin page.
  • In the DHCP section give the two ESP8266 static IP addresses.
  • Remember the IP addresses and use them in your code.
Suvajit Patra
  • 190
  • 1
  • 4