So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By jdseymour
#64719 We're starting a project that will be using the "AT" commands on ESP-WROOM02 modules to provide network capability to a batch of embedded devices. Right now, I've got code that puts the ESP module into server mode - and then a Windows program sends packets to the device and gets responses.

All this works fine - but for now, I'm using only ONE ESP module and its IP address is hard-coded in my Windows app. What I want to do is enumerate all the modules in the network so that I can choose which IP address to talk to.

Can anyone suggest a reasonable method for us to do this enumeration?

Right now, I'm guessing the best option would be to send a UDP broadcast out and see who responds - but I'm at a loss as to how this would work in the real world...

Any advice would be appreciated.

Thanks.
User avatar
By jeffas
#64812 This is really some generic ideas; i.e. not specific to ESP, as I'm not an ESP expert, so I don't know which can be done.
1. Yes, your broadcast idea is a good one. Each ESP would have to listen for the packets and respond to them.
2. Assuming that the ESPs are getting their IP addresses from DHCP, the DHCP server (usually a router) must have a list of registered devices. You can possibly get them by page-scraping the router's web interface, or by telnet to the router if it provides that access.
3. Again assuming DHCP, the DHCP protocol allows devices to specify their own hostnames. You could then use the hostnames instead of the IP addresses. Of course this requires each ESP to be configured with a known hostname.
User avatar
By RichardS
#64816 So...

Assuming the master that is going to look for the modules and the modules are on the same sub net....

So 192.168.1.x type of thing, then you can send a UDP message to 192.168.1.255 and then they can hear it and send messages back to you telling you their IP!

Only works on same subnet.... See http://www.pcvr.nl/tcpip/broadcas.htm

Now I did notice they mention 255.255.255.255 which might hit EVERYTHING, not sure I only ever did the same as what I mentioned above.

RichardS
User avatar
By Ocsav
#65126 Hard code the mac addresses on the DHCP server in order for the ESPs always got the same ip.
Never forget that this is not a SECURITY measure, as MAC addresses are easy to change and/or spoof.

This can be solved in other ways too.
From the top of my head, before going into server mode open a client connection to a server and create a record of the ip address.
This can be done in n ways, it can be a web server and you just create a php script (or whatever you use) that accepts a GET request from the ESP with info about it's IP.
If you have a mail server that accepts mail via SMTP then the ESP could send you a mail with that info.