A Remotely Programable Relay Controller (Christmas Lights or Home Automation Controller)


Step 4: The Software

Here is the .pde sketch file.

Just download this sketch and load it into your AtMega328 chip and you are off and running!

The code has almost exhausted the RAM capacity of the ATMega328 - if you decide to make any changes, you will need to be very careful not to let the buffers corrupt the stack space.

All of the code is commented - and should be able to be followed.

An update from 4 years after the project was made:

Ahh - It looks like the original site that held the ethershield library has dissipated into the ether, and the arduino IDE has changed a lot. (I wish that they would not change the IDE that much to break the older code)..

There are two alternatives:

https://github.com/jcw/ethercard - it looks like it is supported for Arduino 1.0

https://github.com/thiseldo/EtherShield - it looks unsupported, but at least its there :-)

I can not comment right now on either of these libraries as I have not used them.


xp_sm1 year ago

Please help me

I have this error like below when compiling the code:

Error: D:\cvavr2\inc\pgmspace.h(90), included from: ip_arp_udp_tcp.h: incomplete type is not allowed ---<ypedef void prog_void PROGMEM;>

axe5123 years ago
Please help me, where can I find: etherShield.h ?

I have this error like below when compiling the code:


error: 'Time' does not name a type In function 'void do_zone_selection_ACT_GOVT()':
In function 'void setup()':
In function 'void loop()':
In function 'uint16_t print_time_page(uint8_t*)':

Please advise.

sv1elf3 years ago
I have a New Arduino Uno - R3 board .
Can i program with this board the atmega IC?
Is it possible to add a port like ' 7000 ' in case i want forward the ip- port to router?
drj113 (author)  sv1elf3 years ago
The UNO should be able to program an Atmega328 for you - as long as your UNO has the Atmega chip socketed.

As far as changing ports, the ethernet library that I used is very limited - it can only allow ports from 1 - 255 (8 bits). It is able to be changed in software though.

Please do not use the project over an external ethernet connection without some extra security. THE LIBRARY USES QUITE A FEW SHORTCUTS THAT ARE VERY INSECURE AND OPEN TO HACKING. Even if you add a login screen, then there is no guarantee that you can mahe it unhackable :-)
crorat4 years ago
realy good project, i have prroblem finding atmega in my countri could you please tell me is anyone of this useble, thanks

va2phl4 years ago
Super !

I upload this code and it works really fine. Will be able to use it on the lan and on the wan side.
Darksead4 years ago
Now I can start making a board for this project. I searched for project like this in russian sites but a couldn’t find. This site and your project help me!
Darksead4 years ago
I’m Russian student, so I don’t speak English very good! This project is so interesting, but I have sum trouble:
1) What kind of compiles you have used?
2) Can you give me .hex file for Atmega88, that I can load into my processor?
drj113 (author)  Darksead4 years ago
Thats never a problem - you already speak enough English for us to communicate!

1) I use the Arduino compiler which is built into the IDE.
2) There is no .hex file. The IDE programs the AtMega168 for me.....

Have a look at the Arduino - the micro in this project looks like that!

rod27cn4 years ago
Hi drj113,

I got the files now there is no error, thanks for your help!
rod27cn4 years ago

Please help me, where can I find: etherShield.h ?

I have this error like below when compiling the code:
25: error: etherShield.h: No such file or directory In function 'void setup()':

Please advise.

drj113 (author)  rod27cn4 years ago
You will need the Ethershield library from Nuelectronics.com

Here is the link..