Same IP Address for multiple Arduino's with W5500

Hi Guys i have made a serial interface for RS-485 which responds according to serial data and wanna change to ethernet for better upgradability

in the data there are two parts identifier like A1, A2 Set by DIP Switch
and other part is the main data like code or string which decides action to be taken

i would like to use a single ip address for multiple arduino's with W5500 and send the data to main server which checks by identifier and reply back to all and if identifier is same with configured the activate led

and data from arduino can go to any machine but only respond if the identifier matches with its own

is this Same IP Address possible in Arduino or do we need to set separate for each one and assign itself all of the arduino connect to a Switch so

Is it Possible?

no. IP address must be unique

Is this Same IP Address possible in Arduino or do we need to set separate for each one and assign itself all of the Arduino connect to a Switch.

It's possible to assign the same IP address to as many devices as you like...just don't expect them to work. I suggest that you don't assign static IP addresses to each device, use DHCP then configure your router to give specific IP addresses to specific MAC addresses. The advantage of doing it this way if you don't have to code each device with a separate IP address and you can change them easily by changing them in the router configuration.

PerryBebbington:
It's possible to assign the same IP address to as many devices as you like...just don't expect them to work. I suggest that you don't assign static IP addresses to each device, use DHCP then configure your router to give specific IP addresses to specific MAC addresses. The advantage of doing it this way if you don't have to code each device with a separate IP address and you can change them easily by changing them in the router configuration.

so how do i add these unique ip address to a raspberry pi Server which receives data checks and sends back data

i have this working with serial but

how do i use multiple ethernet sockets and IP in Python code to communicate with raspberry pi and arduino without any problem and will W5500 work with fastest speed as possible with Raspberry pi

and how do i set these IP Address on a Network or POE Switch for Defining Each Node or Slave

So how do i add these unique ip address to a Raspberry pi Server which receives data checks and sends back data

how do i use multiple ethernet sockets and IP in Python code to communicate with raspberry pi and Arduino without any problem and will W5500 work with fastest speed as possible with Raspberry pi

Not a clue, sorry. I suggest you ask on a Raspberry Pi forum, they will probably want to know what server
software you are running.

How do i set these IP Address on a Network or POE Switch for Defining Each Node or Slave

IP addresses have nothing to do with Node or Slave, they are just IP addresses and every device on the network needs its own, unique IP address. To do what I suggested you log into your router and find the bit where you match IP addresses to MAC addresses. Every router is different. If you happen to have a DrayTek router I can probably tell you, for any other make you will need to consult the manual or ask your friend Mr Google.

PerryBebbington:
Not a clue, sorry. I suggest you ask on a Raspberry Pi forum, they will probably want to know what server
software you are running.
IP addresses have nothing to do with Node or Slave, they are just IP addresses and every device on the network needs its own, unique IP address. To do what I suggested you log into your router and find the bit where you match IP addresses to MAC addresses. Every router is different. If you happen to have a DrayTek router I can probably tell you, for any other make you will need to consult the manual or ask your friend Mr Google.

Ok but i will not be using a router but a switch and would to configure it in this way like

Data is being sent over from arduino to raspberry pi through ethernet
the data is then processed and sent back to the IP address it came from
then perform the action on arduino using the data sent from RPI

i would like to use UDP and

should i direct all messages to a specific IP (Which is RPI) and Then send back the data to all Arduino and select themselves if the data belongs to it or no

Is it Possible This way around as

I have Identifier in My code which uses DIP Switch to Configure the Identifier and if data starts with identifier it should then process it

Is it Possible

Ok but i will not be using a router but a switch and would to configure it in this way like

OK. If you have nothing on the network providing DHCP then you can't use my suggestion. You will have to give each device a static IP address. You could ask the Raspberry Pi folk if the server you are running can provide DHCP and if so can it lock IP addresses to MAC addresses.

Data is being sent over from arduino to raspberry pi through ethernet the data is then processed and sent back to the IP address it came from then perform the action on arduino using the data sent from RPI.

Seems reasonable to me.

I would like to use UDP

Works for me, although I know nothing about the ability of the server you are running to receive UDP packets.

Should I direct all messages to a specific IP (Which is RPI) and Then send back the data to all Arduino.

That is the usual way of doing server - client connections.

and select themselves if the data belongs to it or no

I think you mean will the data return to the correct Arduino, it will if they all have unique IP addresses and if the server sends back to the IP address that sent the request.

