Nice to meet you all, I'm new to Arduino... I'm currently developing a car park monitoring system. I hava a IRSensor (like Car Park Sensor) that will detect item within the slot, if the sensor detects a toy car in the slot, it means the slot is occupied/taken. My question is, if I wanted to connect this to a database and updates the database everytime the sensor detects changes (like change the slot status to '1' if there is a toy car detected in slot, and change the slot status to '0' if it is empty in the slot)
I'm using PHP, MySQL (WAMP server) currently.. I need to retrieve data from Arduino IR Sensor and Update MySQL database (WAMP). I need some Code guidance on how Arduino can update the MySQL database...Can anyone please provide me code sample if you have done similar project?? Please help..
Thanks, sorry for the english.
This is my database. Its very basic table that consist slot number and slot status (1 or 0).
CREATE TABLE seats
(
rowId varchar(1) not null,
columnId int not null,
status int,
updatedby varchar(10),
PRIMARY KEY (rowId,columnId)
);
A common approach is to let the WAMP server handle the database and have the arduino send the relevant data to it. You can use the ethernet library to make the arduino act as a client and either GET or POST information to the web server. There, a script in PHP, perl or your language of choice will parse out the data and push it to the database. Presumably there will also be a page on the server than displays the current state of the parking garage.
The Ethernet approach assumes that your Arduino has an Ethernet interface. They aren't expensive and that's certainly a feasible solution.
If your Arduino has a USB connection to the PC you also have the option of sending the updates to the database via the serial port. To do this you would need to write the data to the Arduino's serial port, and have an application on the PC receive it from the corresponding Arduino virtual serial port in the PC and write it to the database. If the PC is running Windows then you could use GoBetwino for the PC part.
This isn't significantly better than sending the data via HTTP, it's just an alternative you could consider. It would remove the need to create the web app to receive the data and corresponding HTTP client logic on the Arduino, but in exchange you'd need to learn how to set up Gobetwino (or whatever you use in its place) and get the command-line interface to MySQL working.
PeterH:
The Ethernet approach assumes that your Arduino has an Ethernet interface. They aren't expensive and that's certainly a feasible solution.
If your Arduino has a USB connection to the PC you also have the option of sending the updates to the database via the serial port. To do this you would need to write the data to the Arduino's serial port, and have an application on the PC receive it from the corresponding Arduino virtual serial port in the PC and write it to the database. If the PC is running Windows then you could use GoBetwino for the PC part.
This isn't significantly better than sending the data via HTTP, it's just an alternative you could consider. It would remove the need to create the web app to receive the data and corresponding HTTP client logic on the Arduino, but in exchange you'd need to learn how to set up Gobetwino (or whatever you use in its place) and get the command-line interface to MySQL working.
Yeah.. I am going to use Ethernet approach... but I need the Arduino and php code.. I need similar sample..