Turn on Relay from Photon on 4 relay

I have a " 4-Channel High-Power Relay Controller Shield + 4 GPIO with IoT Interface", with a photon controlling it. I have written code on the photon that can turn the relays on and off, which I call from IFTTT, and via Alexa. However, I’d really like to also have an external LED, so I can visually see when any of the relays are on.

I don’t understand how to tell the GPIO ports to power an LED from the photon. It sounds like i’d need to set it to analog, and turn it on, but I’m unsure how to map the ports on the photon to the ones on the relay.

any help is greatly appreciated,


Hey @Mark5280, welcome to the community.

When you say GPIO ports are you referring to the terminal block at the top of this image labeled “I/O Connectors”? If so, you can toggle those pins in similar manner to how you toggle the relays, since those pins in the terminal block are connected to pins on the MCP23008, which is the chip used to control the relays.

Which library are you using to control the relays on the shield? If you are using this library, I believe that controlling the 4 GPIO pins in the terminal block is as simple as controlling the upper 4 “relays” with the library, since the integration notes state that:

Relays are controlled by a MCP23008 using GPIO0:3, GPIO4:7 are available for user interface via screw terminals.


HI @Mark5280 -

Did you manage to solve this. I am not familiar with this controller, but usually relays are as simple as:

digitalWrite (*whicheverpin*, HIGH);

I have several 240V, 20A relays which I connect to Digital Pins via NPN transistor and simply pull the appropriate pin High, or Low.

Hope this helps!

As @nrobinson2000 already said, you need to clarify where you have your LEDs connected to?

  • If you have them tied to the Photon’s GPIOs you’d go with @friedl_1977’s suggestion and use pinMode() and digitalWrite().
  • If you have them tied to the GPIO pins on the realay board you’d use the libraries MCP23008::setOutputs(mask) function with a single byte bitmask with the high nibble representing the GPIOs or MCP23008::setOutput(channel) for a specific channel.