Introduction: Master - Slave - LED Controller

By: Dakota Cowell and Andrew Johnson

This tutorial will give instructions on how to connect 2 Arduino devices and react to signals sent by the other. This shows you how I2C communication works between the Arduinos. In the end of the project, the master Arduino should have a button that will turn the other Arduino's LED on and off. When the receiver's LED comes on, it should send a signal back to the sender. The sender is looking for that value from the receiver, and it will turn on its own LED.

Step 1: Connect 2 Arduinos

Connect 2 Arduinos so that they can communicate with each other. Pins A4 and A5 must be the analog pins used to communicate.

1. Connect a wire from ground on the first Arduino to the ground on the second Arduino

2. Connect a wire from the A4 pin on the first Arduino to the A4 pin on the second Arduino

3. Connect a wire from the A5 pin on the first Arduino to the A5 pin on the second Arduino

Step 2: Add an LED to the Slave Arduino

Choose an Arduino to be the slave Arduino and attach an LED.

1. Attach an LED to your breadboard

2. Connect a wire from the LED's cathode (shorter side) to the ground column on your Arduino

3. Attach a 220 Ohm resistor from the LED's anode (longer side) to pin 13 on the slave Arduino.

Step 3: Add Button to the Master Arduino

Add a button to the master Arduino so it can turn on and off the slave Arduino's LED.

1. Attach button to the breadboard as shown in the diagram.

2. Connect a wire from the top right pin on your button to pin 12

3. Connect a 10k Ohm resistor from the bottom right pin on your button to the ground column on your breadboard

4. Connect a wire from the bottom left pin on your button to the power column on your breadboard.

5. Connect a wire from the power column on your breadboard to the 5V pin on the master Arduino.

6. Connect a wire from the ground column on your breadboard to the ground pin on the master Arduino.

Write some code to test that your button is sending the signal to turn the slave Arduino's LED on.

Step 4: Add an LED to the Master Arduino

Attach an LED to your master Arduino so that it can light up when it receives a message from the slave Arduino.

1. Attach an LED to your breadboard

2. Connect a wire from the LED's cathode (shorter side) to the ground column on your Arduino

3. Attach a 220 Ohm resistor from the LED's anode (longer side) to pin 13 on the master Arduino.

4. Connect the master Arduino to a computer and upload the Master_LED_Control.ino file to it.

5. Connect the slave Arduino to a computer and upload the Slave_LED_Control.ino file to it.

When clicking the button now, the slave Arduino should receive the signal and its LED should then turn on. Then, the slave should send a signal back to the master's LED, and it should turn on as well.