I am working on a RFID-lector done with Arduino that already works. This device reads tags and gets a code, my intention is the next:
I want to a mySQL database which contains a table with all the codes from all the products, the name of the product and the price, so I want to access to this database everytime the Arduino connect to the PC(which contains the database) and update the variables from the code. My idea is to save tall in a matrice with the arrays of the codes, the prices and the name of the products, but I have no idea how to do that.
Can you give me any advise?
You probably need to develop an application (with serial port communication capability) for the pc to do your database work.
I also have no idea to do that :/
I understand that your Arduino uses some data and you want to download it from a PC.
Fetching the data from a database on a PC is relatively simple. You will need an application on the PC to read the data from the database on demand and send it to the Arduino in a format that the Arduino can accept. If your PC is running Windows then you can use Gobetwino for that.
You will need to store it somewhere on the Arduino. The sensible options would depend how much data you need to store, and the nature of the data. Do you know that information?
What I opted to do is obtain a pcDuino on which I put apache webserver and MySQL database server. My Arduino has a W5100 ethernet shield (today, I would have opted for the Arduino Yun).
One Uno acts as a 'concentrator' which collects data from various sources (a mixture of Pro Mini, Nano and home built 'minimalist Arduino breadboard' style) and forwards to the webserver. All the nodes talk to each other with nRF24L01+ modules.
The UNO's data is http POSTed to the pcDuino. All this is based on the inspired works of zoomkat, surfertim and maniacbug (among others) which can be found in the networking and home automation forums on this site.
The pcDuino is advantageous in that it's roughly the same size as an Arduino Mega 2560 and can be had for $60 or less (I lucked into a pair on eBay for $23 each). "UPS" power is nothing more than a 7Ah gel cell battery, also small and cheap.
I may eventually extend to incorporate ethernet data transfers from pcDuino to conventional webserver in the future for backup, archiving and access to the outside world.
I started out trying to cram everything into an Uno, ran out of room, then a mega 2560, ran out of room and so here I am with the above.
PeterH: If your PC is running Windows then you can use Gobetwino for that. You will need to store it somewhere on the Arduino. The sensible options would depend how much data you need to store, and the nature of the data. Do you know that information?
I don't know what option should I use on Gobetwino, us I think none fits correctly into my idea. What option would you choose? Thank you.
As i understand you want to have the relevant data(tagId, name, price) available offline from the pc and update the table on connection to the pc. This raises a number of questions. primarily how much data do you need to store on the arduino? The UNO has only 1kB EEPROM and that wouldn't last long so storing the table on a sd card would be a solution. The next question is how the table is stored on the card. I don't know much about the inner workings of sql but i suspect its not straightforward because of indexes and descriptions being stored in the same file as the table. But the table as describe it has a flat structure so you could export a csv file and store it on the sd card. That would get the job done i believe.
If you need to update the data you take out the card and put in a card reader connected to the pc and write a new version of the csv file. Or you write some code in processing to transfer the csv file over usb. If you are really ambitious you write a processing program that gets the data from mysql and writes it as a csv file to arduino