Pages: [1] 2   Go Down
Author Topic: Help: arduino php mysql (electronic toll booth)  (Read 1241 times)
0 Members and 1 Guest are viewing this topic.
Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i m building an electronic toll collection system based on arduino and rfid;i m done with rfid part of the project but i m stucked with the database part of it;i m searching for solutions since weeks but i m nt able to find feasible soltn for this prob;can somebody tell me how do i send unique 10 digit unique id of the rfid to a php code which then queries the mysql db...please help guys..
Logged

Maine
Offline Offline
Sr. Member
****
Karma: 10
Posts: 413
Caution: Explosives in use.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.w3schools.com/php/default.asp
and
http://www.w3schools.com/sql/default.asp
should help.

You use some kind of network interface card (either ethernet shield or a wifi shield) to connect the arduino to the network that the server is on.
Logged

"Anyone who isn't confused really doesn't understand the situation."

Electronic props for Airsoft, paintball, and laser tag -> www.nightscapetech.com

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12285
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


@nikpawar, please do not cross-post.
Logged

Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry for the cross post...
 i m  using ethernet sheild;thnks for the links but tell me how do i implement it in arduino sketch. i do have rough ideas like sending unique id using HTTP get/post method or like using php serial class for reading serial data..but i need one successful example to know how it works lyk.i simply want to send unique id of rfid tag to php script..after tht i cn manage things
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24298
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please can you stop using colloquial abbreviations and start using the shift key?
It makes reading your posts very hard to to those who don't understand your dialect.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Exactly which part are you stuck with? At first it sounded like you needed help with databases but then you mention being stuck implementing it with the arduino. What have you tired so far?
Logged


Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Till now i have interfaced the RFID reader with the Arduino;now i want to pass the 10 digit unique ID read by the RFID reader to the PHP script which will then deduct the toll fee from the mysql database.i want to some how pass the unique id from arduino to php script which is stored on the local web server.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 48
Posts: 3393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a function I use to send temperature data to a web server:
Code:
void  SendTempToServer()
{ // Use a GET to pass the temp we received to Natasha
char GetRequest[80];
if (client.connect(server, 80))
  {
  sprintf(GetRequest,"GET /cgi-bin/Arduino.cgi?Reading=%s&arduino_id=23&sensor_id=1",Temperature);
  //Serial.println(GetRequest);
  client.println(GetRequest);
  client.println();
  }
}
Something similar should be what you need.
Logged

Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thanks for the reply...i'll try to implement it in my project.
Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 15
Posts: 345
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a couple of links that may be useful to you. They deal with reading serial ports with PHP. Once you can get PHP to read the data storing it is easy. PHP and mysql get along nicely. Can we assume your server is just a LAMP box?

http://code.google.com/p/php-serial/

http://stackoverflow.com/questions/11628002/php-read-data-from-serial-port-on-linux
Logged

Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you very much for the links..unfortunately i m using windows and my server is apache(part of XAMPP package)..still i'll try to use your reference if it works.thanks again..
once i am done with my project i'll post it to community..i am finding many people with the similar problem.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 48
Posts: 3393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Per your request, the whole thing is attached. The code is for an arduino ethernet with an Xbee. It receives temperature data from another arduino and then sends it to a web server. Obviously, you can drop the xBee stuff and put in your own temp reading. The original version just used wifi and the sensing arduino sent the temps direct but it didn't work in the target location because the wifi signal was too weak.


* Greenhouse.ino (2.13 KB - downloaded 10 times.)
Logged

Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you very much for the code.
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 29
Posts: 2239
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is wrong and will cause a 400 error:
Code:
client.print("GET try.php?code=");
Should be:
Code:
client.print("GET /try.php?code=");

Also, suggest you use HTTP/1.0 instead of HTTP/1.1. The latter will cause a "keepalive" request and does not close the connection after the request is complete.
Logged

Mumbai
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have made changes which u have suggested but still its not working smiley-sleep
Logged

Pages: [1] 2   Go Up
Jump to: