Questions with regards to ESP8266 Basic and hardware interfacing and control via Basic commands

Moderator: Mmiscool

User avatar
By Aussie_Barry
#62545 Hi All,

Assume I have one ESP module set as an Access Point (AP) and another three (or more) ESP modules connected to it as stations (STA).
The AP has an IP address of 192.168.4.1
Is there a simple way for the AP to determine the IP addresses of the other three (or more) stations?

Cheers
Barry
VK2XBP
User avatar
By Electroguard
#62553 Yes, using UDP.

UDP messages can be broadcast to the subnet for all to receive, and the "UDPremote()" command allows any node to extract the senders IP address.

If you wish to trigger responses on demand by issuing something like a 'Who's There?' message from your master node then you need to ensure the receiving nodes each have sufficient delay before responding to prevent all messages being returned at the same time and drowning each other out... but this can easily be achieved by each node delaying for a unigue time based on it's unique last byte of it's ip address (times a couple of hundred to act as a magnifier for sufficient difference between adjacent IP addresses).
User avatar
By Electroguard
#62555 UDPreply does the same thing automatically by the way, it is used to return a message just to the broadcasting sender.

Reading between the lines...
If you're going to have a 'Master' node, either it needs to be able to broadcast it's own 'Who's There?' command, or else each node needs to broadcast it's address when it comes online.
But either way, the Master needs to store each nodes IP address along with any other corresponding info (perhaps node Names or Roles).
Unless there is an absolute defined number of nodes, the indeterminate and changable node list needs to be save somewhere, probably an array. The contents of an array will be lost at each power up/reboot, so may need to be saved to non-volatile memory, and perhaps even saved to a secondary 'standby' Master.

Note: if these nodes are not an a router subnet you will probably need to set the default gateway of each node to point to the 'master' AP (if that's who they'll be communicating with).
User avatar
By Aussie_Barry
#62578
Electroguard wrote:UDPreply does the same thing automatically by the way, it is used to return a message just to the broadcasting sender.

Reading between the lines...
If you're going to have a 'Master' node, either it needs to be able to broadcast it's own 'Who's There?' command, or else each node needs to broadcast it's address when it comes online.
But either way, the Master needs to store each nodes IP address along with any other corresponding info (perhaps node Names or Roles).
Unless there is an absolute defined number of nodes, the indeterminate and changable node list needs to be save somewhere, probably an array. The contents of an array will be lost at each power up/reboot, so may need to be saved to non-volatile memory, and perhaps even saved to a secondary 'standby' Master.

Note: if these nodes are not an a router subnet you will probably need to set the default gateway of each node to point to the 'master' AP (if that's who they'll be communicating with).


Thanks Electroguard.

I had already thought of a do-it-yourself IP register using an array but had hoped there was a more automated way of doing it.

Cheers
Barry