IFTTT/Photon False HIGH

I’m using a 120v relay to give a HIGH/LOW signal to my photon. Any time there is a change in state, the photon publishes an event. I’m using an IFTTT applet to log the state changes in a Google Docs spread sheet. It seems to be working well, but for some reason it is logging state changes occasionally when the relay is disconnected from the coil power, but the photon is still on. Any ideas on what could be going on here?

Missing pull-resistors?

This is what I had before. I’ll add in the INPUT_PULLUP. Now it’s not working at all, so I need to do some troubleshooting.

int alarmPin = 7;

void setup() {
pinMode (alarmPin, INPUT);

}

void loop() {
if (alarmPin == HIGH);
{
    Particle.publish ("Ozone On");
    
}

}

When you are checking for HIGH, I suppose you rather want a pull-down.

Pull-resistors always need to pull to the opposite level of the signal you are trying to detect.

1 Like