Go Down

Topic: back up time 1-2 seconds for ardunio uno  (Read 332 times) previous topic - next topic

alio1984

Hey all,
i need to 1-2 second to save the eeprom, how can i do simplest ? the unit is working with a 12V external power.

raschemmel

I have no idea what you are talking about.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

alio1984

When the main power is off, i want the eeprom to record of some datas. I will be need a second or less to do that. How can I simply do.

Smajdalf

To save to the EEPROM you probably needs less time (<2ms if you erase the EEPROM previously). Use some "early warning" circuit for the main power source so you notice when its voltage starts falling. Shut off everything possible powered from the 12V and the smoothing caps may be enough for the EEPROM write.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

alio1984

Wouldn't it work  if I put a 2200uf 16V capacitor between 5 volts pin and GND on board? or ( 3.3V pins - GND )


i think that use a voltage divider and i can read this value in analog input. i dont know is it work? (without any capacitor)

Smajdalf

Adding a huge capacitor would surely work. You also need to add a diode between 12V and the Arduino's regulator to prevent backfeeding of the external circuit from the huge cap. But for normal Arduino Uno you need really huge cap. 2200uF may be enough if you react quickly a write only a few bytes. Hard to say without much more detail.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

septillion

To save to the EEPROM you probably needs less time (<2ms if you erase the EEPROM previously).
Takes 3,3ms per byte according to the datasheet (and my measurement ):)

If connected to to 5V line you need a pretty big capacitor for an acceptable time.

I did some tests one moth ago. A Pro Mini without a LED and not powering anything (significant, which isn't that hard to design but you do need to think about it) can run for 170ms on a 470uF cap if that cap is charged to 12V and fed to Vin. Used 4,3V (settable BOD voltage) as lower limit of Vcc. Witch LED it's 130ms.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

alio1984

Is the attached circuit enough?  or should i add a 2200uf cap. between 5V pin and GND on UNO?

septillion

What is the diode doing there?
Resistors should at least be an order of magnitude larger. But you can also just use a 100k to pin and detect it digital. Can even be an interrupt pin.

I assume BAT1 is the external supply you're talking about?

And of course you need a buffer cap if you want to do something if you loose power. You can connect it between Vin and GND and use the diode inline with the barrel plug to decouple the Arduino from the power supply. Also, be sure to not power anything from the Arduino (including IO) or at least turn it off as quick as possible.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

GolamMostafa

#9
Sep 11, 2019, 02:54 pm Last Edit: Sep 11, 2019, 02:55 pm by GolamMostafa
1.  The following circuit could be exercised to see that the MCU does save data in its internal EEPROM during power fail/switch OFF. The power failure/switch OFF condition could be detected either by polling the PD2-pin or being interrupted.



2.  However, another issue is to keep in mind that the EEPROM is prone to get erratically written at random locations when the Vcc supply goes below about 3.4V. Brown out detection level could be properly chosen via fuse bit setting of the MCU so that the MCU enters into reset condition when the Vcc supply falls below 3.4V and thus prevents the EEPROM from getting written erratically.

septillion

Wow, that is a whopping overcomplicated circuit for it!

And the buffer cap is connected to Vcc, aka you have a range from 4,5V to 4,3 volt to do your thing... Not very appealing.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

alio1984

i think Just analog read and (2200uf cap. 5V-GND pins ) is enough to to save of eeprom. i will test this circuit and
 share with you.

Smajdalf

#12
Sep 11, 2019, 04:06 pm Last Edit: Sep 11, 2019, 04:06 pm by Smajdalf
Takes 3,3ms per byte according to the datasheet (and my measurement ):)
1.8ms if you are prepared:

How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

alio1984

1.8ms a wonderful value. maybe it does not need any capacitor, i use a switch mode power supply, surely it has a capacitor in the out of DC :))

GolamMostafa

#14
Sep 11, 2019, 05:30 pm Last Edit: Sep 11, 2019, 06:45 pm by GolamMostafa
Wow, that is a whopping overcomplicated circuit for it!
But, we need a mechanism to inform the MCU that there is a failure in the DC power system and then the MCU will save the critical data into its internal EEPROM. The posted circuit is not the only available design, there could be and there are many alternatives in the web some of which are not less complicated than the posted one.

Go Up