Relay Control with Arduino

Controlling Relay using Arduino

This is the steps to control 5V 10A 2-Channel relay using Arduino.
  1.  Setting up relay and connect to Arduino
    The relay module has 3 pin header and 4 pin header. Make sure 3 pin header is connected as the picture below (JD-VCC and VCC should be connected.).
    Each relay has 3 outputs and the switch symbol on the left side is the default configuration of the relay. The center pin is connected to the bottom pin.
    Next, connect Arduino and relay. I used jumper cable and connected only IN1 pin that controls ch1 relay port. IN2 (ch2 relay port is not used.)
    I used GPIO7 pin to control relay switch, and 5V pin and GND pin are connected.
    Then, you can connect USB to PC.
    Hardware setup is done and next is to run the program.


  2.  Launch Arduino IDE and open the "Blink" example project.
    Go to "File > Examples > 01.Basics > Blink", and it generates new window with the "Blink" project.
    This project is basically toggling GPIO13 pin every 1ms. You can simply reuse this code to toggle relay on and off from the GPIO7 pin in my case, then save the project as you want.
    You will see IN1 LED on relay module toggles and hear the clicking noise from relay that basically tells you the output is switched. When GPIO is "HIGH", 2 and 3 pins are connected, and when GPIO is "LOW", 1 and 2 pins are connected.

Hardware:
Arduino UNO
Relay


Reference:     

[AKM Chip Booster] Audio ADC AK5704 PCB Design

Designing a PCB prototype with AK5704 is not so difficult and I show an example with my design. People who are not familiar with AK5704,...