Article covers controlling relay switch using Arduino-Uno.
Disclaimer
1. This post does not dive deeper into the working of relay switches.
Working sample
Before we proceed further, let us take a look at what our end result would look like.
Items Needed
- Arduino Uno
- 5V Relay switch
- Small DC motor
- 5 V DC power supply
Pre-requisites
This post assumes you already have,
Arduino Editor installed on your laptop.
Your laptop connected to Arduino using the USB cable.
Basic familiarity with Arduino programming using C++.
Technical details
How relay switch works?
This post does not go into the working of relay switch. There are numerous materials available on the internet.
Schematic & Wiring diagrams
This is how the final setup looks like:
How-to steps
Step 1: Connecting Arduino to relay switch
Arduino Uno | Relay switch | Remarks | Wire color |
5 V | DC + | 5 V | red |
GND | DC - | 5 V ground | black |
9 | IN 1 | Control Input for relay | blue |
Step 2: Connecting power supply to motor through relay switch
Relay switch | Load (DC motor) | Remarks | Wire color |
COM1 | - | 5 V DC power supply | red |
NC1 | DC + | Normally Closed channel 1 on relay switch | red |
- | DC - | 5 V DC power supply | black |
Step 3: Arduino C++ I2C code
There are no new libraries to be downloaded. Code is straight forward.
~~~~~~~~ C++ Code
Step 4: Testing the relay switch
Now the setup should be ready. When the C++ code is run, the dc motor should be running for few seconds and stop. This cycle should go on.
Closing note
Hope this post gives you the basic details for connecting Arduino with relay switch at activate or de-activate DC motor. Refer the accompanying video for a demonstration.
Thanks,
(2) https://www.youtube.com/watch?v=me7mhrRbspk
Comments