Wake on LAN

An Arduino with an Ethernet shield can wake a remote computer by sending a WOL (Wake on LAN) message. SendWOLMagicPacket is a simple function to send the WOL magic packet. It draws on the Arduino Waker project.

The SendWOLMagicPacket function takes a single argument—a pointer to the MAC address of the remote machine as a 6 byte array:

Here’s the source for an Arduino to wake a remote machine:

Testing

The SendWOLMagicPacket function can be tested using the small harness below. After initializing the Ethernet port, it watches the Arduino’s serial port. Whenever the ‘w’ character is received, the test rig will send a wake command. The MAC address of the remote machine is defined in the global variable: g_TargetMacAddress

Finding the MAC address

To wake a remote computer, you needs the physical address, or MAC address of the machine’s network. You can find a computer’s MAC address using the ipconfig function. Open up a command window on the machine you’d like to wake remotely and type ipconfig /all at the prompt. Look for the line labelled Physical Address. That’s the MAC address you need to give to the Arduino to wake the computer, as a 6 byte array:

FindingMACAddress