Microcontroller and Database

Thread Starter

Lyncheese

Joined Jun 28, 2014
22
Hello,

I have some questions I wanna know, since I don't know well about database stuffs.

So, I have two cases I want to ask... and hopefully some of you who had experience about this will share your opinion/idea here.

1. I want know how to save a data in microcontroller and retrieve it everyday to save it to my computer.... For example, my data saving stuff like how many people go through the door and etc.

2. The cases above is for a stand alone system.... Now what if I have a PC, too ? How to save my data to my database ? So, I don't need to go and retrieve it everytime when the memory is nearly full...

These are my question....
Any suggestion/ideas/opinions will be appreciated.

Thank you before.


Warm regards.

NB: I know nothing about database stuff. So, please not an advance method. Thank you.
 

mcgyvr

Joined Oct 15, 2009
5,394
There are lots of different ways depending on what hardware/micro you have..
Many times you can write data directly to a sql or other database.
Or maybe you want to write the data to an SD card then pull data from that,etc..

Which microcontroller are you using?

here is some stuff for arduino
http://drcharlesbell.blogspot.com/2013/04/introducing-mysql-connectorarduino_6.html
http://playground.arduino.cc/Code/DatabaseLibrary
http://www.instructables.com/id/Interface-Arduino-to-MySQL-using-Python/
https://www.temboo.com/arduino/yun/mysql

There are even online services that let you store/graph data,etc..

There are ..SO...SO many options.. You just need to start googling and find out what works for your application...
 

MrChips

Joined Oct 2, 2009
34,814
There are some obvious ways to save and transfer your data to a PC:

  • save the data to memory card or stick
  • wired to the PC via RS-232, RS-485, LAN,TCP/IP
  • wireless via, irDA, Bluetooth, Zigbee, RF modem, WiFi
 

Thread Starter

Lyncheese

Joined Jun 28, 2014
22
Wow.... Thank you very much for the answer and references....

Well, I just wondering about it....

So, I haven't decided yet what Micro I'll use....

I used to use AT89S52....
But maybe, this time I'll try ATmega... or even ATtiny if it's possible....

Any suggestion will be appreciated.... I just want it to read one or two sensor data and keep it as a log for future uses...

Beside SD card.... Could I just plug my usb cable and retrieve the data, instead of plug and unplug the SD card in some way???
 

shteii01

Joined Feb 19, 2010
4,644
Beside SD card.... Could I just plug my usb cable and retrieve the data, instead of plug and unplug the SD card in some way???
Depends on data. uC has very very very limited amount of memory to store "stuff". Because the amount of memory is so limited, it is used for programming so that uC can perform variety of tasks. And the data is stored on some external storage device interfaced with the uC.
So.
If your programming is really small, and your data is really small, then at least in theory you could store some or most of it on uC.

You could hook up uC to computer with USB (and other ways). uC gets reading from sensor, sends it to computer using USB (or something else), computer stores the data. Here is issues:
* computers are bulky (even laptops) when compared to sd card or usb stick
* computers need power, do you have outlet near by
* computer has to be On all the time
As far as using computers for data storage, I would suggest something like net top laptop, Asus EEpc, Acer One?, I think MSI had one too. They are small, relatively low power, have usb, can run office application so you can see/work with your collected data, have screen, have relatively large storage. You can likely get a used one, there is no need to pay top dollar for new.
 
Last edited:

shteii01

Joined Feb 19, 2010
4,644
You can use any mircocontroller, preferably one that has a UART module. Then buy a TTL to USB interface cable and connect to your PC. Or you can add your own Silicon Labs CP2102 USB bridge.

Here is one example:

http://www.dx.com/p/usb-to-uart-5-pin-cp2102-module-serial-converter-81872
PIC with USB. They have two varieties now, one that uses external crystal/oscillator and one that does not.

On the 8051 type, I have not seen one in DIP package that has USB. But I saw other packages that have USB and OP could buy little pcb adapter board. ATmel (and a couple of others) has the 8051 type chips that have USB, but if you do prototyping on breadboard, then will need the adapter.
 

djsfantasi

Joined Apr 11, 2010
9,237
If you have a little room for more code, write all your data to an SD card. When the program detects that a USB cable is attached, it sends all the data from the SD card and starts a new file. Or have an external program request the data and your program intercepts the requests and sends the data, etc...
 
Last edited:

Thread Starter

Lyncheese

Joined Jun 28, 2014
22
Thank you for the suggestion/ideas from all of you until now...

I really appreciated it.

When, I have any problem I can't solve I will ask for your opinions here in the future.

Thank you very much once again.
 
Top