At my workplace we had a farm of laptop machines and we weren't allowed to disassemble them to pull any power wires out. What we ended up using was a remotely controlled motor with a small plastic "finger" attached that would press on the power button for n seconds, depress, wait few seconds, then press it for n seconds again to do remote hard reboots.
Had a secure server room with a maglock with very few cardholders and forgot our cards a few times. We wired-up a CD-ROM drive to a server positioned so that it pressed the door unlock button on the wall when it was ejected, so someone could ssh in to the server and "eject /dev/sr0" to get in.
Found a similar rig set up years ago. The old Tektronix TDS scopes used to lock up in a go/no go test rig and stop responding to GPIB commands. Someone unknown got fed up of it so they wired a relay in a box up as an inline switch for the scope power and drove it from a spare port in a GPIB switch box that the test script talked to. This turned the scope on and off again before each test cycle so it was less likely to crash. This saved hours and hours of failed test runs.
That is awesome and I'm glad somebody did it. But was there some reason not to just pull the laptop batteries and use normal remote-controllable outlets?
> was there some reason not to just pull the laptop batteries and use normal remote-controllable outlets?
What happens when someone accidentally does a clean shutdown from within the OS?
Switchable PDUs have the same issue. You need something like Wake-on-LAN in addition to the switchable power to ensure you don't need to do a late night drive into the data center or office.
I know that HN is crazy about their homelab setups, but please consider whether having a rats nest of jumpers and a breadboard in your comms cabinet is reliable, let alone safe... How about a tweak to the BIOS to auto turn on power, then plug it into a Shelly Plug running Tasmota? You get your remote turn-on, you get a tested, reliable, and safe solution, and you get power use monitoring on top of that.
The difference in price is ~ 10 eur where I'm at, and I'm not including the rest of the BOM of OP:
A smart plug would probably work just as well for most cases, but one downside is that you need to ensure your computer is safely powered off before turning off the smart plug.
Conceptually, pressing the power button seems a little cleaner to me, and also works well with suspend-to-ram (what I originally wanted to do), which the smart plug can’t do.
I’m not too concerned with safety — we’re talking about 3.3V (signal) and 5V (power) here.
Some motherboard BIOS has the “Restore on AC Power Loss” config item with options. I think that’s he is referring to. IIRC, each of which do following:
- “Stay Off”: do nothing
- “Power On”: turn on after AC is reconnected
- “Last State”: turn on after AC is reconnected, only if disconnected while running
You shut down your computer the usual way, from the OS, then toggle the plug to restart it. In case the system hangs during shut down, you'd actually want to know that it's hanging, which you can actually see in the power readings of the plug.
> I’m not too concerned with safety
I'm sorry to state that, but that much is evident from the photos in the blog post (assuming you're author here). While the voltages may look safe to you, the whole contraption is safe just until something goes wrong. Examples:
1. You push around a dangling wire and short out a more powerful circuit.
2. Something on your dev board for development purposes releases the grey smoke. 500mA at 5v may seem low to you, but under the right circumstances might cause a fire. I don't see any fuses or other overcurrent protection in your schematic.
3. Your mainboard gives a defect and runs more that the expected voltages/currents to your dev board. God forbid AC from something else faulty in the electric installation (just saying because I've been zapped from touching the outside of a closed case).
4. Power surges, lightning strikes... Static electricity even...
Part of the motivation of "homelab" for many people is to learn in a practical way. If you're new to electronics or ESP32s, the amount you'd learning doing this is worth far more than 10 eur.
Why would jumpers (specifically, DuPont connectors) be unreliable, or even unsafe? They're literally the method used in every single computer PC case in existence and work fine. I've never had one fail.
I agree, breadboard is slightly problematic, but that could be fixed quickly with a soldered perfboard setup or a quick custom PCB and remove the breadboard component.
The voltages we're talking about here is all 5V, and anything it's connected to should be pretty limited in current carrying capability.
Great project but a little too much for the ones of us with only software development skills.
I use smart plugs over Wi-Fi to do that. Shelly Plug S have a small physical button, a web app, a HTTP URL to call to switch the plug on or off. They also have a lot of features that I don't need. Among them MQTT and Alexa/Google integrations. A few bash scripts with curl and I can do everything I need. The price is reasonable and they saved me a lot of time.
I use a couple of Ewelink devices (hardware-equivalent Chinese clone of Sonoff S20 from AliExpress), reflashed with open source Tasmota firmware for the same purpose: remotely controlled power socket, with physical button, connected to WiFi, with HTTP web page and REST API for curl etc, firmware has MQTT support too; I have no idea about Alexa/Google integrations (likewise, I'm not interested in this feature), but the price is bargain, $10/each. Sonoff S26 clones are good for this purpose too, but UART port is easier to solder on S20 (larger one). Soldering UART port is necessary for reflashing to Tasmota, because stock firmware is utter crap.
how do you feel about leaving "Chinese clone" devices plugged in 24/7? do the plugs have a ground pin? do they get hot? do they have CE certification? genuinely interested in this setup and don't answer if too prying. thanks
Ground/PE pin is there, in passthrough mode at least (I'm using European/Schuko version). CE certification is obviously missing (in Conformité Européenne sense I mean, China Export is there), but hardware is 1:1 clone of Sonoff, so I don't worry too much about safety. The device looks like a mass produced in a factory, not a homemade solder in a garage. Temperature isn't hot, looks normal to me. ESP8266 chip is the same, the rest (a few Y caps, resistors, LEDs, pushbutton etc) I'm pretty sure is chinese crap anyway, regardless of whether this is Ewelink or genuine Sonoff. Local suppliers here in Ukraine are selling Ewelinks reflashed to Sonoff firmware as genuine Sonoffs anyway, so I see no point in spending more.
> Great project but a little too much for the ones of us with only software development skills.
It's a transistor, a resistor, and some wires. The ESP32 boards are trivial to program even without embedded-specific development experience, using just the Arduino IDE and a USB cable.
It's 3 components, a bread board and some wire. I would encourage any "software only" people to give it a go :) The software side (MQTT, ESPHome, Docker) of this is far more complex than setting up the hardware.
The rationale to justify the wifi link is interesting, and this is a creative solution indeed!
In the past I've used wake-on-lan cards but with the wake signal connected to the reset line instead, so it became reset-on-lan. That's much more useful in my lab, I don't know about yours!
This is a neat writeup. I think the ESP32, alongside similar microcontrollers that tie communication via complex protocols so close to direct interaction with the physical world for such a small energy cost, are really amazing for teaching, inspiring, and empowering otherwise "non-technical" people. Of course, you do have to be able to program, but I think we're making great strides in making that as easy as possible with things like CircuitPython and EduBlocks.
Also, this kind of shocked me:
> none of my followers had ever seen functioning WOL on any 10 Gbit/s card.
Those cards are way too expensive to be lacking such a useful feature!
It seems likely that most existing deployments of 10Gbps cards are into a machine that has an alternative management card (which has no reason to be 10Gbps-capable).
I don’t need to WoL via my 10Gbps card near as much as I need WoL on the management interface.
We’re already starting to see 2.5 Gbps interfaces become more and more popular on mainboards, so I suspect once 10 Gbps interfaces become more common on high-end mainboards, vendors will start caring about WOL with these chips :)
No electronics skills, flashing of firmware, etc. is needed. Just order a USB relay board and hook NO and COM terminals to the power switch. Can be driven from a cheap Rasberry Pi or any other low power mini PC.
15-20 years ago if you were using a cheap dedicated hosting company that stacked "servers" in desktop cases on wire racks and somehow offered instant remote reboots despite clearly being too cheap to buy switched PDUs, they were doing something just like this.
> I wanted a quick solution (with ideally no custom firmware development) and was already familiar with ESPHome, which turns out to very easily implement the functionality I wanted :)
> In addition to a standard ESPHome configuration, I have added the following lines to make the GPIO pin available through MQTT, and make it a momentary switch instead of a toggle switch, so that it briefly presses the power button and doesn’t hold the power button:
Really simple looking understandable yaml.file constitutes almost all the softwafe development done for this project. Stunning. Nice.
Few years ago I did the same thing with a raspberry pi zero W and two bash scripts - one for power on/off one for reset. It's quite useful to have and was born out of the need to reboot my Ryzen 1700x powered pc, due to p(ower)state bug that I only uncovered as the culprit a year ago.
I want this feature. Power cycle a machine from somewhere else. The smart PDU strips are suspiciously complicated and expensive enough that I don't want to discover I bought an unreliable one.
Current thinking is a relay held open by power over ethernet and toggle the switch port to reboot it, but I don't quite have the nerve to solder the relay myself. I can't deal with a dead/crashed switch remotely anyway.
A mosfet seems pretty overkill for this instead of practically any cheaper transistor unless there’s something about motherboard headers I don’t know. Pretty cool though.
My 5min hack would look like this - and optionally a 0.1uF and a 1k resistor for peace of mind - totally untested though. Usually a uC I/O pin has three states; output high, output low and Hi-Z. Hi-Z is high-impedance or extremely high resistance state, analogous to an open circuit.
Right, just toggling a GPIO. From what I can tell, there is some claim of 5V 500mA for a short period when doing this, which would explain the transistor.
I mean, you can use a GPIO on a microcontroller as a switch if the current is small enough... this device is not directly in the path of 120V, it's just twiddling a GPIO on the motherboard... right?