I am focusing on project where I personally use an Arduino having a Bluetooth module and my mobile phone Samsung Galaxy S II with Android Operating System. The thought of the project would be to send some instructions from the mobile phone towards the Arduino via Bluetooth. I wish to incorporate a database in to the Arduino to ensure that after i send login information from the mobile phone, the Arduino will look into the database and when the login information matches, it retrieves some data in the database and transmits it to my mobile phone.
How do i store a database within the Arduino? Must I purchase an exterior EEPROM or RAM? And just how can one cope with that database (adding, removing and adjusting data)?
My Ardunio is of type UNO, BTW.
Only for simple login you do not need a database, you most likely need only a simple table.
Consider to begin with that always EEPROMs allow from 1000 to 100000 write cycles. This means, should you write just one cell a lot more than 100000 you possess an high probability that the cell die, you can't write it any longer.
Now you ask ,, the number of logins are permitted? It's a all few selecting the best data structure and understand what's the quantity of needed memory.
Understanding the computational energy of Arduino: If logins are simply -. 50, an easy list could be sufficient. Insertion in the finish is O(1), deletion is O(n), research is O(n). A linked list however will help you to reduce the amount of creates for deletion to some constant small value.
If logins tend to be more, 50 .. 1000, a sorted array with binary search is sufficient. Insertion is O(n), deletion is O(n), research is O(n log n). However the amount of creates is O(n) for both deletion and insertion, and also, since writing is slow and may burn cells, it is dependent on the amount of updates for you to do.
If logins are 1000 or even more a binary tree is nice. Insertion is O(n log n), deletion is O(n log n), research is O(n log n). The positive thing is the fact that for insertion and deletion you simply need a little, constant quantity of creates.
Also an hashtable is nice, however they usually use more memory. Insertion is averaged O(1), deletion is averaged O(1), research is averaged O(1). Insertion and deletion requires merely a small constant quantity of write procedures, under a binary tree. When I stated, this data structure uses more memory, speed comes at a price.
You do not need a genuine relational database, but most likely if you want an excessive amount of customers, you'll need an exterior EEPROM.
Obviously, you need to save this data inside a expensive memory, internal or exterior, or you'll lose the database whenever you totally reset or energy lower the equipment.
We are able to also state that you don't have to keep account information, you can easily store an hash from the password and username. When the hashed account information is available, you'll be able to allow login. In by doing this you should use fixed size memory and fewer memory. You should use MD5, it's the Android phone that has to send the MD5 hash, that's, 16 bytes, therefore the Arduino must only see if that MD5 hash is available within the listing of customers there, for instance. Which is simple and easy , fast.