Power LED from PC showed on the Blynk app


So I have made a circuit that can turn my PC on and off from the Blynk app (with the push Button widget). I have used a relay to do that and a ESP8266 (NodeMCU). Now I would also like to read the state of my PC by connecting the power LED pins from my motherboard to the micro-controller. But I don’t know how to setup the widget and how to code the thing. Would I need a resistor to limit the current going to the controller? Please help!

first, you should measure on what voltage the led is working. if more than 3.6v, you should use a voltage divider(a decent quality trimpot or 2 resistors), to reduce the voltage to 3.3v.

or, even simpler / better, use an ldr light sensor and hook up face to face to the led with a heat shrink tube. then the ligth sensor can go to the digital pin (input pullup) and gnd. this way you also have galvanically isolated the mcu from the pc.

as for the coding part, if you do not know how to do it, i think you can do without coding, just monitor the respective digital pin state in the app. (however i’m not sure about this.)

even with coding, it is really easy, probably 3-4 lines of code. read about blynk virtualwrite in the docs.

1 Like

Thanks for the reply!

My power LED is glued into my front panel, so I will need to buy a new one.
Will this one work? https://www.banggood.com/nl/300Pcs-20Ma-F5-5MM-Transparent-Ultra-Bright-White-LED-Diode-p-969066.html
And will this LDR work? https://www.banggood.com/nl/100Pcs-5MM-GL5528-Light-Dependent-Resistor-Photoresistor-LDR-p-943463.html?rmmds=search
And will your described method also work for the HDD LED?

I also want to be able to control the main power with my controller (there is often thunder in my area and my outlet isn’t grounded), so I am also going to buy a new relay (with 4 channels). I think I can use the relay to control the reset button too. And the 3rd relay on the board I could use for turning my monitor on and off. That is possible right?

What would really be nice is if I could also turn my keyboard and mouse on and off, so they won’t light up when not in use. Can I cut their USB cables open and let the positive wires go through the 4th relay?
So my 4 channel relay would consist of: 1: PC power button 2: PC reset button 3: Main power for PC 4: Main power for display

Any help would be appreciated, thanks!

the leds and ldr seems ok (but i doubt you need hundreds of them). you should measure the voltage on the existing leds, just to make sure they are compatible.

as for the monitor and reset, yes, they should work, if you know what you are doing with the mains…

but i wouldn’t mess with the usb cables. these are shielded data cables, and if you just cut them, the shielding is compromised and maybe they will not work reliably anymore.

also, if you plan to switch several stuff via wifi+blynk, you should look into the itead brand sonoff devices, they are quite good products, and they already come with a ready made and safe housing, for mains wireing.

1 Like

Since I don’t have a meter, I asked my motherboard manufacturer this: Hello, the power LED light from my case is dead. So, I want to buy a new one, but what amount of voltage do the motherboard pins supply? Thanks!

And they replied this (translated form Dutch): Dear customer, an LED isn’t a light, it is a diode, therefore the amperage is what matters.
It’s also true that a blue LED for example, has a higher milliamperage has than a red or a green one.
So basically, you can use every LED.
If you use the same cable as there is on now, nothing can go wrong. Kind regards

So I can use every LED. But I looked some things up and many people were saying that I should use a phototransistor. So I guess the transistor will work fine?

I do know how the mains work, in my country the phase wire is brown, so that has to go through the relay. I’ll connect an extension cable to the plug, so I can cut that one open instead of the original cable.

For the USB cables, I agree with you that you don’t want to cut them open, but what do you think about this? https://www.banggood.com/nl/2-Port-USB-2_0-Rear-Panel-Expansion-Bracket-to-Motherboard-USB-Header-p-982126.html?rmmds=cart
I guest my keyboard and mouse use USB 2.0 (although they are quite expensive) so there won’t be any performance or reliability loss. And the adapter isn’t shielded anyway, so I can cut it open and run an extension cable though my relay.

yes, you probably can use those usb panels, if you do not mind to do lots of soldering and hacking…

you can use a phototransistor or ldr, both should work. the phototransistor is a bit more advanced circuit, if you can handle that, it is even better, because it gives a much concrete signal.

1 Like

I couldn’t get the LED widget working in the Blynk app, but I can read the value of it with the Value Display widget. It says HIGH for on and LOW for OFF. Can I change those letters or do you know how the LED widget works?

look in the docs. for led widget you have to send a value between 0-255.

1 Like

You can trigger a LED Widget with led1.off(); or led1.on(); And it should work, but if still no notable differences, then make sure it is “set” to highest intensity at beginning of sketch with led1.setValue(255); //set brightness of LED to 100%.


1 Like

Hey, can you show how you did to control the computer with the relay

1 Like

@Gunner’s trigger finger tends to get a bit twitchy when people resurrect old topics, so it’s usually best to create a fresh topic and link to the old one :wink:

To answer your question, the best way is to power the PC via a Sonoff device (that you’ve re-flashed with Blynk of course). The Sonoff S20 is a neat solution.
You’ll need to ensure that your BIOS allows your machine to boot when power is restored.
If you run TeamViewer server on your PC then you can then control it remotely and shut it down gracefully when you’ve done.



I could show you the way with a relay, but that is kinda overkill and not te best solution. I ended up using a transistor instead, which is much faster.

How you did it?

My reputation exceeds me (not a typo :wink: )

Since neither this OP or the follow up question is technically a Blynk related issue; Aside from adding is a widget, the rest is electronics 101. So I will leave it in one topic instead of spreading it around :stuck_out_tongue:

@jesio94 you can easily Google “how to” circuits and tutorials that allow a microcontroller to operate larger power loads… and get feedback sensor data safely into a microcontroller. Blynk just handles the widgets.