# Running 5V device from digital pin

**URL:** https://community.particle.io/t/running-5v-device-from-digital-pin/35922
**Category:** General
**Created:** [September 10, 2017, 3:54am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922 "2017-09-10T03:54:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![bscuderi](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bscuderi](https://community.particle.io/u/bscuderi)
#### Post date: [September 10, 2017, 3:54am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/1 "2017-09-10T03:54:30Z")

</div>

I have a project that I am trying to run from an 18650 lipo battery. The project needs to wake up and measure a temperature with a DS18B20 and then also measure a sonic distance with a HC-SR04 sonic sensor. Since it is battery powered I need the power draw to be as little as possible, because of this, I am running the temp sensor off of a digital pin so I can shut it on and off. This is working beautifully. The problem that I am having is the HC-SR04 is a 5v powered sensor and because I’m powering the photon through the VIN pin with a 3.7 volt LI-Ion battery I do not have a 5v source to power the sensor. So I purchased this little board from amazon…

> **[Amazon.com: DROK&reg; Mini DC Volts Converter Voltage Step Up 3V to 5V Cell Phone Mobile Regulator Power Supply: Home Audio & Theater](https://www.amazon.com/gp/product/B00CXO0WDQ/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1)**
>
> Features: Module Properties: non-isolated BOOST module PCB dimensions: 14.1 x 18.8 x 5.5 mm Input voltage :DC 1-5V Output voltage:DC 5.1-5 .2 V Output Current: Rated 1A-1.5A (single lithium input) Con ...

  
The board works great if I hook it up to the 3.3 pin but then it is powered and wasting battery when the photon is asleep. It will not power up if I try running it off a digital pin switched high. I assume it doesn’t have enough juice to run the board. The HC-SR04 is only supposed to need a few miliamps at 5v so there has to be a better more way to power this from a digital pin. So any ideas for this?

---

<div class="post-metadata">

### Author: ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)
#### Post date: [September 10, 2017, 4:38am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/2 "2017-09-10T04:38:22Z")

</div>

I would power the board from the battery with a MOSFET switch in between that you could use to turn off the board when the Photon is asleep. The gate of the MOSFET would be connected to one of the Photon’s digital IO pins.

---

<div class="post-metadata">

### Author: ![bscuderi](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bscuderi](https://community.particle.io/u/bscuderi)
#### Post date: [September 10, 2017, 4:54am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/3 "2017-09-10T04:54:57Z")

</div>

Would this have a similar or way less of a drain as I currently have? I was looking at this one [https://www.amazon.com/WINGONEER-IRF520-MOSFET-Driver-Module/dp/B06XHH1TQM/ref=sr\_1\_1?s=electronics&ie=UTF8&qid=1505018883&sr=1-1&keywords=mosfet+switch](https://www.amazon.com/WINGONEER-IRF520-MOSFET-Driver-Module/dp/B06XHH1TQM/ref=sr_1_1?s=electronics&ie=UTF8&qid=1505018883&sr=1-1&keywords=mosfet+switch)

do you have an example or better example in mind? Sorry for all the questions Im a hobbyist learning as I go and I’ve never used one of these before.

---

<div class="post-metadata">

### Author: ![bscuderi](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bscuderi](https://community.particle.io/u/bscuderi)
#### Post date: [September 10, 2017, 5:06am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/4 "2017-09-10T05:06:41Z")

</div>

nvm some reading has cleared the air on what these do and I think this looks more simple and all I need. Looks like I could use them for lots of things!!! Ive always used relays even with DC haha these seem way easier for simple small DC switch!!

> **[Amazon.com: Gikfun Packing RFP30N06LE 30A 60V N-Channel Mosfet TO-220 ESD Rated for Arduino (Pack of 5pcs) EK1658: Computers & Accessories](https://www.amazon.com/Gikfun-RFP30N06LE-N-Channel-Mosfet-Arduino/dp/B01GNORMWA/ref=sr_1_3?s=electronics&ie=UTF8&qid=1505019780&sr=1-3&keywords=n+channel+mosfet)**
>
> Gikfun Packing 5pcs RFP30N06LE 30A 60V N-Channel MOSFET TO-220 ESD Rated

---

<div class="post-metadata">

### Author: ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)
#### Post date: [September 10, 2017, 5:08am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/5 "2017-09-10T05:08:42Z")

</div>

Those are the ones I usually use too.

---

<div class="post-metadata">

### Author: ![bscuderi](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bscuderi](https://community.particle.io/u/bscuderi)
#### Post date: [September 10, 2017, 5:12am UTC](https://community.particle.io/t/running-5v-device-from-digital-pin/35922/6 "2017-09-10T05:12:42Z")

</div>

good to know! I knew I could count on this forum again. Thanks for your help I’ll get these ordered up!
