Wake On LAN enabled button

Sometimes you have the need for a device that “just works”. This time we were in need of a small embedded device that could power on a computer over a LAN cable.

Luckily there is already a well established standard called Wake On Lan.

This standard works by sending a “magic packet” over the network. When the network card in the target computer recognizes this packet, it powers on the machine. I could not find a small unit that could send this magic packet without the need of a full blown computer (or a board such as Raspberry Pi). We just want a simple button that could send a magic packet and therefore we made one ourself.

Luckily we had a iMCU7200EVB development board from WIZNet laying around. This board have an “iMCU” called W7200. It’s simply an W5200 TCP/IP Ethernet controller chip and a STM32F103 MCU in the same physical package. Unfortunately the W7200 is now obsolete. But since this is based on the W5200 chip and Cortex M3, this should be possible to port to other MCUs.


Block diagram of W7200
Block diagram of W720


In addition to the development board, the only other hardware needed is casing, button and a power connector. All of the parts were of course old stuff that we had laying around (discovered here). As a result of that does the casing looks pretty retro!

WOL Button and indicator LED
WOL Button and indicator LED
Backside with Ethernet jack and power connector
Backside with Ethernet jack and power connector
iMCU7200 development board powers this thing
iMCU7200 development board powers this thing
Inside of the button box
Inside of the button


Firmware wise the code is a modified version of an app note WIZNet originally made.

Their implementation of Wake On LAN were partially wrong :/ Their implementation did only send 6 bytes with the value 255, followed by sixteen repetitions of the target MAC address.

This is correct according to the minimal Wake On LAN specification, but in our experience some computers need a magic packet with a complete Ether frame structure with correct EtherType set (this is 0x0842 for Wake On LAN).

Our implemented packet structure

Destination MAC + Source MAC + EtherType + Magic Packet Frame (6 bytes of 255 followed by 16 repetitions of destination MAC)  + CRC

Actually we skipped the CRC calculation… Since the packet is decoded in HW (in the Ethernet card) we thought that if the Ethernet processor have matched the ether frame and the 16 repetitions it does not care about the CRC.

And as we thought this seems to be correct, at least on all of our computers that we have available here. And if we suddenly are going to use the button with a computer that does need the CRC it’s easy to add this at a later point.

We also made the firmware to only send packets when the button is pressed. Further we implemented sleep mode when the MCU does not send any packets, resulting in a power saving sleep mode for most of the time 🙂

Just for illustrative purposes, here is a code snippet of the code that enters sleep mode after the module has sent the magic packet:

SysTick->CTRL  &= ~SysTick_CTRL_TICKINT_Msk;        // systick IRQ off
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
SysTick->CTRL  |= SysTick_CTRL_TICKINT_Msk;            // systick IRQ on

Because this were only a “one night”-project, the firmware is not that pretty. Therefore we will not give out the complete code (code quality check failed…:P), but if you are interested in making your own we will gladly send you the code if you contact us!

Related Posts