New Project - Steam room controller - Photon and Relay

I spoke too soon! I couldn’t use the function from ifttt, it kept giving me an error. Something is still wrong : /

I tried this…

int button = D0;  

void setup() 
{
    
    pinMode(button, OUTPUT);
    
    digitalWrite(button, LOW);
    
    Particle.function("SteamRoomOn", SteamRoomOn);

}

int SteamRoomOn(String command)
{
    if(command == "SteamRoomOn")
    {
        digitalWrite(button, HIGH);
        delay(1000);
    return 1;
    }
    else
    {
        digitalWrite(button, LOW);
        return 0;
    }
    return -1;

}
    

void loop() {

}

Now I am back again to the relay staying on! Ugh. I need to do some more tutorials : /

The relay is normally open. It has been put into operation operating a garage door.

This is a link to the relay.

When the relay closes the circuit, it makes a very distinct “TICK” sound. For clarity, i’ll just say the circuit closes or something. I know it works, the hardware is fine. Its the code. I was able to get a version of the code above to leave the circuit open, however, when I went to add the function into IFTTT, there was an error, even though the code compiled… something is wrong and I don’t know enough to figure it out.

The 3.3 vs. the 5v, its worked before.

You are right on the connection to the switch setup with the steam room, i want it to work in parallel. It’ll be wired very much like the garage setup I had.

I am purchasing this as a workaround. As much as I enjoy the particle board, I just don’t have the time to troubleshoot the code given my experience level. Thanks for the help all!
If anyone has any further ideas with the coding, let me know.

with either device you might want to consider a waterproof enclosure of some kind or bare minimum a somewhat sealing plastic box since steam and/or high relative humidity has a way of negatively affecting electronics. good luck with the project. and remember the desiccant pouches inside the box.

I have access to the button that I will be tapping into from behind the wall. If it gets wet, i’ll have bigger things to worry about :wink:

This is the final code - still works today!

// This #include statement was automatically added by the Particle IDE.
void resetAll() 
{
  digitalWrite(D0, LOW);
}

Timer switchOffTimer(1000, resetAll, true); // create a 1-second-one-shot timer that calls resetAll()

int Steam (String command);

void setup()
{
  
  Particle.function("SteamOn", SteamOn);
  Serial.begin(9600);
  pinMode(D0, OUTPUT);

}
void loop()
{

}

//Function to turn on steam room
int SteamOn (String command)
{
  command.trim(); // remove possible leading/trailing white space
  int retVal = 0;

  if(command == "SteamRoomOn")
  {
    digitalWrite(D0, HIGH);
    retVal = 1;
  }
 
  else // something went wrong, so be save and switch off immedeately
  {
    switchOffTimer.stop();
    resetAll(); 
  }
  
  if (retVal > 0) 
    switchOffTimer.start();

  return retVal;
}
2 Likes