Storing the last stage of transistor

Thread Starter

Dabu WhiteHacker

Joined Sep 5, 2017
68
i was designing a circuit which control the motor using relay.
but i ran into a small problem, when the power goes out I dont want to lose the state of transistor i mean whether it is on or off so that when when power come back and arduino start again it remembers the last stage of transistor and trun off/on the motor accordingly.
 
There seem to *always* be issues associated with using the EEPROM in the Arduino for power failure issues (e.g., see here) . I'm not saying you can't do this, you certainly can by writing to the EEPROM every single time that you change the state of the transistor.

What I am saying is that, inevitably, you have a race against time (a capacitor discharging) or a burden to otherwise detect the power failure and and do something about it within a short window. Also, the issue of how many times you can write to an EEPROM can be a consideration.

I looked into EERAM and was very impressed (see somewhat self-serving reference here). Depending upon the specifics of your application, you may want to look into them as a possible alternative.
 
Agree.

ak
Glad to hear that!.

The OP has already said that he gets it, so there is no reason to go on about this too much.

In my post, I wanted to contribute information about using EERAM as an addition to the EEPROM content, which was already stated. Some readers may not know about them. Since EERAM is SRAM with automatic backup to EEPROM, it can can offer some advantages over EEPROM alone. Since the user only writes to SRAM, you don't have the same concern about how many times you can write to EEPROM because the EEPROM is only written to on a power failure.

Take for example a 100K cycle life, as reported by @ericgibbs ... if your application changed the transistor's state 6 times an hour, turning it on and off three times you would write to EEPROM six times every hour (which in some applications it certainly could). Your EEPROM may not even last two years of continuous use (6 X 24 X 365 X 2)=105,120.

Since with EERAM, backing up SRAM to EEPROM is done automatically and is accomplished with one simple capacitor, there can also be less program overhead during actual use (quicker writes as only SRAM is used inside the program).

There are clear advantages in some situations - I hope that you can agree with that also.
 

danadak

Joined Mar 10, 2018
4,057
When you design this, since power is failing, and I assume to Arduinoi as wellll
you have to hold the power up long enough to do the write of status to the internal
EEPROM.

So Arduino should have an interrupt for sensing power fail.Coupled with that a
large storage cap power supply to keep Arduino running long enough to do the
write. To compute cap size-

Q = C x V
I = C x dV/dT, solve for C

C= ( I x dT ) / dV

dV is the voltage change from interrupt detection to minimum operating V of Arduino
dT is time to execute interrupt and write to EEPROM
I is Arduino current.

Keep in mind bulk caps have wide tolerance so scale answer accordingly.

Regards, Dana.
 
Top