Every morning I had to press the power button at the back to boot up my PC; I wanted to be able to use Wake On LAN to boot up, but having to boot up another PC to do so was nonsense. So we created a Box that sends Wake On LAN packets with a single button. It's pretty cute, isn't it?
This is the small control box that can wake up the PC using Wake On LAN. You can just push a button, PCs will wake up from the power off status. There is no need to start up another PC in order to start up a PC with Wake On Lan. Wake on LAN packets are sent via WiFi LAN. The Box has a battery, and you can charge it from a USB Type-C port. Once charging full, you can use it for a month. (sorry I guess, because I still measure the consumption) If any buttons are not pressed for the specified time (default 30 seconds), the box will sleep automatically and conserve battery power. Up to four PCs can be registered.
How it worksThis box can send a Wake on LAN packet to the Wireless Access Point. To transfer the packet, Access Point need to be set Bridge Mode
. If Router Mode
is set, Access Point won't transfer the packet to the wired LAN.
Quick Wake Up - Simply press one of the up, down, left, or right buttons to turn on the PC corresponding to that button. 4 PCs can be registered.
Microcontroller on board - No need for a PC when you turn on an another PC. Directly send packets to the target PCs.
Transmit a packet via WiFi - Wake on LAN packets are transmitted via Wireless Network.
Battery Powered - Using LiPo battery. It can run for a month (In the case, every day a few times used).
Small Handy Box - This box is only 60mm(W) x 23mm(H) x 80mm(D) size. No need any cables, it works.
Configurable - Setting parameters are set from the display menu. SSID/Password/Target PC Hardware Address(4 PCs)/Time Zone/Sleep Time/Sleep Mode/Display Off Time/Reset Settings
How to Use the BoxAt first, you can set the WiFi SSID and PSK-Password. To set them, push the Center Key, you can see the setting menu, then select the WiFi
using UP or Down Key, and click the Center Key. Then, select SSID
and enter your SSID of Wireless Access point using Up/Down/Left/Right key. After entering the SSID, push the center key, select yes
using Right key, then, push Center key. Similarly, set the PSK-Password. Next, setting Hardware Address(Ethernet MAC Address) of PC which you want to wake up. Select HW Address
and push Center Key, select from PC1
to PC4
, push Center key, then enter the your Hardware Address like 00:11:22:33:44:55
.
After setting, just push button corresponding the target.(Up Key : PC1, Down Key : PC2, Left Key: PC3, Right Key: PC4)
You can set the following parameters.
When Sleep Mode is Deep, the device will only recognize the Up and Down Buttons upon waking from Sleep Mode, and it will function the same as a RESET. In Light Mode, all five buttons are recognized.
To charge a battery, just connect to a USB Type-C port from the bus-powered USB port. During the charge, the CHG LED is RED ON. After the charging is full, the FUL LED is GREEN ON. And the charging will be stopped automatically.
I use ESP32-C3-WROOM-02-N4 as SoC and white OLED display SSD1306 is connected to the ESP32 via I2C. MCP73831 controls LiPo battery charging. IRF7606TRPBF prevents current from flowing back into the battery. Power from the USB The SPX3819M5-L is a 5V to 3.3V DC/DC conversion regulator. The USB connector is used as a Type-C (USB 2.0) and the CC1 and CC2 pins are dropped to the ground with a 5.1 Kohm resistor. Then 5V is supplied to VBUS. Each button is pulled up with 10KOhm and connected to the GPIO pin. GPIO3 is input with the power supply VOUT divided by 20Kohm to measure the battery voltage.
Initially, each button was input to each GPIO pin, with the following anti-chattering circuitry included. This circuit usually worked correctly, but there were times when the buttons would not return after sleep, and there was also a phenomenon that the ESP32 would restart by a reset. At first, I thought it was a SW problem, but when I removed this anti-chattering circuit and simply pulled it up, the return by button from sleep state worked stably.
GPIO0 and GPIO1 are connected to the crystal 32.7680KHz for RTC.
I can design the PCB layout with two layers in 40mm x 60mm size.
These parts were soldered by hands.
I wrote the code in Rust Language. In coding, the part where it goes to sleep and reconnecting WiFi after returning from sleep was difficult. Please refer details to in the GitHub repository.
unsafe {
// light sleep mode
if config_data.sleep_mode == SLEEP_MODE_LIGHT {
// gpio wakeup enable
esp_idf_sys::gpio_wakeup_enable(GPIO_WAKEUP_INT_PIN_4, esp_idf_sys::gpio_int_type_t_GPIO_INTR_LOW_LEVEL);
esp_idf_sys::gpio_wakeup_enable(GPIO_WAKEUP_INT_PIN_5, esp_idf_sys::gpio_int_type_t_GPIO_INTR_LOW_LEVEL);
esp_idf_sys::gpio_wakeup_enable(GPIO_WAKEUP_INT_PIN_6, esp_idf_sys::gpio_int_type_t_GPIO_INTR_LOW_LEVEL);
esp_idf_sys::gpio_wakeup_enable(GPIO_WAKEUP_INT_PIN_9, esp_idf_sys::gpio_int_type_t_GPIO_INTR_LOW_LEVEL);
esp_idf_sys::gpio_wakeup_enable(GPIO_WAKEUP_INT_PIN_10, esp_idf_sys::gpio_int_type_t_GPIO_INTR_LOW_LEVEL);
esp_idf_sys::esp_sleep_enable_gpio_wakeup();
// wakeup from rtc timer
// esp_idf_sys::esp_sleep_enable_timer_wakeup(config_data.wakeup_interval as u64 * 1000);
}
else {
info!("Deep Sleep Start");
esp_idf_sys::esp_deep_sleep_enable_gpio_wakeup(GPIO_WAKEUP_INT_PIN, esp_idf_sys::esp_deepsleep_gpio_wake_up_mode_t_ESP_GPIO_WAKEUP_GPIO_LOW);
esp_idf_sys::esp_deep_sleep_start();
}
// deep sleep mode (not here)
if config_data.sleep_mode == SLEEP_MODE_LIGHT {
let _result = esp_idf_sys::esp_light_sleep_start();
// gpio interrupt enable
esp_idf_sys::gpio_set_intr_type(GPIO_WAKEUP_INT_PIN_4, esp_idf_sys::gpio_int_type_t_GPIO_INTR_ANYEDGE);
esp_idf_sys::gpio_set_intr_type(GPIO_WAKEUP_INT_PIN_5, esp_idf_sys::gpio_int_type_t_GPIO_INTR_ANYEDGE);
esp_idf_sys::gpio_set_intr_type(GPIO_WAKEUP_INT_PIN_6, esp_idf_sys::gpio_int_type_t_GPIO_INTR_ANYEDGE);
esp_idf_sys::gpio_set_intr_type(GPIO_WAKEUP_INT_PIN_9, esp_idf_sys::gpio_int_type_t_GPIO_INTR_ANYEDGE);
esp_idf_sys::gpio_set_intr_type(GPIO_WAKEUP_INT_PIN_10, esp_idf_sys::gpio_int_type_t_GPIO_INTR_ANYEDGE);
continue;
}
}
}
After installing the code, the current consumption during Sleep was measured with a home-made logger. For more information about this logger, please click here.
The measurements showed that in Light Sleep mode, the current consumption was about 600uA, and Deep Sleep mode was about 400uA.
Since the OLED display is not controlled, the power consumption of the OLED display is higher than that of ESP32 alone.
When sending Wake On LAN packets, it operates at a maximum of 100mA, normally 25mA. This would allow for longer use on a single charge.
Voltage and current during battery charging. When charging, the current is negative because it is in the opposite direction.
Container Design
I designed a container by Fusion360. No screws are used, just fit the top surface.
Output from a 3D printer. Rounding the case prevents warping of the case during printing.
Set the battery at the bottom and place the PCB on top of it.
The Box is completed when the top cover is attached while placing the buttons.
This time, I wanted to minimize the battery current consumption as much as possible and execute it in one action, so I put it to sleep. It’s a board with a button, battery, and display on the ESP32, but it seems that it can be used for other purposes by changing the software. Next time, I’m thinking of making it as an IoT controller.
Comments
Please log in or sign up to comment.