This is the steps to control 5V 10A 2-Channel relay using Arduino.
- 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.).
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.
- 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.