lohasample.blogg.se

Arduino relay
Arduino relay




arduino relay

If you’re not familiar with mains voltage ask someone who is to help you out. Warning: in this example, we’re dealing with mains voltage. The diagram shows wiring for a 2-channel relay module, wiring a different number of channels is similar. Taking this into account, the safest ESP8266 pins to use with relays are: GPIO 5, GPIO 4, GPIO 14, GPIO 12 and GPIO 13.įor more information about the ESP8266 GPIOs read: ESP8266 Pinout Reference: Which GPIO pins should you use? Wiring a Relay Module to the ESP8266 NodeMCU BoardĬonnect the relay module to the ESP8266 as shown in the following diagram. This may be problematic if you have relays or other peripherals connected to those GPIOs.Īdditionally, some pins must be pulled HIGH or LOW in order to boot the ESP8266. Some ESP8266 pins output a 3.3V signal when the ESP8266 boots. That configuration physically isolates the relays from the ESP8266 with the module’s built-in optocoupler, which prevents damage to the ESP8266 in case of electrical spikes. Without the jumper cap, you need to provide an independent power source to power up the relay’s electromagnet through the JD-VCC pin. That means the relay electromagnet is directly powered from the ESP8266 power pin, so the relay module and the ESP8266 circuits are not physically isolated from each other. With the jumper cap on, the VCC and JD-VCC pins are connected.

arduino relay

Notice that the module has a jumper cap connecting the VCC and JD-VCC pins the one shown here is yellow, 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.

arduino relay

Use a normally open configuration when you want the current to flow occasionally (for example, turn on a lamp occasionally). You should use a normally closed configuration when the current should be flowing most of the times, and you only want to stop it occasionally. This means that you’ll have the following scenarios: The relay is triggered when the input goes below about 2V. The signal you send to the IN pins, determines whether the relay is active or not. If you have four channels, you’ll have four IN pins, and so on. If your relay module only has one channel, you’ll have just one IN pin. The first set 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.






Arduino relay