[Solved]Interfacing arduino to local MySql through USB

Hello.

I'm gonna start by saying that I'm kind of new to Arduino and MySql/PHP. I do know a few thing and I'm always trying to enlarge my knowledge. Anyway, here we go: I'm trying to get some data from a gas sensor with arduino. The gas sensor is the MQ9 Grove Gas sensor and the arduino i use is Arduino UNO. Everything works so far. I'm just reading data from arduino to my serial monitor.

int analogPin = A0;
int val = 0;

void setup()
{
  Serial.begin(9600); 
}

void loop()
{
  val = analogRead(analogPin);
  delay(1000); 
  Serial.println(val);
}

Now what I want to do is to store this data into my local MySQL database using the USB cable. On my computer I'm running Ubuntu 14.04 and I have installed LAMP-Server on it. Now the problem is I have no idea how to interface the arduino with MySQL DB. I've read a lot of posts about using the Ethernet shield on Arduino, but I can't really buy that at the time being. I've also read that in some way one could possibly get data from arduino and insert them into the DB only by using PHP but I never actually got to see how. Another possible option would be to write an application in c++ but then again, I know more about PHP and java rather than C++.

Is there anyone that could kindly provide me with some guidelines or tutorials or anything that could help me get this done? I would appreciate it a lot.

Thanks in advance,
costeabc.

Hi!

Check out this url http://www.instructables.com/id/Interface-Arduino-to-MySQL-using-Python/#step1
You can use serial communication to send data to the computer and then store it in the database.
It is easy with Python (check the URL).

/Olof

Thanks a lot man! I was hoping such thing would be possible. When I bought my arduino yesterday I actually bought a Raspberry Pi aswell. Right now I'm think of installing everything on my RPI. Thanks once again mate! ^^ Exactly what I needed.