Automatically find dhcp arduino ehernets on a network?

Ok , my problem is I don’t know what terms to search for. Hopefully someone out there can point me in the right direction.

I have #n arduino ethernet sensors on a network that use dhcp to get there ip address. What I want to have happen is have a program on a server that pings (I think multicast) all devices on the network asking if the a device is one of these sensors. If it is one of these sensors the the arduino will respond back to the program with the ip address of the sensor and maybe some other information (like mac address).

It is my hope that I will be able to add more sensors to the network run the ping (I know this is most likely not the right term) and if any of the arduinos that respond back that are not in the list it will then be added. Then my server will be able to query data by ip address.

If someone out there can point me to examples or give me correct terms to search for it would be a great help. Or if any one has a better idea of how to go about this.

Thanks

Logically I'd be thinking along these lines:-

A small server running on each device, that takes a specific coded request and would reply with it's ID data.
The base does a sweep through your address space, pinging all IP's
If the base gets a ping response then it sends a request for device ID
If the device responds with ID then it is one of your sensors so add to your list
Periodically, rescan with ping but now omit devices you know already exist
If any known devices don't respond at any point then do a full rescan to rebuild the list in case of any DHCP lease renewals giving different IP's

ed1023:
Ok , my problem is I don’t know what terms to search for.

There isn't really a standard but you might look into WiFi Beacon announcements and Network Service Advertisement. The details are different but the principles are largely the same.

What I want to have happen is have a program on a server that pings (I think multicast) all devices on the network asking if the a device is one of these sensors.

Multicasting is something different and not entirely straightforward using the Arduino libraries.

If it is one of these sensors the the arduino will respond back to the program with the ip address of the sensor and maybe some other information (like mac address).

Polling an address space is extremely wasteful of network resources, can cause cascade issues and should be avoided whenever possible. HP's Jet Admin software was famous for causing network floods when used carelessly.

Another big issue with polling is you have to wait 'some time' before deciding there will be no response, before moving to the next address. The polling period becomes a function of the size of the address space, and the fewer devices there are responding, the longer the polling cycle takes

If someone out there can point me to examples or give me correct terms to search for it would be a great help. Or if any one has a better idea of how to go about this.

Typically, what you want to do would be done by reversing the question.

Rather than having the server search for devices, you have the devices periodically announce their presence on the network, to the server. The server maintains a list of IPs of the active devices and removes any which fail to contact it within some time period. You don't have to worry too much about IP address changes as the active device list on the server only contains active IP addresses. If you can use UDP, use UDP and you won't have to worry about the server being down for maintenance either. Importantly for a device with limited resources (like an MCU), the bulk of the processing is carried out on the server, which should have far more resources available to absorb it.

Things to consider.

How often do you need the devices to announce their presence?

  • As more devices are added to the network, the volume of announcement traffic will grow.
  • A dozen devices announcing once a second would not be a problem.
  • A hundred devices announcing once every millisecond, could be a problem.

Will the server IP ever change?

  • You could embed the server IP on the Arduino but you would need a method to change it.
  • You could use a DNS record but you would need a DNS server to serve it.
  • You could use a broad-cast packet to solicit the server IP but I don't know how easy that is with an Arduino
  • You could avoid the problem completely, by using DHCP reservations for each Arduino.
    A device like a network printer, will allow you to do all and any of these things, with a fall back method.