Let's Make Robots!

A simple HTTP communication protocol between wifi and Arduino

How to let the sensed data (e.g., temperature) on the Arduino send to the remote server? 

The following code is used to realize this function.

void setup()




void loop()


   int n=analogRead(A0);

   float vol=n*(5.0/1023*100);





void upload_sensor(float vol) 

     // send the HTTP PUT request: 

     char buf[200];


     int ret;

     ret=sprintf(buf,"GET /upload.php?uid=demo&key=c514c91e4ed341f263e458d44b3bb0a7&sensor_name=arduino&data=");



     Serial.println(" HTTP/1.1");   

     Serial.println("Host: api.iot.fm");

     Serial.println("Connection: close");



more details, see: http://blog.smartarduino.com/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to upload the sensed temperature by LM35 to the remote server? This is a very usual problem. In this illustrative example,  by using TCP protocol based on Arduino platform, can let the sensed data upload to the remote server through wifi module.

Furthermore, we can control the data to send or not. Similarly, by using this TCP communication protocol, you can control the network-based electronic devices at anywhere through your phone or other network communication ways (e.g., wifi).

The code can be download from github: https://github.com/SmartArduino/IoT-System-on-OpenSource/tree/master/ArduinoTCP,

The complete blog: http://blog.smartarduino.com/

The experimental material: http://www.smartarduino.com/