Pages: [1]   Go Down
Author Topic: Storing Data  (Read 2260 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey everyone!

I have a project where in I have to count number of rotations the wheel makes. So i have put up an IR sensor and using Arduino UNo i am counting the rotations made by the wheel. Now after I shut down the board I want to start counting from where i have left from the previous count. Please help me with this.What should be the code for this? I am new to Arduino so I dont know many libraries and the access to it. Please help me asap.. smiley-confuse smiley smiley
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is just one good way to do that: EEPROM : http://arduino.cc/en/Reference/EEPROM
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanxs.. but can i write at a particular memory location repeatedly?
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2591
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmel has an app. note AN101 regarding EEPROM .
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49384
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but can i write at a particular memory location repeatedly?
You can. There is a limited number of write cycles available, but that number is greater than 100,000.

Why do you need to keep counting from the same value? Are you implementing some kind of hour-meter?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 88
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but can i write at a particular memory location repeatedly?
You can. There is a limited number of write cycles available, but that number is greater than 100,000.

Why do you need to keep counting from the same value? Are you implementing some kind of hour-meter?
Please i need to save data when shudown the board and i use eeprom but i'm worry because i use it 300 time in day i don't know you mean we use it 100,000 for one register nor 100,000 for 256 (all register) and i want to know if it safe or not ,

, if i use SD card ,Is it better than eeprom or not ?
,if SD better ,How i save data with address ?
Thanks smiley
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

100.000 times for each location in the EEPROM.
100.000 / 300 times a day = 333 days (less than a year).

An SD card uses a filesystem. So you create a file and you can write to that file. An SD card uses flash memory which is almost the same technology as the EEPROM. So writing the SD card too often could be a problem, perhaps not when writing data, but when updating the file system.

Can you change you sketch ?
If you can detect a power off with an interrupt, you could perhaps still be able to write the EEPROM.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why do you need to shut it down (or reset) 300 times a day? Why it can't stay on?

One option is to have a count for write times for certain address and once the counter hits the limit, the sketch changes the address it uses to write to the EEPROM.
Logged

0
Offline Offline
Edison Member
*
Karma: 64
Posts: 1637
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You will never damage an SD card with an Arduino.  The card controller does wear leveling to map different physical blocks to a given logical block.

A 2 GB card has 4,000,000 blocks and each block can be rewritten about 50,000 times.  The card will last for about 200 billion 512 byte block writes.  This requires 100 terabytes of I/O, not likely with an Arduino.
Logged

Brasil
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I have a similar issue.

To write on flash memory we can use this http://arduino.cc/en/Reference/PROGMEM
But the solution is only for to get more space for our variables, we store and retrieve data in the same running.
I need store data into the flash to retrieve the values any time the board is turned on.
Someone know how to do that?

Thanks
« Last Edit: February 04, 2013, 08:46:08 am by wallaaa » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49384
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I need store data into the flash
Flash memory is read-only. You can't store data in flash memory at run time.
Logged

Brasil
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I need store data into the flash
Flash memory is read-only. You can't store data in flash memory at run time.

So, how firmware and programs are stored in the flash (program memory)?

I want write some bytes in the flash and run a stack machine to process this bytes. The 1 kB of EEPROM is not enough.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the EEPROM is not enough, and you want to be able to change it, use external I2C EEPROM memory. A normal size is 8kbyte, but more is possible.
Logged

Brasil
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the EEPROM is not enough, and you want to be able to change it, use external I2C EEPROM memory. A normal size is 8kbyte, but more is possible.


I'm looking for a cheapest possible solution. My project is to turn Arduino compatible with Gogo Board, an open source platform for educational robotics (http://br-gogo.sourceforge.net).
Now we have a hardare with PIC 18F4550 and a logo compiler generating bytecodes. The bytecodes are stored in the PIC program memory. I want to do the same.

The idea is to do this without modify firmware, to avoid create a different firmware for each arduino type.
« Last Edit: February 04, 2013, 01:00:47 pm by wallaaa » Logged

Pages: [1]   Go Up
Jump to: