Connecting many AVR based ethernet devices to local network

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Each ethernet device should have a unique MAC address (otherwise you'll have dhcp problems). From this you can determine the node.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes that should be doable! You may want to look into wifi before you do much crawling through attics and basements pulling all that ethernet wire to all those rooms first.  

Sorry, I have spent half my adult life pulling ethernet cables through datacenters and office buildings, started with large orange cables you had to drill holes into to clamp on the ethernet xceivers, then thin-wire, then shielded twisted pair, then un-shielded twisted pair, cat 3, cat 5....,  wish they would make up their minds!  

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes unique EUI48 or EUI64 (mac address) is needed.  There is a standard way to map them into ipv6 addresses, don't know about ip4. Given unique device identifiers, DHCP is an overcomplicated waste of bandwidth, it makes more sense to just send packets to all a.b.c.n possibilities, n=0..255 and see which ones respond.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see. Thank you for all of your help. I will keep updated this thread if I have new information.