Pages: [1]   Go Down
Author Topic: 4 Arduinos Ethernet Shield in the same red.  (Read 336 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need some help.
I need to control 4 arduinos , one Server and 3 Clients.
the project consist in activating 4 alarms , one alarm for one arduino, in a big house.
but i  can only activate one alarm for example (one client).
is possible connect 4 arduinos in the same Network. I use each Arduino Ethernet Shield with different IP and MAC.
Logged

New Jersey
Online Online
Faraday Member
**
Karma: 49
Posts: 3422
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's nothing special about an arduino in a networking context; as long as you've taken care of the addresses, which it appears you have, you can have as many as your subnet permits. Four should be no problem.  What method are they using to talk to each other over the net?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

mmm method?. I use one Server and 3 clients. The server can only activate the outputs of the others
But I need activate all outputs (4 Arduinos) , with any client or the Server.
This is mi server code.
#include<SPI.h>
#include<Ethernet.h>

//constant transmission of status
 const byte IN_3_ON=0x11;
 const byte IN_3_OFF=0x21;

int led=7;
int inPin_3=3;

//Enter a MAC address an IP address for you controllers
//
byte mac []={
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
  IPAddress ipLocal(192,254,66,177);
  IPAddress puertaEnlace(192,254,66,159);
  IPAddress mascaraSubRed(255,255,255,0);
 
  //Enter the MAc and IP of the clients
  IPAddress ipArduserv(192,254,66,55);
  IPAddress ipArduserv1(192,254,66,200); 
  EthernetClient client;
  EthernetClient client1;
 
  void setup(){
 pinMode (inPin_3,INPUT);
    pinMode(led,OUTPUT);
     
    Ethernet.begin(mac,ipLocal);
  }
 
  void loop(){
         while  ((!client.connect(ipArduserv,23)) && (!client1.connect(ipArduserv1,23))){   
      if (digitalRead(inPin_3)==HIGH)client.print(IN_3_ON);
    if (digitalRead(inPin_3)==HIGH)client1.write(IN_3_ON);
      delay(200);
      if (digitalRead(inPin_3)==LOW)client.print(IN_3_OFF);
     if (digitalRead(inPin_3)==LOW)client1.write(IN_3_OFF);
       if (digitalRead(inPin_3)==HIGH){
        digitalWrite(led,HIGH);}
                else {
             digitalWrite(led,LOW);
                             }
      }                         
  }         


 

 
Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 79
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My one Arduino runs six temperature/humidity sensors, one PIR (but is setup to run six), it opens and closes my garage door using two relays, has a couple of LEDs, keeps a full backup of everything on an SD card, and runs itself as a web server at http://2wg.co.nz/. It has something like 50 plus digital pins and I have not used half of them. The key restrictive factor is the 8KB of RAM - but I only have a 5KB data block and have 3KB RAM for everything else (the stack and heap) during run time.

I am not sure you need more that one Arduino unit. One unit would make your implementation very much simpler and the unit can serve its multiple purposes using calls from the main loop() procedure to subprocedures that do all of the various tasks. Or have I misunderstood something?

Catweazle NZ.
Logged

Sydney, Australia
Offline Offline
Sr. Member
****
Karma: 6
Posts: 396
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to be careful about using the 254 address - it is treated strangely by very many units (even when used as the network number as you have in this case)

Craig
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My one Arduino runs six temperature/humidity sensors, one PIR (but is setup to run six), it opens and closes my garage door using two relays, has a couple of LEDs, keeps a full backup of everything on an SD card, and runs itself as a web server at http://2wg.co.nz/. It has something like 50 plus digital pins and I have not used half of them. The key restrictive factor is the 8KB of RAM - but I only have a 5KB data block and have 3KB RAM for everything else (the stack and heap) during run time.

I am not sure you need more that one Arduino unit. One unit would make your implementation very much simpler and the unit can serve its multiple purposes using calls from the main loop() procedure to subprocedures that do all of the various tasks. Or have I misunderstood something?

Catweazle NZ.

tThanks for the information.
yeah, with one Arduino is to easy for small places. but i want control 4 o more arduinos in a big place for example 1Km x 1Km.
my  network reaches 5Km of area.
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to be careful about using the 254 address - it is treated strangely by very many units (even when used as the network number as you have in this case)

Craig

i know, I use this address because my local network had this address. but actually i don't use more this address.
thanks
Logged

Pages: [1]   Go Up
Jump to: