Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

write the data in ram of mcu into eeprom when power outage

Status
Not open for further replies.

dnarenderreddy

Junior Member level 2
Joined
Jan 2, 2006
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,742
hello everybody, my name is narender, a b.tech final year degree.

iam doing my project on pre piad energy meter. i am facing a trouble with the design. brief about my project. there will be an energy meter ic which wil be converting the instantaneeous load into pulses and a microcontroller which will be counting those pulses and when ever the count becomes 1500 pulses then some counter is incremented and is written into the serisl eeprom chip. now when ever the counter is just to less than 1500 pulses and there is a power outage, then all the ram contents are lost. i,e a total of 1 kwh is lost. so for this i have to design a power back up unit(from batery) which will detect a power outage and swith on very quickly whenever there is power outage and i will write a interrup service routine to write the contents of the counter into the serial eeprom and after that my back up(from battery) unit also should shut down. and on power resumption i should take the values from the serial eeprom and then start counting from there.

how can this be done, a non volatile ram is not an economical one so i cant go for it. can anyone help me with some other low cost circuit and get my purpose solved.

sorry for my english.

thanks in advance.
 

nikhilele

Advanced Member level 3
Joined
Jan 11, 2006
Messages
805
Helped
101
Reputation
202
Reaction score
76
Trophy points
1,308
Location
Bangalore India
Activity points
6,375
u can use serial eeprom from atmel, it is AT24c02 u need only three pin SDA,SDC, and gnd to interface it. dowload datasheet from there and code too, from www.atmel.com, if u have any problem post here.
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,937
hi,
maybe you can refer to this thread created by me:


the question i raised in the thread is similar to yours..
 

dnarenderreddy

Junior Member level 2
Joined
Jan 2, 2006
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,742
Re: write the data in ram of mcu into eeprom when power outa

hello,
iam using at at24c04 ic , it is not the problem with the eeprom its the problem with the power back up for say 15 seconds.

Added after 36 minutes:

hello banh,
i have seen the post u mentioned, its quite educational, can you give me the final circuit which you used for your application.

thanks
narender

Added after 36 minutes:

but i think battery will become bulky for my application,
how much size will a 9 volts NiMH battery be. and what will be its size.
i just want back up for vey small time less than a minute. the battery capacity (AH)should be very small.
i think lead acid battery will not suit my application(wall hanging energy meter).

is there any other battery which will be small in size and provide me 9 volts .

awaiting
your


thank you
narender
 

nikhilele

Advanced Member level 3
Joined
Jan 11, 2006
Messages
805
Helped
101
Reputation
202
Reaction score
76
Trophy points
1,308
Location
Bangalore India
Activity points
6,375
if ur controller can work on 3V u can use a 3V battery which is used in motherboard.
or a 3.6V used with cordless phone they are small in size.
 

Buriedcode

Full Member level 6
Joined
May 6, 2004
Messages
357
Helped
43
Reputation
86
Reaction score
7
Trophy points
1,298
Location
London
Activity points
8,887
Re: write the data in ram of mcu into eeprom when power outa

Hi, this may not help much, but have you thought about capacitors?

I mean the 1-5F ones. Their capacity rivals that of batteries, but you can charge them very quickly. Memory backup caps are cheap now, and last for about 3 years from full charge.

https://www.hackaday.com/entry/1234000383070996/

Hope this helps. The cap in the link is a big one, You can get tiny ones the size of a few button cells.

Buriedcode.
 

dnarenderreddy

Junior Member level 2
Joined
Jan 2, 2006
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,742
Re: write the data in ram of mcu into eeprom when power outa

hi , my circuit uses the atmel 89s52 microcontroller, i am not sure but the controller will reset itself if the voltage drops below 4 volts.

so i cant use 3 volts. i can use 3 compuiter motherboard cells in series, but how ling will they last i will be drawing power only until i write a byte of data into the eeprom and the total load on battery comprises of microcontroler, serial eeprom at24c04, lcd with back light, max 232, 2 led's. but all i need is not more than a maximum of 30 seconds in the worst case.

how much does the super capacitors cost and where in india (hyderabad) can i get them , will they supply power for the above laod for a minimum of 25 sefconds.

how much does the cells in computer cost how long wil they last for the above load.

thank you
narender
 

philba

Full Member level 2
Joined
Jan 26, 2006
Messages
132
Helped
13
Reputation
26
Reaction score
1
Trophy points
1,298
Activity points
3,102
15 seconds????? How much data are you writing??? From your earlier description, I would have guessed just a few bytes. Saving that can be accomplished in milliseconds. Have you actually measured save time?

I would put more thought into how you detect power-out in the fastest possible way. Do that as far upstream as possible. Don't wait for your filter caps to drop. Then beef up the power supply to give you the time you need.

At the worst case, use a p-mosfet to feed the non-critical components and turn it off when you see power fail. This will conserve power for the critical components (uC and eeprom).
 

dnarenderreddy

Junior Member level 2
Joined
Jan 2, 2006
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,742
Re: write the data in ram of mcu into eeprom when power outa

ya,
its not 25 or 30 seconds, its a matter if i think a max of 2 seconds.. my circuit is already soldered on the pcb i cant have mosfets to switch the power off to other devices. so i have to supply the other devices also. i just need to detect and save few bytes and then switch of fthe battery supply also.

i think i dont need a rechargable battery , does the batteries used on computer motherboards last long atleast for 1 or 2 years if they are only used when there is a power outage.
 

philba

Full Member level 2
Joined
Jan 26, 2006
Messages
132
Helped
13
Reputation
26
Reaction score
1
Trophy points
1,298
Activity points
3,102
I'll repeat it, you need to measure how long the save takes. guessing is, well, amatuerish. Measure your current draw. Figure out the size of the problem. Use a scientific approach.

To bad you didn't understand the problem before building the circuit.
 

dnarenderreddy

Junior Member level 2
Joined
Jan 2, 2006
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,742
Re: write the data in ram of mcu into eeprom when power outa

hi , can u tell me how to measure the time exactly required for writing into the eeprom
 

philba

Full Member level 2
Joined
Jan 26, 2006
Messages
132
Helped
13
Reputation
26
Reaction score
1
Trophy points
1,298
Activity points
3,102
sigh. doesn't anyone figure stuff out for themselves anymore?

well, you can read code and count clocks. assuming you have datasheets that show timing.

do you have an o'scope? put the code that does it in a loop amd toggle a pin high and then low at the top of the loop. look at the pin with the scope. measure time between pulses.

do you have a stopwatch? put the store code in a loop for say 1000 iterations. toggle a pin before the start of the loop, toggle it again at the end. put the whole thing in an infinite loop. use a dvm to watch the pin and use a stop watch to measure the high or low period. you may need to tweak up or down the number of itterations. if you have a free pin, you could jury-rig up an LED for visual indication.

if you have an emulator, count trace buffer clocks.
 

puviarasu

Full Member level 3
Joined
Dec 17, 2004
Messages
155
Helped
14
Reputation
28
Reaction score
5
Trophy points
1,298
Location
India
Activity points
1,523
Dont update the data for every 1500 pulses you update it for lesser pulses like 100 or 50 etc so that the count loss due to power failure will be minimum.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top