sending data to webserver

Hello Everyone. As my first project, I am planning to send arduino dht11 sensor data to local web server that is running on my pc (for now). I researched what is required in term of hardware and technologies. I undesrtand that my arduino is going to act as client and push data sending most likely post request to webserver with data. I am planning to display real-time temperature on my website and I am only confused about the following. Should the data from the sensor stored in mysql database first or it should read data to xml? I was trying to find some information on instructable how people approach similar things http://www.instructables.com/id/PART-1-Send-Arduino-data-to-the-Web-PHP-MySQL-D3js/ in that example, that person is storing data in mysql databases so it can be proccess using D3.js to display it using sort of graphs showing past reading. What i am trying to achieve is just display real time temperature by using AJAX to automatically refresh the content. Yet i am conused how data should be exactly stored or proccesed in order to achieve what i want.

I've got a couple of ethernet capable arduinos with temperature sensors that send their data to a web page using a GET request. The data is stored in a Mysql database and serves up some gauges and historical graphs. It sounds rather like the instructable you mention.

If you only want to display the current temperature though, there seems little point in putting it in a database. Store it in a file and let your PHP/perl/whatever driven page grab it from there.

Just be aware that as soon as you have it working, you'll start thinking of improvements and extra features you'd like. Some of them will probably require that you have kept your history ;)

Thank you for your reply. Yes you are right first I want to display just current temp & humidity. When yoy say file do you refer to xml format perhaps?

Could be XML if you like. Personally, I'd just store the data in a simpler format - Json, csv, whatever you find easy to parse.

Thank you for your time and advices. I will be looking for a way to store it in one of those formats

Hi @MasterPrzemo.. can you help me .. I read the Part 1 of this project on instructables. But iam cant find the Part 2 of it . please share with me the link if you have ,, Thanks ..

Regards

Saim Siddiqui

Possibly another idea would be to send the senor data to thingspeak and create a web page to pull the sensor data from thingspeak and display in a web page.
I created a web page(HTML/JavaScript), to select from multiple sensors and display the sensor selected. I’m only pulling the last sensor data stored on thingspeak, but offhand, I’m not sure how much data thingspeak stores for you over time.

I did create a Android app to do this as well, but the web page approach is easier and still works with future phone upgrades.

Hi,

I have tried sending an arduino data to a web server following the steps given in instructables. But I cant send the data to the database. There is no pblm in the database. But I have a doubt in my code. Kindly give some suggestions. PFB my code.

if(client.connect("www.xyz.com",80)) { //Serial.println("CM is" + cm); Serial.println("SUCCESS"); client.print("GET /add.php?range=99");

client.println("HTTP/1.1"); client.println("Host: www.xyz.com"); client.println("Content-Type: application/x-www-form-urlencoded"); client.println("Client.length: "); // client.println("Connection: close"); client.println(); }

HELP HELP, i cannot find why my code wont send my ds18b20 data to my thingspeak account, please!!!
#include <Wire.h>
#include <UnoWiFiDevEd.h>

#define CONNECTOR “rest”
#define SERVER_ADDR “api.thingspeak.com

#define APIKEY_THINGSPEAK “S5LQMQ9L1YQ5CMCB” //Insert your API Key
//
// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
/
/
// Data wire is plugged into digital pin 2 on the Arduino
#define ONE_WIRE_BUS 2
//
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/
/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature DS18B20(&oneWire);
//
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println(“Dallas Temperature IC Control Library Demo”);
// Start up the library
DS18B20.begin();
}
void loop(void)
{
/
/
Serial.print(" Requesting temperatures…");
Serial.println(“DONE”);
//Read value from Analog Input Pin 0

char s_buffer[2];
DS18B20.requestTemperatures();
float temp = DS18B20.getTempCByIndex(0);
String tempC = dtostrf(temp, 0, 0, s_buffer);//handled in sendTemp()

Serial.print("Temperature is: ");
Serial.println(tempC);

String uri = “api.thingspeak.com/update?api_key=”;
uri += APIKEY_THINGSPEAK;
uri += “&field4=”;
uri += String(tempC);
Serial.print(uri);

Ciao.println(“Send data to ThingSpeak Channel”);

CiaoData data = Ciao.write(CONNECTOR, SERVER_ADDR, uri);

if (!data.isEmpty()){
Ciao.println( "State: Sending… " + String (data.get(1)) );
Ciao.println( “Response: sent…” + String (data.get(2)) );
}
else{
Ciao.println(“Unable to send”);
}

delay(30000);//Wait 5 seconds before accessing sensor again.

}