0

I have connected ESP32, ESP-12 and ESP8266 Nodemcu to the Wi-Fi router. I have also connected my raspberry pi 4 to this network through wifi.

The scenario is when my device raspberry pi comes in any network it will start detecting the other things connected to the same network and gets their IP and then sends a JSON simple data to turn on the type to them. And in the future, it can also send multiple data to work on different applications.

So I want to learn how to make Raspberry PI scan and get other IP addresses of Systems to do work with?

So far I have searched I have got the result regarding getting my rpis IP or setting it to static or global etc.

Update with info from comment:
What my application is (Which is I think Not possible) that when I connect my raspberry pi to any Wi-Fi network it should catch every device IP and if possible with name and will broadcast JSON data on them and the end devices which can work on this data will run. Data will be of different kinds e.g. like turn on, off, etc. So I don't want to hardcode them. I tried nmap and it is listing the IPs but it is showing more than 64 active Host I don't know why and can't see devices IP with name.

  • 2
    I'd try nmap. – kwasmich Dec 5 '19 at 12:27
  • Tried. It is showing a list of IPs but extras that are not even in use. And it is showing only IPs not name. – Lucifer Dec 5 '19 at 13:56
1

If you control the software on the ESP* devices then one way would be to use mDNS on them so that they announce themselves on the network. Then you can search and detect them and their services with avahi on the Pi.

|improve this answer|||||
  • Yeah, I thought the same. But what my application is(Which is I think Not possible) that when I connect my raspberry pi to any Wi-Fi network it should catch every device IP and if possible with name and will broadcast JSON data on them and the end devices which can work on this data will run. Data will be of different kinds e.g. like turn on, off, etc. So I don't want to hardcode them. I tried nmap and it is listing the IPs but it is showing more than 64 active Host I don't know why and can't see devices IP with name. – Lucifer Dec 5 '19 at 13:55
  • Randomly spamming a wifi network is a bad idea; mDNS is the most appropriate way to go. This way other nodes which want to be found for whatever purpose can easily be configured to do so. This does not mean or require "hardcoding" of anything. There are mDNS libraries available for ESP devices. – goldilocks Dec 7 '19 at 14:54
  • @goldilocks oh...I was not aware of this. will this be from the ESP side or Raspberry? Because as of now I just taking ESPs as a dummy device. Real devices will be like for e.g.Lights, Switches, etc. which can be operated through the Internet over Wi-Fi. Yes, you are right randomly spamming a wifi network is a bad idea. But I am learning so...and only going to try this on my and my friend's network. – Lucifer Dec 9 '19 at 9:50
  • Of course you can do something home grown, for example to discover Onkyo A/V devices you send a UDP broadcast with a specific packet format and the devices will respond with their details. Then again, if you are going to use the ESP for lights and such maybe it would be a good idea to use a standard protocol like for example COAP. – onion Dec 10 '19 at 8:01
0

You could try with arp arp -na | grep -i should get ip addresses of eps on network

|improve this answer|||||
  • will name also be displayed? – Lucifer Dec 9 '19 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.