How to make two arduinos (arduino mini and mega 2560)communicate each other

Hii Guys,

I am working on a project where i want to control audio systems digitally. This project requires Arduino Mega to act as a master controller and provide the data it receives, serially to all the Arduino Minis connected to it. The Programmer, I selected was Arduino ISP.

I made some simple connections to connect Arduino Mega with Arduino Mini.Those are as follows:

  1. Arduino Mega's 5V connected to Arduino Mini's 5V
  2. Arduino Mega's Ground connected to Arduino Mini's Ground
  3. Arduino Mega's Tx connected to Arduino Mini's Tx
  4. Arduino Mega's Rx connected to Arduino Mini's Rx

In spite of the above connections, I am trying to lit (as a part of testing purpose and later want to send some other codes of programming) up an led on pin 13 of Mini.But, when I try to compile and upload the program it throws the following error:

Arduino: 1.8.5 (Windows 10), Board: "Arduino Mini, ATmega328P"
Sketch uses 1914 bytes (6%) of program storage space. Maximum is 28672 bytes.
Global variables use 184 bytes (8%) of dynamic memory, leaving 1864 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3b
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3b
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

I cannot How can I solve the error which pretty much deals with the sync thing.

Please, help me guys and let me know if you need any extra bit of information which I didn't give you.

Thanks

In addition to the above mentioned information, I have connected Mega via USB to my laptop and the connections between Mega and Mini are described in the previous post.

If you are trying to get serial communications between the two boards, why are you connecting transmit port to transport? And receive port to receive port?

Paul

You WILL have to disconnect the two Arduinos in order to upload code.

@PaulS and Paul_KD7HB,

You guys are correct. In fact, I tried to Tx of one Arduino to Rx of the other and vice-versa.

yes I want to make those arduinos communicate serially. For that purpose, I tried to upload the code on one arduino at a time.So, basically I would like to send a random number Serially (number which I used is 100) to the Arduino Mini.Mini, on the other hand, will wait for the number to be arrived Serially and if it receves 100 it will send high_voltage to pin 12.

For reference purpose, i have attached my code I want to execute and the Snapshot of the connections which i made on breadboard. The green wires in the snapshot(which are connected via FTDI cable to the laptop).

In spite of trying possible connections, it is not working. Please let me know if I made a mistake.

Thanks,

Arduino-mega-code.JPG

You have to connect both GND signals of the Arduinos.

On the Micro you should use Serial1, Serial connects to the USB.

shivangtrivedi:
Please let me know if I made a mistake.

It's a mistake to try posting your code as an image rather than including it in your text with code tags.

PaulS:
You WILL have to disconnect the two Arduinos in order to upload code.

Couldn't you just hold the reset button on the Arduino you aren't trying to program? Doing that should hold that other Arduino in reset, which should tri-state (high impedance) it's TX/RX pins, effectively taking them out of the circuit

I haven't tried this mind you

PaulS:
You WILL have to disconnect the two Arduinos in order to upload code.

I also ran across some USB doc somewhere that said that when the host is idle the lines are tri-stated so the device can initiate communication. Or something like that. I guess it's wishful thinking to imagine that to mean that on the serial side of a USB to serial converter (FT232 or similar) the lines are tri-stated when the USB host is not talking?

I guess what I'm wondering is whether both of e.g. host computer and some_thing_on_arduino_serial both have to try to talk at the same time for bus contention to happen, or if it works ok as long as they don't.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks... Tom.... :slight_smile: