In this example, we create a motion sensitive lamp. Otherwise, you don’t need to connect it)Įxample: Controlling a Lamp with a Relay Module and PIR Motion Sensor
That means the relay electromagnet is directly powered from the Arduino’s power pin, so the relay module and the Arduino circuits are not physically isolated from each other (this is the configuration we’ll use). With the jumper cap on, the VCC and JD-VCC pins are connected. The jumper cap allows you to choose whether the circuit is physically connected to the Arduino circuit or not, and you can choose to have it on or not. Note: notice that the module has a jumper cap connecting the VCC and JD-VCC pins the one shown here is blue, but yours may be a different color. The JD-VCC pin powers the electromagnet of the relay. The second set of pins consists of GND, VCC, and JD-VCC pins. The set at the right consists of VCC and GND to power up the module, and input 1 ( IN1) and input 2 ( IN2) to control the bottom and top relays, respectively.
The low-voltage side has a set of four pins and a set of three pins. If you just want to light up a lamp occasionally, it is better to use a normally-open circuit configuration.
Introducing the Relay ModuleĪ relay is an electrically operated switch that can be turned on or off, letting the current go through or not, and can be controlled with low voltages, like the 5V provided by the Arduino pins.Ĭontrolling a relay module with the Arduino is as simple as controlling any other output as we’ll see later on.
The example we’ll build shows how to control a relay module with an Arduino and a PIR motion sensor.īy the end of this tutorial, you should be able to control any electronics appliances with your Arduino using a relay module. We make a brief introduction to the relay module and build a simple project example with the Arduino. This article shows how to control mains voltage with the Arduino using a relay module.