This is an Arduino project using and ethernet shield for remote control of a set of relays. The IPControl module was meant to be a simple web accessible device controller. It sort of grew! A little out of hand as you will see from the code.
Concept: Using an Arduino + Ethernet shield to control a set of relays via a Web interface.
Hardware: Originally designed on a UNO I found about ½ through the code that there were run time errors on the strings I using from the web server. I fought with this for a while but put it down to the way arduino code handles strings. I believe it got down to a heap size issue. Short answer - bigger processor needed.
It was move to a Mega 2560 and had no more issues. It uses a standard Ethernet shield, the DHT temperature sensor and a 2 relay shield.
I built this intending to use it to control the power to several remote devices over my wan. I used a 240v power control module connected to the relays for isolation (happened to have these on hand). If you wanted to control a 240v device an easy way would be to use an IR controlled power board. These are readily available and fairly cheap.
DO NOT connect 240v to the arduino relay shield!
Ports for the relay and DHT are declared at the start. You don’t have to accept where I put them.
I only needed two relays but there are plenty of ports free on a Mega so you could use as many as you want.
Libraries: The first 3 are standard to Arduino 1.0. I added the avr library for watchdog control and obviously the dht for the temp sensor.
Ethernet: It can use either DHCP or Static addressing. The default is DHCP but it will fall back to
192.168.2.10 rather than an apipa address (169. Etc.) should dhcp fail. The default web port is 80 but could be changed to any port you’d like. It WON’T support SSL so don’t use 443.
The name on the Web Title can be set as well as the names of the relays. Default is “Relay server” and “Relay 1”, “Relay 2”.
It uses 2 numerical passwords to allow relay control as well as settings menu. The relay control pass is 4 digit – default = 1234. The settings password is 6 digit – default = 123456.
Settings are stored in Eeprom. If no settings are present during boot it will perform an Initialise and make everything default.
It uses the watchdog timer to force a full processor reset when requested.
The commands issues by the web interface are fed back to the html request line and picked up on the next web server refresh.
The settings mode is held in a variable flag and this can only be set using the correct password. This was to prevent a replay of a html settings request.
Obviously it could be a lot better with SSL, SMTP (email alerts) etc. As it only lives in a private wan I left it pretty basic. Play with to your hearts content.