I've done (or at least tried) to do some research and understand how to connect several arduinos to a webserver.
I plan to do a home automation project which involves the use of several standalone esp8266 modules to communicated with a webserver in order to turn lights on or off and have data sent from sensors.
What I don't understand is how to connect these to the webserver itself. Would I connect them to a website in the webserver as clients in order to send and receive data? Or would I send all the data to an sql database, including those that are to be send to the Arduino and displayed on a website, and simply read the database from an Arduino through a php request?
Thanks.
What I don't understand is how to connect these to the webserver itself.
A client asks for information, and does something with the response.
A server responds to requests for information. Often the request includes information that causes a server to do something.
A server can not push data to a client. A client can push data to a server.
I can't see how a home-automation device can be useful if it is not a server.
I can't see how a home-automation device can be useful if it is not a server.
I can. I also do it. I use an Arduino as a client to connect to a LAMP server. The server acts as a relay between clients. It does require familiarity with PHP and SQL databases though, and it is not "real time". There is a delay between the server receiving data from a client, and sending it to another client. This is not for the beginner.
and it is not "real time".
That's what most people are looking for. "Turn the lights on" generally means "NOW!", not later, when it is the scheduled time to check again.
Can I not just poll the server with get requests and make the changes accordingly in the Arduino? Is that what you were doing SurferTim?
Can I not just poll the server with get requests and make the changes accordingly in the Arduino? Is that what you were doing SurferTim?
You can. The question is how often to poll. Too frequently wastes bandwidth. Not frequently enough means that changes on the server side are not see as they happen.