Remote PSU Control


Hello! I apologize in advance if this is in the wrong area. I have searched and could not find anything on this subject outside discussion of other relays used. I have a few of these Wemos D1 Relay Mini from when I was tinkering with home automation and was wondering if I could possibly use one for my OctoPrint setup I'm currently working/learning on at the present time?

Thanks in advance for your time in responding.


I assume you want to remotely power on you Pi? If so you could certainly fabricate something that could do that but I can't say I have done anything like that as it would require some type of wireless radio or IR communication. Arduuino's have blue tooth modules so I assume you could incorporate that to control the relay.

My printer and pi are next to each other so I built an enclosure for the printer and installed an 2 gang electrical box to hold receptacles and a single a handy box to hold a single poll light switch and wired with j cord. No when I fire up the system I just flip the switch and the printer, led light, pi and monitor all go on at once.


@airscapes thanks for your response. I like your setup. You are correct, however I was looking to use the Wemos D1 Mini Relay with my Pi as the relay the Pi would need it needs in the PSU line to remotely turn the Printer on. Now I don't know if this a Noob question or but was just wondering if I could use IT with the Pi for remote control via OctoPrint.


So your Pi can turn the power on, but you need a relay/optoisolator that will trigger on 3.3v. The "5v relay" may work, it depends what it takes as the trigger. Here's an example of a 3.3v relay that works well; a 5v version of the same may work, but you'd have to give us a chip ID.


I'm using a couple of the TP-Link Smart Plugs and a pair of Echo Dot/Spot in two rooms. I just say "computer, turn on the 3D printer" and it turns on.


@tedder42 thanks for your response and yes that is what I would like to do. Like stated above I have a few of these laying around collecting dust and would like to find out if this particular one can be incorporated in the place of the of the one that you suggested. Which would keep me from having to wait a minimum of 20 days to get it here to the US...OR a suggestion of a place here in the states that I can purchase one that will work.
I am new to octoprint but I have seen various relays used to control the printer over the web and I was just curious if there was a way to incorporate the one I presently have and if so, could some point me in the right direction to make this Wemos D1 5v Relay work.


Sure, it's annoying to have to wait for overseas shipping. I get derailed on a project (or solve it another way) by the time it shows up.

Here's the schematic for the relay. It uses a little 2N7002 MOSFET (transistor) to drive the relay. With the caveat that I provide no warranty and dealing with 120v/240v is dangerous, it should work just fine. Here's how to hook it up:

I'd suggest testing with no load or a LED+resistor instead of high voltage. You'll be able to hear the relay clicking if you have it working correctly.

So, on to the Pi. Assuming you have the GPIO stuff set up, the following commands will put pin 11 into output mode, then turn it on and back off.

gpio -1 mode 11 output; gpio -1 write 11 1; sleep 1; gpio -1 write 11 0; sleep 1

You can rerun that as many times as you need until you have it working- especially handy if we guessed wrong on the D1 pin on the Wemos board. Yes, it's okay to keep setting 'output mode'. Doesn't hurt anything.

Let me know. Again, be careful with the high voltage!


@tedder42 your awesome! Thank you for your efforts! I will try and let you know the outcome. I totally understand that safety precautions should be taken and do not hold you liable for any advice you have given wish me luck!


@tedder42 Just being safe than sorry. I checked out the bottom and it did have some soldering on the bottom and just would like to know if that changes anything in your advice. Actually, attached you can see my specific unit I'm inquiring about. Like I said....Just being safe than sorry. Very new to these type of things. But love learning it all.


Good eye. And wise to check! I'd noticed when I was googling the relay that there was a "v1" and a "v2". I used the latter above. The bottom of the v1 looks like yours, here's the schematic too.


  • it uses a different transistor, this one is a S8050. I'm not an EE but I can muddle through a datasheet, normally I'd look for "Vth" for a threshold voltage. This has a "base-emitter voltage", which is close enough to Vth. It's 1 volt. That means it'll certainly trigger with the 3.3v the Pi puts out. That's good!
  • there's no set of jumpers, so the switch pin isn't flexible, but that also means we don't have to figure out which jumper is actually connected.

So the instructions stay the same, because it still uses pin D1. Have fun!

Also, I'm literally watching this video while typing this reply.


@tedder42 What video were you referring to? isn't working.


doh- fixed the broken link.


Just pushed a PR to the plugin repository that adds Wemo device control to OctoPrint. I know you have a solution already, but this may work with those D1 relay devices you have.