Aurduino and Ethernet module ENC28J60 or WEB control relay (Arduino webserver)

Once I made control of GPIO outputs on Raspberry Pi. This control of was carried out through the web interface by setting a web server on raspberry pi and application framework webiopi. At that time I did control of 4 relay module over the internet (everything is still to be published).

So I’ve decided to make something similar using Arduino. With the Raspberry Pi there were no problems. This is not surprising: full ethernet interface + full multitasking OS. And what about the Arduino? It’s simple, use ethernet module ENC28J60.

Therefore made the following:

1) Arduino and Ethernet module are connected in this way:

VCC - 3.3V Arduino
GND - GND Arduino
SCK - Pin 13 Arduino
SO - Pin 12 Arduino
SI - Pin 11 Arduino
CS - Pin 10 Arduino

2) Downloaded required libraries here or here

3) The relay is connected to the Arduino so:

VCC - 5V Arduino
In1 - Pin 2 Arduino
In2 - Pin 3 Arduino
In3 - Pin 4 Arduino
In4 - Pin 5 Arduino
GND - GND Arduino

4) Slightly altered under my needs sketch: HERE
The program is well commented, so here I will not explain how it works.

5) Module ENC28J60 connected to my router via ethernet cable. My arduino automatically assigned IP address 192.168.0.106. We can access Arduino by entering this IP address in the browser. There we can see the Web page from which it is possible to manage relays 😉

We have reviewed the way of web-based relay control using the Arduino and Ethernet module.

10 thoughts on “Aurduino and Ethernet module ENC28J60 or WEB control relay (Arduino webserver)”

  1. first of all…..thankyou so much for your arduino webserver sketch,i looking for it a lot last two week and not work or not suitable for me,until your sketch show in the search result,
    i want to ask how can i change the font size show in the webpage server,too small when i connect with cell phone,
    and the following problem ………………….// ?????, ??? ?????? ????? ?? Web ????????, ??? ?????? ???????? ???????? ??????.

    thanks again

  2. Hi,
    nice job, was searching a long time for an webinterface with eth and relay for the nano. But i got a problem. When i start the nano, the pin 9 is set to high, so the relay is on. How can i change it to low on start? And is it possible to start without an password and maybe to add some more relay?

    Thanks

  3. Hi,

    I have tried this code, but no matter what I do, I don’t seem to be able to get Relay 1 to switch on and off. The other relays all work.

    Thanks

    1. Hey.
      If you managed to do all three functional relays can you send a complete project archive?
      It would be good and some photos or a sketch of connecting and make some explanations on how the server or only interrogate Rooter?
      Thank you very much and I hope I have this beautiful project and I definitely want to add 8 relay functional.
      I share with you when I was able to make 8 relays functional but here it is clear because I do not speak English and are unable to understand the connection basket and the lack diagram.
      But congratulations creator that’s a great thing.
      My Email publicitate_uk@yahoo.com
      plizz

  4. Thank you very much for your code which allowed me to begin a EthernetRelay.

    I made a version of your optimized code (definition of the relay number at first, traces of debug, bigger font,etc)

  5. i want use this code to control my garage gate
    but my garage driver need just a 1 impulse,
    so its possible to change ON/OFF button to button which change state for a while?

  6. hi dude.
    This code working first code for enc28j60!!!!!!!!!!!!!!!!!! very very thanks!

    And,
    can u send 4 relay + dht11 and MQ2 sensors code.

    thanks dude.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.