Newbie help with relay control

(Josh Huffmaster) #1

Hey guys and gals I am new to this whole Ardurino and program bit. I’m looking for some help writing a Sketch to control on/off of relays.
I have a arduino mega and want to run a bank of relays to turn on/off relays. Start basic with some simple serial commands and maybe move to some Kind of app later.

Any help on where to look and research would be great!!!

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Are you using the ThingShield or some other method of communication with SmartThings?

There are a few very well fleshed out ThingShield based Arduino relay Projects on the Forum. :mag:

(HousePanel Author) #3

check out the examples on

and that will get you going. I used that to write a sketch that activates a relay after detecting the on/off IR code for my stereo. I plan to use this to activate the fan to cool the unit that is in a drawer. The point is you have lots of good examples on that site to help you. It is pretty simple. Relays just need 5V on the solenoid coil to move the pole from normally closed side to the normally open side. To do this just put the voltage on a digital pin of the Arduino and set the pin to high using digitalWrite(pin, HIGH) where pin is the integer number of the pin where you have the relay 5V input connected.

The only hard part is figuring out which terminal is which but it will be obvious if you test it with a multimeter first. All this and more is explained on

(Keith Croshaw) #4

I recommend starting with the Arduino Uno. There’s a shield that works with SmartThings and it’s the easiest to upload to. I started with one from Adafruit with a crazy reset/download sequence. Worked but it was a rude welcome.