# Running Photon using Mains power through a relay

**URL:** https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176
**Category:** Hardware
**Created:** [November 4, 2017, 7:59pm UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176 "2017-11-04T19:59:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alexhillary](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@alexhillary](https://community.particle.io/u/alexhillary)
#### Post date: [November 4, 2017, 7:59pm UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/1 "2017-11-04T19:59:49Z")

</div>

Hi, I am creating an internet switch for a light bulb (for a wall light) and I am running a mains power cable to a relay then through the photon to power the bulb. However, I need the photon to run without its USB connection.  
How can I wire this in to my mains power cable? Can I power it through the VIN pin?  
I am using a Particle Photon and a SRD-05VDC-SL-C relay.  
Thank you!

---

<div class="post-metadata">

### Author: ![Postler](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/postler/32/13693_2.png) [@Postler](https://community.particle.io/u/Postler)
#### Post date: [November 4, 2017, 11:55pm UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/2 "2017-11-04T23:55:55Z")

</div>

You switch an independent circuit for your lamp with the Relay.  
The photon is connected to the side with the 5V.  
I recommend the [photos from this project for guidance](https://www.hackster.io/ingo-lohs/mywater-fountain-controlled-by-particle-photon-and-blynk-bdd09d) and [more in detail in this project](https://www.hackster.io/ingo-lohs/mypir-sensor-activate-rgb-stripe-controlled-by-relay-f8010c).

---

<div class="post-metadata">

### Author: ![hawesg](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/hawesg/32/15655_2.png) [@hawesg](https://community.particle.io/u/hawesg)
#### Post date: [November 5, 2017, 1:53am UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/3 "2017-11-05T01:53:45Z")

</div>

You need 5v for VIN (and i’m assuming powering the relay board you are using. You need a power suply that will turn 120v AC to 5v DC, or you could make something yourself something like a transformer to step down the AC voltage, then a bridge rectifier to convert from AC to DC then a linear power regulartor to step down to 5v dc (there are other components in the circuit obviously) this is a bad idea if you don’t know what you are doing.  
If you want to power your photon you will need a power supply something like this maybe [https://www.jameco.com/z/IRM-05-5-MEAN-WELL-AC-to-DC-Power-Supply-Encapsulated-Type-5-Volts-1-Amps-5-Watts\_2193133.html](https://www.jameco.com/z/IRM-05-5-MEAN-WELL-AC-to-DC-Power-Supply-Encapsulated-Type-5-Volts-1-Amps-5-Watts_2193133.html).

---

<div class="post-metadata">

### Author: ![alexhillary](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@alexhillary](https://community.particle.io/u/alexhillary)
#### Post date: [November 4, 2017, 7:58pm UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/4 "2017-11-04T19:58:01Z")

</div>

Hi, I am creating an internet switch for a light bulb (for a wall light) and I am running a mains power cable to a relay then through the photon to power the bulb. However, I need the photon to run without its USB connection.  
How can I wire this in to my mains power cable? Can I power it through the VIN pin?  
I am using a Particle Photon and a SRD-05VDC-SL-C relay.  
Thank you!

---

<div class="post-metadata">

### Author: ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)
#### Post date: [November 5, 2017, 2:31am UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/5 "2017-11-05T02:31:07Z")

</div>

You need something like this to convert the AC mains to 5V DC that will go into Vin.

[https://www.mouser.sg/ProductDetail/RECOM-Power/RAC05-05SK/?qs=sGAEpiMZZMuWiaalG5TUgGqTPUILE6OSkXGkAo4SmaW3R9LaMWKv4g%3D%3D](https://www.mouser.sg/ProductDetail/RECOM-Power/RAC05-05SK/?qs=sGAEpiMZZMuWiaalG5TUgGqTPUILE6OSkXGkAo4SmaW3R9LaMWKv4g%3d%3d)

**NOTE: This is high voltage AC that can kill. Do find someone competent to carry out the wiring.**

---

<div class="post-metadata">

### Author: ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)
#### Post date: [November 5, 2017, 2:32am UTC](https://community.particle.io/t/running-photon-using-mains-power-through-a-relay/37176/6 "2017-11-05T02:32:49Z")

</div>

@alexhillary please also refrain from double posting. Thanks!
