Go Down

Topic: Arduino, ENC28J60, XAMP, PHP, Controlling 2 LEDS (Read 2864 times) previous topic - next topic


I've been playing with the ENC28J60 for a few months and even thought it isn't as easy to work with as the official EtherShield it is still a great (really cheap) bit of kit)
One of my goals was to control the Arduino Pins from a web page.  Kind of home automation type scenario.
This is the first step in that direction.

I have a XAMP web server installed on my netbook with delivers a PHP web page to the browser.
The web page gives me the options to turn on or off 2 LEDs on pins 2 and 4 of the Arduino.
When I press a button the web page is called again and in the background the web server does an fopen() call to the Arduino with the requested action.
By using fopen() the actual command sent to the Arduino is not seen by the user.

The below video shows it working and in the description on Youtube there is a link to my blog with further details and the code for the web server and the Arduino.

All feedback appreciated.




Would it be possible to make the 2 buttons show the status of the LED? (for example, if the LED is ON, the ON button should be dimmed)


Would it be possible to make the 2 buttons show the status of the LED? (for example, if the LED is ON, the ON button should be dimmed)

Yes, next stage is to use a database to store details of arduinos and pins.
Once that is done I'll be adding the ability to get the status of the pins during the request so it can be shown.

The ultimate idea is to create a web interface for controlling an unlimited number of Arduinos over ethernet so a little bit to go.


I got a bit of time to play with this again.
Now the webserver code calls the details from a mySQL database for each Arduino and then for each pin being used in each Arduino.
This effectively allows you to control as many pins as you want on any number of Arduinos , only limited by your IP addresses and patience to enter them all in.

Updated blog post with the details of the database and the revised PHP code.
WARNING: The PHP code is very much first pass. There are lots of areas it could be improved. But while I'm working on it, it makes sense to me.


Next step is to code a few pages to allow the adding/removing of Arduino and Pins without having to resort to mySqlAdmin.  Once done I need to figure out how to get the status of the pins from the webserver running on the Arduino. The examples I have seen for the ENC28J60 have been presenting a PROGMEM page, so cannot be modified once the code has started.

All the fun...

Go Up