I bought a Chinese 4-channel relay board as pictured below. When I coded my Arduino Nano project, I had used HIGH for on and LOW for off (what a surprise, right?).
Unfortunately because of the way this relay board was designed, it actually wants you to sink to ground to turn a relay on, thus the relays in my project were operating backwards.
I did some micro-surgery and modified the PCB to remove the common VCC and made ground common instead, so the problem is solved, but I wanted to know, what would be the correct way to handle this in the future?
Is there a way you can invert the digital output pins without literally swapping HIGH and LOW (which would surely make the code a bit confusing).
I suspect they use active-low signalling on relay modules because many industrial sensors have
open-collector outputs and can only sink current, and this is also the case with most comparator chips.