Hi. I would like to ask for advise because I want to start a project but I have some concerns about my approach. First I will explain what I want to do. I have my house with many rooms. Each room will contain an Atmega328P based board(from now on called node) with sensors on it. This boards will have an unique address for identification purposes. Each node will be connected to a router with an ENC28J60 Ethernet interface. I will have a PC which will query the sensor data from nodes based on specific periods and will store to a database using the unique address mentioned earlier. It could happen that the PC must send data to a specific node, for example a node which contains relays.
Because the nodes will be connected over ethernet, every node will have an IP address. And that's where I have doubts. I don't know the exact number of nodes so I want to avoid static IP's hardcoded into each node. The other way would be DHCP.
I will explain my idea how to do the communication:
Every node will be connected to a router. Every node will get an IP address trough DHCP. My software on the database PC will query the DHCP clients from router and it will connect to all of nodes on by one. When it connects to a node first it will ask for It's unique address and temporally it will associate with the node's IP. When it's done with all nodes, on specific periods it will connect to nodes one by one and will ask for sensor data which will be stored in database for data logging purposes. In this way I don't have to worry about IP collision, I don't have to hard code any static ip and keep track of it. If the IP changes, it doesn't really matters because the data logger discards the old IP and simply assigns the new one to the node's address.
I don't need to access the nodes from web browser. I thought I will use sockets and sending ASCII data. Somebody has ever done something like this? I don't necessarily need to use sockets so if is there a better solution, or something specifically made for this sort of applications, I am all ears.