PC power through Blynk

So are you saying that when you pulse the relay for say 1 second without it connected to the PC it works correctly (closing the relay contacts for 1 second then releasing) but not when the relay contacts are connected across the PC?

Pete.

@PeteKnight exactly. I also tried seitching an LED on and off to make sure it works.

How exactly are cou connecting this up?

Pete,.

D0 pin,3.3v pin and GND pin from nodemcu to Data,Vnn and GND pins of the relay. The relays open contact and middle contact are connected to the power pins of the motherboard.

I’d definitelly use a relay or an optocoupler.

Well, D0 (GPIO16) isn’t a great choice, see this:

And I’d probably power the relay with 5v rather than 3.3v, but if it’s working well on the bench and not when connected to the PC then it sounds very odd.
How are you powering the NodeMCU?

Pete.

@PeteKnight I’m also using a relay for switching on and off a LED strip that has been working for months, powered by 3.3v. I’ve tried powering the MCU from the PCs USB ports and from an external battery.

It’s almost impossible to diagnose what’s happening here, but it’s obviously something obscure.

I’ll throw in an alternative for you…

I use a Sonoff S20 as my way of remote booting my PC. My BIOS is set to boot on power-on (make sure yours has this option) and the Sonoff switches the mains power. The only small anomaly with this approach is that the PC power supply stores a little bit of power, which takes around 20 seconds to dissipate (in my case). This means that after powering-off the PC you have to wait around 20 seconds before reapplying the power to get the PC to boot. If you apply the power before the stored energy has dissipated the PC doesn’t recognise it as a power-on event, so won’t boot up.

If you want to, you could also use an MCU (ESP-01 maybe) to sense that status of the PC’s power LED to give an indication if the PC has booted. Just be careful that you know what sort of voltage is being supplied to the power LED, as I’ve seen some that use 5v LEDs that would need a resistor to drop it to a safe voltage for an ESP-01.
A shared ground would also be a good idea.

Pete.

I’m assuming the Sonoff S20 is a smart plug, right? I tought about it, too, but can I link it with Blynk? Also, for shutting down, is cutting the power the same as using the power button to shut down?

Yes, the S20 is a smart plug and it can be re-flashed with your own code, including Blynk code. There’s info on re-flashing similar type of smart plugs, and some code examples here:

Cutting the power isn’t the same as using the soft power switch on the PC, but it depends what you want to use it for.
I spend quite a bit of time away from home and want my PC off during these periods. But, I also want a way of remotely powering-up the PC so that I can connect to it remotely via TeamViewer. I don’t like WoL, and it’s not reliable enough for me anyway, so this solution works very well for my needs.

Pete.

I might use this method. But first, I’d like to have a few more attempts with the relay, maybe using different pins or a different board.

Regarding the WOL method, I’ve used it before and it worked pretty well. But at the moment I don’t have a wired connection to the router on my PC, I’m using wifi connection.

I have a raspberry pi lying around, would it be possible to connect it via cabla to the pc and maybe use it as a server for WOL?

Wake up over Wireless LAN (WoWLAN) should be possible, and WoL doesn’t need a server, but there are security issues and many domestic routers don’t properly support static routing that’s needed for WoL. Even with the correct kit the magic packets seem to get randomly blocked by both of my ISPs, which makes it pretty useless.

Pete.

Well, when I used the WoL method I had anither PC that was on all the time, that why WoL was possible. I tought the raspberry would be a good alternative to that.

You obviously know more about WoL than me, so I’ll let you explore that yourself. The Sonoff solution works very well for me and I can’t see me changing from that anytime soon.

Pete.

I have set up my Raspberry anf I’mnstill trying to wrap my head around it as it’s the first time I’m using it. Using WOL to wake the PC via Raspberry is possible as I’ve read, like creating a batch file that sends a magic packetnto the PC. My question is: am I able to run that batch by using a Virtual Pin tied to a button widget?

Another approach…

Pete.

1 Like

@PeteKnight seems like the problem with the relay method was the power source for the MCU. The USB ports I have used seem to power up slower. I have tried plugging it in directly to a socket with a 12v adapter and it works just fine.

So you were trying to power the MCU from the PC?

Pete.

Well, yes… and it does work if I power it directly from the motherboards ports. I also have another MCU hat I use for monitoring my plant that I have powered from the PC when off, so I tought there wouldn’t be a problem. Now, for the next part: is there any way to update the button widget state if I turn on the PC from the power button?

If you’d have shared that piece of information earlier then you’d probably have found a solution quicker.

I’d sense the state of the PC’s power LED via a pin on the MCU, but heed the warning I gave earlier…

Pete.