Automatically start/stop a laptop on AC

Hi there,

I have a little solar system and an output that triggers the inverter when the batteries are floating full to use up the excess energy on sunny days.

I would thus like to somehow modify my windows 10 laptop to automatically boot / shut down according to the AC supply status, cycling the internal battery as little as possible.

My very crude approach to this would be to mess with the power button and external hardware to send the proper boot/shutdown signal to the laptop. Does anyone have a better idea?

What I’m thinking about it getting a Pi Zero that’s able to interact with the solar power to read the charge values.
Then create a simple program that opens a TCP port on your internal LAN from your laptop to listen on.
When the battery system is full the Pi should send something on the same TCP port your PC is listening to trigger a safe shutdown.

If you want your laptop to also turn on you could set up in BIOS the laptop to automatically turn on when you plug it in and have the laptop charger connected to a relay controlled by the same Pi.
After the Pi has sent the off signal you could make it ping your laptop on the network to make sure it’s off. When it sees that it has been off for, let’s say, 5 minutes, it cuts power to the laptop charger connected to the relay.
To turn it back on just program the relay to turn on when the charge status of your solar system meets your conditions.

I have a few of these cheapo fake-mppt solar charge controllers:

They have a digitally adaptable on and off voltage which i plan to utilize to switch a relay.

But thinking this through further i might aswell just pick a device that supports “restore power on AC loss” directly from the bios - which seems to mostly be the case with desktop mainboards rather than laptops.

Going with linux i guess i could even skip the entire shutdown process and just hard toggle it. I want to do some mining using an rx570 or the stupid 3080 max Q laptop gpu with that spare energy.

… like planetary science and stuff… :slight_smile: …on second read, no solar power, ok.


… at least dell laptops have this “Wake on AC” feature.


These are some of the hackable wall plugs (relay+microcontroller+power supply+status button+led+nice box+…) that are based on esp8266 or esp8285 or similar.

Generally, tuya-convert works on them to flash Tasmota, and if you happen to use Home Assistant you can go from Tasmota to EspHome for better HomeAssistant integration. Both will allow you to script the behavior you like.

I have some of these sockets that also have a power/voltage measurement IC (not all do), and some have RGB, both might be useful for scripting.


If you’re DIY-ing stuff/Arduino like things etc, from your own PCBs and perhaps not scared of a bit of cable crimping and soldering and want to optimize for extreme power saving and are worried that a wall socket might use too much power, there exist esp32 boards with built-in lipo charger ICs on the board.

Reason they’re interesting is because esp32 have a secondary ultra low power coprocessor (measured in microamps) that can do a bit of stuff while main microcontroller CPU (20-140mA… because wifi) is off or in deep sleep.

People use the ULP feature usually coupled with ultrasonic distance sensors in e.g. mailboxes to detect when the door is open and/or where the main CPU to have it go report something happened over WiFi. An 18650 or a cell phone lipo battery will last months/years on paper when used for this purpose and will generally lose more power on self-discharge than monitoring distance to mailbox door or distance to some letter from bottom of the box.

2 Likes

Something like an Arduino can look at voltage (through an optocoupler) and then send serial commands.
Or, like @MetalizeYourBrain suggested, RPi sending something via LAN.

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.