Unique MAC addresses? Best practice?
my first arduino project nearing completion (first stage @ least). have display box number of 7-segment 4-digit displays. arduino uno r3 has official arduino ethernet shield. values display sent through udp , working nicely.
i looking several of these may on same network attached different instruments. have built in commands allow me switch each unit use dhcp or static ip addressing , supply static ip addresses in case want set each box , leave same sketch (these values saved in eeprom , read in during setup along various other configuration parameters).
the thing wondering mac addressing. examples have seen have hard-coded mac address in sketch. @ moment have too. means if put same sketch in 2 boxes without modification have same mac address (so have 2 boxes unique ip address dhcp, same mac address). given these supposed unique feel can't thing, particularly on same network segment.
while hand modify sketch , burn individually in each box seems bit "heath-robinson". extend code allow mac address changed later (stored in eeprom) , read @ start (as have done other configuration settings), thought sort of issue can't unusual , wondered how others had dealt it. have tried searching got rather lot of hits search term "mac" , have not found better one.
thanks.
[i have not posted code here because rather generic question, , sketch quite long. way ethernet set comes directly playground examples. if sketch needed can happily post later]
once finished try , post pictures , sketch in case of interest others.
i looking several of these may on same network attached different instruments. have built in commands allow me switch each unit use dhcp or static ip addressing , supply static ip addresses in case want set each box , leave same sketch (these values saved in eeprom , read in during setup along various other configuration parameters).
the thing wondering mac addressing. examples have seen have hard-coded mac address in sketch. @ moment have too. means if put same sketch in 2 boxes without modification have same mac address (so have 2 boxes unique ip address dhcp, same mac address). given these supposed unique feel can't thing, particularly on same network segment.
while hand modify sketch , burn individually in each box seems bit "heath-robinson". extend code allow mac address changed later (stored in eeprom) , read @ start (as have done other configuration settings), thought sort of issue can't unusual , wondered how others had dealt it. have tried searching got rather lot of hits search term "mac" , have not found better one.
thanks.
[i have not posted code here because rather generic question, , sketch quite long. way ethernet set comes directly playground examples. if sketch needed can happily post later]
once finished try , post pictures , sketch in case of interest others.
just thinking out of box..
write routine generate random mac address , store in eeprom first time run...(if it's not been generated)
write routine generate random mac address , store in eeprom first time run...(if it's not been generated)
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Unique MAC addresses? Best practice?
arduino
Comments
Post a Comment