Interfacing website with arduino

Status
Not open for further replies.

goldriver

Junior Member level 2
Joined
Dec 9, 2012
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,476
I am developing a project which requires me to design a website that can receive values from arduino microcontroller & log them in a data base. So far i have been successful in sending data to a my local IP address using ethernet shield. The next step requires me to develop a website,assign it an IP AND THEN receive sensor values from multiple microcontrollers and log them against user accounts in a database.

Please answer the following queries:

1.How to interface arduino with the ethernet shield in such a way that it sends data to an IP address which is outside its network?
2.How to write a script for the website such that it receives data from the controllers?
3.Should i use a dedicated server or utilize web hosting?

Replies from users with experience of arudino and ethernet shield are highly appreciated! . Web development folks are also requested to give their input.
 

Look at this site: data.sparkfun.com

It is a free site that you can send data to from an Arduino or similar uC, and browse the data there or download it as a CSV file. You can also host the software on your own server.
 

Remote Weather station or a Wireless Sensor Network : Create a sensor node capable of transferring sensor data (like from a weather station - temperature, humidity etc.) to a web server (like pachube.com).

It's just a example. If you want to more. Go to **broken link removed**


Code:
///send2Pachube()///
///this function is to send the sensor data to the pachube, you can see the new value in the pachube after execute this function///

void Send2Pachube()
{
mySerial.println("tcp\",\"api.cosm.com\",\"8081\"");//start up the connection
  delay(2000);
  ShowSerialData();
  String humidity = "1031";//these 4 line code are imitate the real sensor data, because the demo did't add other sensor, so using 4 string variable to replace.
  String moisture = "1242";//you can replace these four variable to the real sensor data in your project
  String temperature = "30";//
  String barometer = "60.56";//
  mySerial.print("{\"method\": \"put\",\"resource\": \"/feeds/42742/\",\"params\"");//here is the feed you apply from pachube
  delay(500);
  ShowSerialData();
  mySerial.print(": {},\"headers\": {\"X-PachubeApiKey\":");//in here, you should replace your pachubeapikey
  delay(500);
  ShowSerialData();
  mySerial.print(" \"_cXwr5LE8qW4a296O-cDwOUvfddFer5pGmaRigPsiO0");//pachubeapikey
  delay(500);
  ShowSerialData();
  mySerial.print("jEB9OjK-W6vej56j9ItaSlIac-hgbQjxExuveD95yc8BttXc");//pachubeapikey
  delay(500);
  ShowSerialData();
  mySerial.print("Z7_seZqLVjeCOmNbEXUva45t6FL8AxOcuNSsQS\"},\"body\":");
  delay(500);
  ShowSerialData();
  mySerial.print(" {\"version\": \"1.0.0\",\"datastreams\": ");
  delay(500);
  ShowSerialData();
  mySerial.println("[{\"id\": \"01\",\"current_value\": \"" + barometer + "\"},");
  delay(500);
  ShowSerialData();
  mySerial.println("{\"id\": \"02\",\"current_value\": \"" + humidity + "\"},");
  delay(500);
  ShowSerialData();
  mySerial.println("{\"id\": \"03\",\"current_value\": \"" + moisture + "\"},");
  delay(500);
  ShowSerialData();
  mySerial.println("{\"id\": \"04\",\"current_value\": \"" + temperature + "\"}]},\"token\": \"lee\"}");
 
 
  delay(500);
  ShowSerialData();
 
  mySerial.println((char)26);//sending
  delay(5000);//waitting for reply, important! the time is base on the condition of internet 
  mySerial.println();
  ShowSerialData();
}
 
void ShowSerialData()
{
  while(mySerial.available()!=0)
    Serial.write(mySerial.read());
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…