Connecting 2 or more arduino together (no common power suply)

hello!
i need to get some arduino to interact with each other,
they will not have same power source.
what i need is to be able to send lets say
from arduinoA (pin2, output, a high command) to an other arduinoB (pin3, input, if high…blah)

i seem that connecting their grounds together works
but on reset arduinoA, pin2 sends to arduinoB a high (something i dont want to happen!)
any ideas to avoid that?

After a reset all pins are inputs (high impedance). Connect the critical pins to their default level, Gnd or Vcc, using resistors (10k?).

byronas:
but on reset arduinoA, pin2 sends to arduinoB a high (something i dont want to happen!)
any ideas to avoid that?

What about swapping your logic around. If at the moment LOW means OFF and HIGH means ON you could just as easily have HIGH meaning OFF etc

...R

i have added a sketch. (note that didnt have my rfid so i added something else in place) i use the rdw6300 rfid module.

arduino 1 (rfid reader code)

#include <SoftwareSerial.h>
SoftwareSerial RFID(2, 3);
int data1 = 0;
int ok = -1;
int yes = 12;

int tag1[14] = {2, 52, 66, 48, 48, 68, 66, 56, 48, 68, 53, 67, 53, 3};
int tag2[14] = {2, 52, 66, 48, 48, 51, 49, 68, 69, 48, 54, 65, 50, 3};
int tag3[14] = {2, 52, 66, 48, 48, 51, 49, 68, 65, 66, 56, 49, 56, 3};

int newtag[14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // used for read comparisons


void setup()



{
  RFID.begin(9600); // start serial to RFID reader
  Serial.begin(9600); // start serial to PC
  pinMode(yes, OUTPUT); // for status LEDs
  pinMode(no, OUTPUT);
  pinMode(green, OUTPUT); // for status LEDs


  boolean comparetag(int aa[14], int bb[14])
  {
    boolean ff = false;
    int fg = 0;
    for (int cc = 0 ; cc < 14 ; cc++)
    {
      if (aa[cc] == bb[cc])
      {
        fg++;
      }
    }
    if (fg == 14)
    {
      ff = true;
    }
    return ff;
  }
  void checkmytags() // compares each tag against the tag just read
  {
    ok = 0; // this variable helps decision-making,
    // if it is 1 we have a match, zero is a read but no match,
    // -1 is no read attempt made
    if (comparetag(newtag, tag1) == true)
    {
      ok++;
    }
    if (comparetag(newtag, tag2) == true)
    {
      ok++;
    }
    if (comparetag(newtag, tag3) == true)
    {
      ok++;
    }
  }
  void readTags()
  {
    ok = -1;
    if (RFID.available() > 0)
    {

      delay(200);
      for (int z = 0 ; z < 14 ; z++)
      {
        data1 = RFID.read();
        newtag[z] = data1;
      }
      RFID.flush();
      checkmytags();
    }

    if (ok > 0) // if we had a match
    {
      Serial.println("Accepted");
      digitalWrite(yes, HIGH);
      delay(500);
      digitalWrite(yes, LOW);
      ok = -1;
      delay(200);
    }
    else if (ok == 0) // if we didn't have a match
    {
      Serial.println("Rejected");
      ok = -1;
      delay(200);
    }
  }

  void loop()
  {
    readTags();
  }

and on arduino 2 a simple (for now)

const int Led = 6;     
const int arduino1 =  12;

int buttonState = 0;

void setup() {
  pinMode(12, INPUT);
  pinMode(6, OUTPUT);
  pinMode(4, OUTPUT);
}

void loop() {
  buttonState = digitalRead(arduino1);
  if (buttonState == HIGH) {
    digitalWrite(led, HIGH);   
    delay(1000);              
    digitalWrite(led, LOW);    

  }
  else {
     delay(200);
  }
}

it seem to work ok but just though of getting a second opinion since i am very new to everything around arduino and electronics :slight_smile:

byronas:
getting a second opinion

What specifically do you want a second opinion on?

And you have no expressed your own opinion on the usefulness of Reply #2

…R

if everything is correct as in the hole diagram.

of am i close to frying my arduinos

I guess we need to see the diagram. See this Image Guide

4c16fb3110ef0ec5dc2d081d0e7c4288d637584d.jpg

…R

Your code suggests that you have connected pin 12 on one Arduino as OUTPUT and on the other as INPUT. I suppose that is what the yellow line is for but I can't read the pin numbers on the diagram.

What are the resistors for? Are they also connected to pin 12?

You may guess from my comments that a photo of a pencil drawing of the connections would have been more informative.

I don't see anything on the diagram that would cause the smoke to escape. But don't blame me if it does.

And you have still NOT responded to Reply #2

...R

Interconnecting two devices on a breadboard is quite different from connecting them in separate rooms, or across the room.

You need to take into account -

  • power supply & ground influences (as you mentioned)
  • as well as noise, and
  • voltage drop etc.

you may want to look at isolated or balanced serial links to connect - if these become a problem.

D12 arduino A is OUTPUT (when rfid reads correct tag sends HIGH to it) i have grounded it to keep everything stable on reset and from noise.

D12 arduino B is INPUT (waits for HIGH from arduino A) also grounded for the same reasons

black cable is ground and connects A and B ground
red is 5v
and yellow is the triger cable.

the code i added for help but basic thing is
arduino A if correct id tag 12 high
arduino B if 12 high triger Led

is my wireing correct? is there a way to make it better?

i see you have pull-down resistors. What for?
Also, no current limiting resistor on the LED...
If the Arduino's are more than (say... 1m apart), you'll have to start worrying about noise on the link signal.

A circuit diagram would be much more helpful. Fritzing can output such diagrams as well.