Pages: 1 [2]   Go Down
Author Topic: Saving data when Arduino turns off.  (Read 1410 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 59
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I admit I don't really know how to integrate a transistor here. I only can put a relay instead. But let's try to calculate the transistor which fits here.
For example we can use a BC547 (Vcbo = 50, Vceo = 45), and assume an Ic = 200mA. I guess Ie = Ic = 200mA. I suposse I need hfe value but in the datasheet there are 3 values:
Classification      A              B             C
hFE             110 ~ 220  200 ~ 450  420 ~ 800
I can't go on with calculations, sorry. Any help?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31472
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
we can use a BC547 (Vcbo = 50, Vceo = 45),
Then that is fine. Some transistors can not stand the base being that much higher than the collector.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Then that is fine. Some transistors can not stand the base being that much higher than the collector.

If the base goes more than about 0.6V above the collector, then the collector-base junction will conduct, feeding some current to the MCU +5V supply (limited by the 4K7 base resistor), but otherwise doing no harm.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I guess that what I am going to ask must have already been asked before, but I promise I have tried hard a lot in order to find it but without success.
I am developing a project with Arduino where it is necessary saving some data when Arduino turns off. I am using the EEPROM to get it.
The problem I have is that I am not really able to DETECT when Arduino is turning off. I use a capacitor which let Arduino keep on for 1 second after power turns off. 1 second is certainly enough since I am saving 10 bytes. I do know the prgramation I have written is ok because I have checked it with a button FALLING like power would do.
I need some circuit so that a digital pin can detect 1 when powering and 0 when turning off. I have tried wiring the input directly to the power but although power turns off, the pin doesn't detect it (I have also tried with a pullup resistor).
Of course I am using an external 5V supply power.

Waiting ideas. Thanks a lot.

I did exactly what you want to do. What I did was this:

(1)  Connect a 4700 uF cap across 5V and gnd to maintain power for a few seconds.

(2)  Used a resistor divider connected to an analog input pin. This serves two purposes: First the program itself monitors the battery voltage and reports when the battery is low. Secondly, the voltage value is checked once for each pass through the main loop and compared to the previous reading. If it drops fast enough (i.e. the difference between two readings is large enough), that is considered a "powering down" condition and then the program saves it's current state to EEPROM, to be re-loaded and resumed at next powerup.

The key is the capacitor to keep the board powered long enough to recognize a shutdown event and then have enough time to write to EEPROM.
Logged

Pages: 1 [2]   Go Up
Jump to: