manage power switch off

Started by giorgio323, February 27, 2013, 03:59:09 PM

Previous topic - Next topic

giorgio323

I am using Olinuxino wifi.
My program start at boot and run neverending.
I have to manage when power goes off. May be because the power supply is unplugged or what else.

My idea is to have a power supply with an indicator of grid voltage present and able to backup the power for around 30 sec.
When I got the signal GridOff I run a shutdown command as below.
I suppose this is necessary to avoid to damage the file system.

Questions

is it really necessary?
are there simplest ways to do it?
in which way can I disable the LCD to save current during shutdown?

Any suggestion is welcome

Giorgio

if(GridOff )
{
   set LCD pwm off   // hiw do it??
   System("shutdown -h now");
}
}

jwischka

Quote from: giorgio323 on February 27, 2013, 03:59:09 PM
I am using Olinuxino wifi.
My program start at boot and run neverending.
I have to manage when power goes off. May be because the power supply is unplugged or what else.

My idea is to have a power supply with an indicator of grid voltage present and able to backup the power for around 30 sec.
When I got the signal GridOff I run a shutdown command as below.
I suppose this is necessary to avoid to damage the file system.

Questions

is it really necessary?
are there simplest ways to do it?
in which way can I disable the LCD to save current during shutdown?

Any suggestion is welcome

Giorgio

if(GridOff )
{
   set LCD pwm off   // hiw do it??
   System("shutdown -h now");
}
}

The better thing would be to make your program tolerant to power failures by using atomic commits, journaling, etc. In principle, though, what you're describing is possible. There are even some UPS network based tools that might give you a shutdown signal. You might look into commercial solutions before reinventing the wheel.

giorgio323

The software I am writing do not care about loss of data.
My concerns are about the operating system.
I am new to linux and I have no idea if a uncontrolled shutdow (remove the power) can cause a damage of file system.
I read on the manual to avoid to disconnect the power while running.
I am supposing that this system is close to a PC and need a controlled shutdown.

Is the OS and the board built to be tollerant to power fail?

Do you know very inexpensive UPS able to do it? I am looking for somenthing with price and dimensions close to a wall dc power supply.

Let me know
Thank you
Giorgio

jwischka

In general, these boards are reasonably tolerant to uncontrolled shutdowns, particularly if you keep the journaling features of ext3/4 on. If this is a product that is absolutely mission critical (meaning the loss of lots of money or life), then I would take extra precautions. In general, though, I would be comfortable with running in an uncontrolled mode, particularly if you didn't expect frequent shutdowns (and honestly, from the OS perspective, I'd probably be ok even then).


Quote from: giorgio323 on February 27, 2013, 06:40:00 PM
The software I am writing do not care about loss of data.
My concerns are about the operating system.
I am new to linux and I have no idea if a uncontrolled shutdow (remove the power) can cause a damage of file system.
I read on the manual to avoid to disconnect the power while running.
I am supposing that this system is close to a PC and need a controlled shutdown.

Is the OS and the board built to be tollerant to power fail?

Do you know very inexpensive UPS able to do it? I am looking for somenthing with price and dimensions close to a wall dc power supply.

Let me know
Thank you
Giorgio

murerten

How about lipo battery(olimex 1400 mAh lipo)? In android you get power connect and disconnect events. If you catch this event you can shutdown immediately. When power is on again the battery charges. Also the system clock is preserved when you use lipo battery.

iw2lsi

 
  never had one, but you can check POWERSTOK MICRO UPS at http://www.powerstok.com/


      Giampaolo