I have an Arduino Mega and a 4-channel relay module.
This is the relay module.
When the Arduino digital output is LOW, the relay is energized. When the Arduino output is HIGH, the relay coil is de-energized.
How can I fix this?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
That's how they're designed to work energized is LOW de-energized is HIGH you just need to take this into account when writing your Arduino code
If you read the documentation or watch/read any tutorials on the mechanical relay you are using you will learn that LOW is active and HIGH is inactive for these devices. There is no way to change that behavior, that is how they are built. (Well, you can, but it's not worth the effort)
This design is intentional to prevent relay activation on power-up or system reset. And be sure to put this code in your setup routine to ensure proper system initialization.
digitalWrite(Relay, HIGH); pinMode(Relay, OUTPUT);
Where Relay is the pin variable you defined for your relay.
Just code your routine using LOW to activate the relay when necessary.
Try this tutorial 4 channel relay tutorial
Hiii brother, yes all relays has this problem exept keystudio relay modules, you can fix it about using a trasintor npn 2a2222 and connect gnd to collector, pin x to base and relay pin to emetor,