Controlling Switches

So this may be a dumb question, but I was just wondering how I can use my spark to control a lightswitch or really any other type of switch where the spark core would act as the switch/button.

I ask this question because I’m pretty sure the Power Switch Tail requires a switch, and also I’d like to try automating my home.

Yup it’s possible.

We have a relay shield or you can use Solid State Relay to replace a button

Hey @threetwentysix,

I have just finished integrating a power switch tail into one of my projects - it’s super simple. The power tail contains a main power rated relay and the necessary interface bits to turn it on and off with a low power signal.

Something like the following works fine:

void setup() {
    pinMode(D7, OUTPUT);
}

void loop() {
    //turn on
    digitalWrite(D7, HIGH);
    delay(1000);
    //turn off
    digitalWrite(D7, LOW);
    delay(1000);
}

The above assume you connected the ‘+in’ on the power tail to D7 (the ‘-in’ goes to ground on the spark core).

5 Likes

awesome. thanks!!!

cool. i’ll go check that out!

@threetwentysix

Light Switches have Very High Dangerous Voltage that require isolation by using a solid state relay, etc. You Might already know too that the spark core can not switch high voltage without isolation.

Be Safe - Please ! There are many experienced people on this forum who know the safe way to do it.

@spydrop, the Relays are mechanical and fully isolated from the spark core so no worries about that :smiley:

Yes, if a Spark Core Relay Board is used. I was just throwing it out there for general knowledge for safety’s sack. Can’t be too safe. And once again - I’m being a slacker. I should of pointed out that the Spark Core Relay board is rated for 110v with my statement. Have to update my brain to get it right next time :smile:
Bobby

1 Like

@spydrop can you suggest a good solid state relay that can be used to switch light? I am new the electronics world and looking for a good reliable solid state relay that I can use to control 24V (DC) or a 110-220V AC.

Thank for your help

Are you using a Powerswitch Tail 1 or 2? I’ve got a Powerswitch Tail 1 and I’m not having any luck with activating the relay enough to get the switch to activate. When running your code, the indicator LED turns on, but no power can be drawn. Any ideas?