-1

I want detailed step by step process and code of how to integrate temperature sensor, pressure sensor, humidity sensor included with time stamp into a single table in a database. I want these values into the MySQL database every 15 minutes.

halfer
  • 19,824
  • 17
  • 99
  • 186
arjun ds
  • 38
  • 6
  • And how are you planing to get these sensor data? – Nepal12 Jan 06 '15 at 10:52
  • using arduino temperature sensor you can bring in temperature value to data base as a single table.. but i do not know how to integrate more then two sensor values into a single database.. – arjun ds Jan 06 '15 at 11:12
  • i am very new.. this is my first project.. if you have any idea it would be very helpful :) – arjun ds Jan 06 '15 at 11:19
  • In the mean time can you get / are you getting the other sensors value. I mean do you have a method to get temperature, pressure, humidity? – Nepal12 Jan 06 '15 at 11:19
  • all i till know is you have to write a code in the temperature board to convert analog value to voltage from that to temperature value.. you have to define a schema in the database which as the primary key and time stamp.. from that we have to import into python and using for loop 15 mins once we have to retrieve the data.. – arjun ds Jan 06 '15 at 11:36
  • i do not know how to integrate multiple senors and bring those data into a database at a time – arjun ds Jan 06 '15 at 11:37
  • if you know any other approach you can inform me?? if you have worked on any multiple sensor data into mysql database?? any kind of reference source code would be helpful :) – arjun ds Jan 06 '15 at 11:38
  • If you see my answer, I am actually doing the same to save multiple sensor value in the database. – Nepal12 Jan 06 '15 at 11:40
  • 1
    Hi arjun. As interesting as this question is, note that any post that begins "I want a detailed step by step ..." is too broad for Stack Overflow. We tend to ask what has already been done to solve the problem too. For your next question, please break the problem down into pieces and try at least some of them - this usually involves research using a search engine. – halfer Jan 06 '15 at 11:44

1 Answers1

0

Here is the tutorial See here. Moving further, you need to have tables like this,

//
CREATE TABLE `your_database`.`tempmoi` (
`id` INT( 255 ) NOT NULL AUTO_INCREMENT ,
`temperature` VARCHAR( 255 ) NOT NULL ,
`pressure` VARCHAR( 255 ) NOT NULL ,
`humidity` VARCHAR( 255 ) NOT NULL ,
`timestamp` VARCHAR( 255 ) NOT NULL ,
`moi1` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;

Moving further, You have to see Step 6: Codes for the arduino in the link above. It is basically capturing the sensor data and appending it to your website as client.print( "GET /add.php?"); client.print("tempt1="); so that your URL becomes something like www.xyxy.com/add.php?tempt1=40, now on this url www.xyxy.com/add.php?tempt1=40 (on add.php) you can use get method to get the temperature.

Now here is the main answer to your problem. Implement more method inside the function/library given in Step 6: Codes for the arduino and extend the code inside void loop(). Do something like this client.print("&&"); client.print("pressure"); client.print( pressure value ); // pressure value variable will have the pressure value from your inplementation.

So your final url will be something like http://www.xyxy.com/add.php?tempt1= temp_value&&pressure= pressure_value&& ..... other values in same format.

Now in add.php you have, to capture the values from get method like $temp = $_GET['tempt1'], and you can use this to insert in mysql . But please do not use mysql_query, instead use prepared statement. see here see this

Community
  • 1
  • 1
Nepal12
  • 583
  • 1
  • 12
  • 29
  • srry hd too log off yesterday :/ ya i do accept it :) thank u :) this is my email id.. arjunds288@gmail.com could u drop in a mail frm ur side.. so tht if i have any doubts i would be able to ask u :) thank u :) – arjun ds Jan 07 '15 at 12:34
  • you have to accept it by clicking on the tick mark above on left hand side of my answer. see this image : http://i.stack.imgur.com/LuhId.png – Nepal12 Jan 07 '15 at 12:50