I found a lot of methods on the internet and I was wondering whats the best method to send data from sensors connected to Arduino to mysql database in wamp server continuously ?
closed as primarily opinion-based by jfpoilpret, Anonymous Penguin♦ May 23 '15 at 20:14Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||
|
There is no absolute "best" way, there is only the way that "works best for your situation". In a nutshell, the different methods that I can think of, and their pros and cons, are:
Quick to implement, light weight, but not very secure or robust. Perfectly fine for things like "send the temperature once a minute" etc, but crafting very long GET requests with lots of parameters can severely impact on both your RAM and your sanity.
Like the GET request it's fairly simple to implement, but needs more RAM since you need to know the size of the data you're sending first so you can send a
This is basically HTTP POST but with a specially XML formatted body. It has the advantage that it's a standard protocol for transferring data and commands around the place, so there are plenty of resources to help you. The main problem is crafting the XML at the Arduino side.
Connect to a special port to communicate with your own software. You define all of the protocol, but you have to write all (or most) of the software too. This can be more like a serial connection to your computer but through the network. Good for sending larger amounts of data, such as images from a camera, etc.
If you want to send lots of small values very frequently this is probably the best bet. Harder to implement than most of the others, but the light-weight nature of UDP means you can send data much more rapidly. Of course, with UDP, you run the risk of losing packets since it's very much a "fire and forget" protocol - you send a packet and hope it gets there. Fine if you don't mind missing the odd bit of data, say for higher speed temperature logging. Of course, you have to write the server side software yourself, but there's plenty of resources to help you with that online. So it's really not a case of "best" but "most suitable". Define what the data is and how often you want to send it, then think about how complex you are willing to get with your programming. Nine times out of ten a simple HTTP GET request fits the bill. |
|||||||||||||||||||||
|