# Using Relay with Photon for controlling Lamp

**URL:** <https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117>\
**Category:** Hardware\
**Created:** [December 8, 2015, 5:11pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117 "2015-12-08T17:11:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dushyantbangal](https://avatars.discourse-cdn.com/v4/letter/d/35a633/32.png) [@dushyantbangal](https://community.particle.io/u/dushyantbangal)\
**Post date:** [December 8, 2015, 5:11pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/1 "2015-12-08T17:11:31Z")

</div>

Hi,

I need to control a standard lamp using Photon.  
I have the code, I dont know much about H/W so I’m following this tutorial to wire up the Relay:

> **[Controlling AC Light Using Arduino With Relay Module](http://www.instructables.com/id/Controlling-AC-light-using-Arduino-with-relay-modu/)**
>
> Hello friends! I'm Ostin,I ll demonstrate how to control a AC light with Arduino using relay module.It is a simple project and also very dangerous as we are going...

I’m using [this Relay](http://www.amazon.in/Channel-Module-Shield-Arduino-Electronic/dp/B00C59NOHK/ref=sr_1_fkmr1_3?ie=UTF8&qid=1449582837&sr=8-3-fkmr1&keywords=SunFounder+2+Channel+5V+Relay+Shield+Module+for+Arduino+UNO+2560+1280+ARM+PIC+AVR+STM32+Raspberry+Pi).

However, the tutorial is for Arduino Uno.  
How do I give the 5V to Relay’s VCC? Do I use Photon’s VIN?  
Should I use Shield Shield? How should I use Shield Shield?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 8, 2015, 5:25pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/2 "2015-12-08T17:25:00Z")

</div>

There are some threads about relays on this forum already dealing with your questions.  
Have a search for `relay 5V`, you’ll be surprised 😉

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [December 8, 2015, 5:26pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/3 "2015-12-08T17:26:38Z")

</div>

@dushyantbangal, you CAN power the relays with Photon’s VIN and GND pins assuming you have a good quality USB power supply (1 Amp ideally). Since the relay board uses opto-isolators, you can connect the IN1/IN2 lines directly to Photon Dx pins. 😄

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [December 8, 2015, 10:39pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/5 "2015-12-08T22:39:06Z")

</div>

> [@dushyantbangal](#):
>
> I dont know much about H/W

Just so it's been said: mains can and will kill you, please be careful. If you're uncertain about something, don't take the risk, it's not worth it. If in doubt, contact a professional electrician.

---

<div class="post-metadata">

**Author:** ![dushyantbangal](https://avatars.discourse-cdn.com/v4/letter/d/35a633/32.png) [@dushyantbangal](https://community.particle.io/u/dushyantbangal)\
**Post date:** [December 9, 2015, 5:43am UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/6 "2015-12-09T05:43:16Z")

</div>

> [@Moors7](#):
>
> mains can and will kill you, please be careful

Ohh I do plan to stay faar away when i switch it on 😃

---

<div class="post-metadata">

**Author:** ![stevech](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stevech](https://community.particle.io/u/stevech)\
**Post date:** [December 9, 2015, 6:57am UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/7 "2015-12-09T06:57:32Z")

</div>

here’s a simple and relatively safe way:

> **[Solid State Relay Module SSR-25DA 25A /250V 3-32V DC Input 24-380VAC Output EW ...](http://www.ebay.com/itm/Solid-State-Relay-Module-SSR-25DA-25A-250V-3-32V-DC-Input-24-380VAC-Output-EA-/261959809704?hash=item3cfe057aa8:g:qD8AAOSw3ydVnSRN)**
>
> Solid State Relay Module SSR-25DA 25A /250V 3-32V DC Input 24-380VAC Output EW | Business & Industrial, Automation, Motors & Drives, Contactors, Relays & Starters | eBay!

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [December 9, 2015, 12:57pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/8 "2015-12-09T12:57:05Z")

</div>

@dushyantbangal, here is an even SAFER way to do it:

[http://www.powerswitchtail.com/Pages/default.aspx](http://www.powerswitchtail.com/Pages/default.aspx)

😉

---

<div class="post-metadata">

**Author:** ![dushyantbangal](https://avatars.discourse-cdn.com/v4/letter/d/35a633/32.png) [@dushyantbangal](https://community.particle.io/u/dushyantbangal)\
**Post date:** [December 11, 2015, 10:30am UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/9 "2015-12-11T10:30:22Z")

</div>

It works! My main doubt was about the VIN =\> VCC of 5V, which was solved

Btw, I used an adapter with output of 5V and 2.0A  
Thank you everyone 😄

---

<div class="post-metadata">

**Author:** ![bz\_](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@bz\_](https://community.particle.io/u/bz_)\
**Post date:** [June 10, 2017, 9:38pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/10 "2017-06-10T21:38:26Z")

</div>

> [@peekay123](#):
>
> [http://www.powerswitchtail.com/Pages/default.aspx](http://www.powerswitchtail.com/Pages/default.aspx)

☹ this link no longer works

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [June 10, 2017, 9:40pm UTC](https://community.particle.io/t/using-relay-with-photon-for-controlling-lamp/18117/11 "2017-06-10T21:40:38Z")

</div>

The main page is often a good idea: [http://www.powerswitchtail.com](http://www.powerswitchtail.com)
