An Ethernet Relay Controller

As a recent project, I designed a cool relay controller that uses a state machine to control a set of relay outputs based on a user defined program.  The initial task is to operate a set of Christmas lights at Christmas time, but there is nothing stopping me using it for anything I like later on.

The device is configured via a web browser.  I had a lot of fun fitting the web pages into the AtMega368 chip that this device uses.  There is much I can learn about stack frames on tiny devices 🙂

The project is published as an instructable, at

I will put full design files up here once I get my head around WordPress.

My Relay controller that uses an Ethernet interface

You May Also Like

About the Author: Doug


  1. Excellent project – saw this on instructables.
    I can see the webpages would take up a lot of code/data space. Is the next stage to add a small flash drive?

    TNX also for turning up the DIP Packaged Ethernet controller – so much now is SMD and difficult to solder, and I can obtain this locally for around US$3.60

    Mike Yancey
    Dallas, Texas USA

  2. Having now built a couple of projects that used the ENC28J60 with the AtMegs328, the big issue is actually string storage in RAM – The ATMega only has 2K of ram space, and once you start to do anything with strings, that gets exhausted rather quickly. The watering system controller has tons of flash left (I only used 16K of the 32K available), but adding functionality was tricky, as I kept running out of stack space as my strings were getting too big.

    I am not intending to add a flash drive, as this project is only really for simple embedded systems.

    I also understand about the SMD devices being tricky to solder – All I can say is to practice on some simple SMD projects. It is a really useful skill. I have even started repairing SMD based handhelds with an amazing degree of success.

  3. Very interested project.
    J wont meke this controler and j wont hex file.
    Can somebody send me this file.
    J’m sorry my eanglish.

  4. I have taken the AVR-ENC28J60 way beyond this using at present a M644P but will be going to a M1284P (has 16K of RAM) My project has dynamic pages, EEPROM storage of IP, MAC ect you can change everthing via web or serial command line and much more. Its not an Arduino project it is writen in Bascom from MCSelectronics, code is posted on their forum free for all to use and I or others could supply the HEX code if wanted still a work in progress but already has a lot of usefull code.

  5. Also forgot to mention the language can be changed by changing the words in an included file of constants then re-compile using Bascom

  6. Just to answer KM5Zs comments about web pages taking space. With dynamic pages I only have about 4K used by the pages and I have over 20 pages being displayed. You should be able to impliment it in your server Doug regards Paul..

  7. Thanks for that – in reflection (This is an old project) the biggest hastle was that the library I used was not happy about sending data that took multiple packets, so i was limited in responses to a single packet. When I pick this up to update it one day, I will need to re-visit the library to fix that limitation.

  8. I am using only one packet! I am using Iframes to display multiple pages. Have ping, udp, arp, tcp, simple time protocol. The only thing is ram use means the larger AVRs are needed. One great thing about Bascom is you can have local variables in sub routines, that frees that ram after the sub has been exited.

Comments are closed.