Communication between SD HTML webserver and arduino


I'm working on a project to control a relay with a timer programmer and other things through the ethernet shield of arduino.

To control all those things I've made an HTML webpage stored in an SD. I have to send the orders to the arduino server by clicking on different buttons. All those buttons send an XMLHTTPrequest using an AJAX script, which is uniqe for each button. The problem of doing this that way is that at the end of the day there are a lot of scripts and the requests take too many time to response since I click on the button, and of course it's impossible to click on different buttons quickly because it creates a queue and at the end it goes stuck or it doesn't send the requests.

I've been reading on the internet about that and I've found different posts saying that AJAX needs even more bandwith than reloading the webpage, because it sends the whole webpage each time it sends a request. So I've got a huge problem to continue my project, how to send requests to arduino from an HTML webpage in an SD? is there any way to do that without problems? Has anyone done it before?


Just send some GET parameters

e.g. http://your-arduino-address/index.html**?button=1**

This will still have the overhead of the browser sending the user agent junk, but it doesnt post or send any other data.

Thanks for responding!!

I understand what you said, but I don’t understand the structure of the code. For example, right now I’m trying with;


But it doesn’t work. Onclick is the action when I press the button, “Abrir” is only the name of the button in spanish, and “v=on” is the command I want to send to arduino. I think the code has to be after onclick but there’s something wrong. The adress on the network of arduino are 80 (port 80), and the main webpage is called as default “index.htm”. Don’t forget that I’m working with an HTML webpage stored in an SD, this is not in the Arduino code.


I would like to check with you if you finally found a way to solve your problem ?

I have a webpage hosted in the SD card, in which I added 2 buttons. I am trying to change the values of two variables, but I don't know how to proceed to detect a click on these button in my Arduino code.

The buttons in the web page need to trigger an HTTP request to the web server. There are lots of ways to do that in HTML - for example you could use hyperlinks, or include a form with some buttons in.

The Arduino needs to retrieve the URL path and parameters from the incoming request. Exactly how it does that will depend on how the request and related parameters are encoded in your HTTP request, which will be determined by your HTML page. There are lots of examples showing how to retrieve the request URL from the incoming request - almost every web server does this one way or another.