I have Identifier in My code which uses DIP Switch to Configure the Identifier and if data starts with identifier it should then process it

If you are back to having every device with the same IP address, no that is not going to work. If you have DIP switches you could use them to define the last few bits of the IP address.

PerryBebbington:
OK. If you have nothing on the network providing DHCP then you can't use my suggestion. You will have to give each device a static IP address. You could ask the Raspberry Pi folk if the server you are running can provide DHCP and if so can it lock IP addresses to MAC addresses.

guess i can set them using DIP Switch

PerryBebbington:
I think you mean will the data return to the correct Arduino, it will if they all have unique IP addresses and if the server sends back to the IP address that sent the request.If you are back to having every device with the same IP address, no that is not going to work. If you have DIP switches you could use them to define the last few bits of the IP address.

No i am not assigning same IP to all

just send data to all connected arduino with different IP Address but the data sent is decoded and check if data matches with the DIP switch Configuration and Processes the data if no Match Ignore

How do i set IP address using DIP Switch Configuration i presently use this code

String  dipConfig(){
 String dip = "";

  if (digitalRead(dip1) == LOW){dip += "1";} else {dip += "0";}
  if (digitalRead(dip2) == LOW){dip += "1";} else {dip += "0";}
  if (digitalRead(dip3) == LOW){dip += "1";} else {dip += "0";}
  if (digitalRead(dip4) == LOW){dip += "1";} else {dip += "0";}

if(dip == "0000"){
  return "G1;";  
  }
  else if(dip == "0001"){
  return "G2;";  
  }
 else if(dip == "0010"){
  return "G3;";  
  }
  else if(dip == "0011"){
  return "G4;";  
  }
  else if(dip == "0100"){
  return "G5;";  
  }
  else if(dip == "0101"){
  return "G6;";  
  }
  else if(dip == "0110"){
  return "G7;";  
  }
  else if(dip == "0111"){
  return "G8;";  
  }
  else if(dip == "1000"){
  return "G9;";  
  }
  else if(dip == "1001"){
  return "G10;";  
  }
  else if(dip == "1010"){
  return "G11;";  
  }
  else if(dip == "1011"){
  return "G12;";  
  }
  else if(dip == "1100"){
  return "G13;";  
  }
  else if(dip == "1101"){
  return "G14;";  
  }
  else if(dip == "1110"){
  return "G15;";  
  }
  if(dip == "1111"){
  return "G16;";  
  }
    
 }

And using this command in setup to set the identifier which returns a String

Now i would like to change it to set the IP Address

String  dipConfig()

If you search these fora you will find lots of discussion about (not) using String. Don't use String (capital S), it causes problems. Search and learn.

I have no other comment about your proposed code at the moment. Do some reading and experimenting, and have fun :slight_smile:

PerryBebbington:

String  dipConfig()

If you search these fora you will find lots of discussion about (not) using String. Don't use String (capital S), it causes problems. Search and learn.

I have no other comment about your proposed code at the moment. Do some reading and experimenting, and have fun :slight_smile:

String (Capital S) has encountered no problems yet and works every time and updates when i reset my arduino simple so i just need to change the string to bytes

how to add (say like 50) Arduino to RPI for Sending data back and have the code simple

String (Capital S) has encountered no problems yet

The most important word there is YET

It's your project, up to you. I've brought it to your attention, whether you take any notice is up to you. There are loads of threads on here discussing and explaining it.

akash614:
how to add (say like 50) Arduino to RPI for Sending data back and have the code simple

make sure the Arduinos have a different MAC address.
setup a DHCP server on RPI. it will assign IP addresses to Arduinos.
see the UDPSendReceiveString example of the Ethernet library

Juraj:
make sure the Arduinos have a different MAC address.
setup a DHCP server on RPI. it will assign IP addresses to Arduinos.
see the UDPSendReceiveString example of the Ethernet library

Ok so if i setup a dhcp server on RPI and configure my Mac Address using DIP Switch

like node1, node2 ..... node(upto n)

and set the remote IP as Raspberry Pi IP and just send and receive strings like i did using Serial

akash614:
String (Capital S) has encountered no problems yet ...

It will. When you are comfortable with Arduino and have a couple of dozen small projects under your belt (I always wondered the origin of that apothegm), you will start making more complex programs, and all of a sudden your code starts doing strange things. You will pull your hair out (that's an axiom) trying to find the cause.

Start using c-strings before you learn bad habits using the String class.