How to Setup Wake-on-LAN (WOL) for LattePanda Series Boards

userHead LattePanda 2024-07-13 00:36:02 563 Views0 Replies

Hello LattePanda enthusiasts!

 

Today, we are excited to share with you a comprehensive guide on setting up Wake-on-LAN (WOL) for select models within the LattePanda series. WOL is an important feature for remotely powering on your devices, ideal for remote management and energy-saving purposes. Below, we detail the steps to enable this feature on your compatible LattePanda boards.

 

Here is the video link:  Wake-on-LAN (WOL) video tutorial

 

LattePanda Models with WOL Support:

ModelWOL Support
LattePanda V1×
LattePanda 2 Alpha
LattePanda 3 Delta
LattePanda Sigma
Lite Carrier for LattePanda Mu×
Full Function Evaluation Carrier for LattePanda Mu

Unfortunately, the original LattePanda V1 and Lite Carrier for LattePanda Mu do not support WOL.

 

Ⅰ.  Guide for Enabling WOL:

Now, we will take LattePanda Sigma as an example to show you how to setup step by step.

1️⃣  BIOS Setup

Firstly, you need to enable the WOL feature in the BIOS settings of your LattePanda board.

- Power on your LattePanda and immediately press the Del or ESC key to enter the BIOS interface. Find the Wake on Lan option and set it to Enabled.

Path: BIOS menu --> Advanced --> Power Management --> Wake on Lan

 

- Save your changes and exit the BIOS.

 

2️⃣Network Adapter Setup (Windows 10 Example)

Next, we will configure the network adapter settings:

- Right-click the Windows icon and select Device Manager.
- Find your network adapter under the Network adapters category. If you're using the LattePanda Sigma, you can open the Task Manager to check which network adapter is active.
- Double-click on the network adapter (e.g., Intel(R) Ethernet Controller I225-V #2) to open its properties window.
- In the Advanced tab, ensure that Wake on Magic Packet and Wake on Magic Packet from S5 are enabled.


- Move to the Power Management tab and check the Allow this device to wake the computer option.
- Lastly, disable the fast startup feature by searching for Choose a power plan in the system settings, clicking on Choose what the power buttons do, and turning off fast startup.

 

** Additional Step for LattePanda 3 Delta Users
For LattePanda 3 Delta users, in addition to the WOL setup:

You must enable PME in the Network Adapter settings to ensure the network card remains powered after the device is shut down.

 


3️⃣Record the MAC Address

Access the network connection details and note down the MAC address of your LattePanda board. You will need this for the remote wake-up.


Ⅱ . Network Wake-Up Procedure:

Wake LattePanda Using Python Script

On a separate computer within the same local network:


 

Use a simple Python script, inserting the previously recorded MAC address to remotely wake the LattePanda Sigma. See below:

import socket
import time
import struct
def wake_up(mac='xx-xx-xx-xx-xx-xx'):
  """
  Sends a Wake-on-LAN (WOL) magic packet to a specified MAC address within the local network.
  
  :param mac: The MAC address of the device to be woken up, formatted as 'XX-XX-XX-XX-XX-XX'.
  """
  BROADCAST_ADDRESS = "255.255.255.255"
  WOL_PORT = 7
  if len(mac) != 17:
      raise ValueError("MAC address must be in the form 'XX-XX-XX-XX-XX-XX' with 17 characters.")
  
  # Remove hyphens from MAC address and create the magic packet payload
  mac_address = mac.replace("-", '')
  data = 'FFFFFFFFFFFF' + mac_address * 16
  send_data = b''
  # Convert the payload into a byte array
  for i in range(0, len(data), 2):
      send_data += struct.pack('B', int(data[i: i + 2], 16))
  # Send the magic packet to the broadcast address via UDP
  try:
      with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
          sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
          for _ in range(3):  # Send the packet three times
              sock.sendto(send_data, (BROADCAST_ADDRESS, WOL_PORT))
              time.sleep(1)
      print(f"WOL magic packet sent to {mac}.")
  except Exception as e:
      print(f"Failed to send WOL packet: {e}")
# Example usage
wake_up()


Wrapping Up:

This tutorial covers how to use the WOL feature to wake up a LattePanda within a local network. If you intend to wake up a LattePanda from the internet, you'll need to configure advanced settings such as port forwarding on your router.

 

We hope you find this guide useful. If you have any questions, please leave a comment below.