-1

Here's a post which explained the communication standard.

I need to establish communication between multiple Arduino nano board. I have used SPI bus on one of the Arduino board for wireless communication and I2C bus for another device. It appeared that both I2C bus and SPI bus support multiple device. However, since I have used both I2C and SPI for different purpose, establish parallel communication with RX TX pins seemed to be the preferable choice.

Question 1: This post provided a nice set up for I2C bus as master and slave. However, can one adjust the code in step 2 of master device with

 Wire.begin(n); 

and change all the Arduino boards as master&slave devices, thus achieve parallel communication?

Question 2: I read this post where people mentioned RS 485. However, can one achieve parallel communication with RX and TX pin like the one used in Question 1, without using RS 485?

5
  • 1
    please explain what you mean by parallel communication
    – jsotola
    Jan 18, 2020 at 22:23
  • @jsotola like 10 arduino nano board get together and send data to each other, the topology of the network is fully connected. Jan 18, 2020 at 22:25
  • google arduino cluster and arduino node network
    – jsotola
    Jan 18, 2020 at 22:31
  • @jsotola That's too big. The whole point is to use the on board technology, with expanse the energy and mass of the project would be too much. Jan 18, 2020 at 22:33
  • 4
    I think the term you need is "multi-drop bus", not "parallel". Parallel communication refers specifically to a completely different interfacing standard.
    – Majenko
    Jan 18, 2020 at 22:58

1 Answer 1

-1

parallel communication is possible using arduino you need to use the ports for example port A and then a rx tx pins.

#include <Wire.h>
#include <Arduino.h>

byte i = 0;
int intpin = 44;
int rcv_ready = 45;

void setup() {
  DDRA = B11111111; // Output
  DDRC = B11111111; // Output
  pinMode(intpin, OUTPUT);
  pinMode(rcv_ready, INPUT);
}

void loop() {
  transmit();
}

void transmit() {
  PORTA = i++
  PORTC = i;
  digitalWrite(intpin, HIGH);
  while (rcv_ready == LOW) {}
  digitalWrite(intpin, LOW);
  
  delay(299);
}

Here we set up the two ports DDRA and DDRC to be output ports by using the mask B11111111; We set the interrupt pin to port 44 and set it is an output and we set the receive pin to be 45 and an input. Then we call transmit in the loop. Where we then set port A and port C to equal i++ and i respectively. And then toggle the signal to say we have transmitted a new message. This will get picked up by the Slave-input.

Slave input

#include <Arduino.h>

byte x = 0;
byte y = 0;
int rcv_ready = 45;

void setup() {
  DDRA = B00000000; // Input
  DDRC = B00000000; // Input
  Serial.begin(19200);
  attachInterrupt(5, blink, RISING);
  pinMode(rcv_ready, OUTPUT);
  digitalWrite(rcv_ready, LOW);
}

void loop() {}

void blink() {
  x = PINA;
  y = PINC;
  delay(100);
  digitalWrite(rcv_ready, HIGH);
  delay(100);
  digitalWrite(rcv_ready, LOW);
  Serial.print(x);
  Serial.print(" , ");
  Serial.println(y);
}

Here we set up the two ports DDRA and DDRC to be input ports by using the mask B00000000; We then set the baud rate as 19200 which matches the rate set by the master

Here we set the interrupt to be 5 which is pin 18 and tell it to call blink on an interrupt. We then read the values from PORTA and PORTC and then we output it to the serial monitor screen. We also send back the acknowledgement of receipt to the master using pin 45

1
  • 1
    Please post your code in text format.
    – VE7JRO
    Feb 13, 2020 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.