23

A lot of devices, such as connected fridges, security cameras, Raspberry Pis, Arduinos and my Nest thermostat don't have power buttons.

What is the preferred way to disconnect them from power? What if there is a power cut?

Is my data at risk?

Should I buy a separate battery to power them to prevent the risk of corruption?

For example, if a thief enters my home, the first thing he could do is cut the main power. How can I access my camera then, if my Wi-Fi is down?

3
  • 11
    While I did not down vote, this Q has some issues. It addresses too many things in it. What is the preferred way to power down is likely to be different for specific devices.
    – Ghanima
    Dec 6, 2016 at 19:10
  • 2
    One question per post is part of the success of StackExchange meta.stackexchange.com/questions/222735/… It seems advisable to adhere to this rule here too.
    – Ghanima
    Dec 6, 2016 at 19:12
  • 2
    This is way too broad. Don't disconnect your fridge, your food will spoil. Don't disconnect your smart smoke sensor, you might burn. Don't disconnect your smart radiator, you'll freeze.
    – Helmar
    Dec 6, 2016 at 20:46

7 Answers 7

21

A well-designed endpoint device will manage loss of mains power. This can be achieved by using a robust filesystem design, or by maintaining sufficient power in battery/supercapacitor supplies to finish any open operations. It is not just a question of maintaining data security, it's about maintaining stable operation over several years of real-time use without active management intervention.

3
  • 5
    While completely true this is even broader than the question.
    – Helmar
    Dec 7, 2016 at 8:42
  • 1
    I think that's OK. The question asks is this problem a special case, and I'm saying, no, this is a design constant which is already common. Dec 7, 2016 at 9:10
  • 1
    Note that more than file system design is of concern; a flash translation layer can also fail with unexpected power loss, and part of the problem with the Raspberry Pi is that the flash translation layer of an SD card is buried inside the card, unexposed to validation or improvement. Jan 15, 2017 at 22:55
15

What is the preferred way to disconnect them from power? What if there is a power cut?

I assume you are talking about devices which act as gateways to aggregate and send it to the cloud (for e.g.: Raspberry Pi runs on Debian which is full blown OS) and generally runs from power source which is other than a cell battery. Taking RPi as an example, you can directly take out power just like laptop there will be no data loss as the data will be stored in drives, chances of corruption here are minimal or rare.

Will I lose the data?

It depends on how data is stored or read from devices. Most of the sensors (maybe fridges or cameras) don't store any data if even if they store data storage will be limited to the amount that chip can offer. Gateways or aggregators ask sensors for data continuously/periodically to send data which then will be stored in the gateway which is not limited device in comparison to sensors (e.g.: RPi).


Generally any IoT device that is mission critical comes (should come) with redundancy baked in.

1
  • 1
    This is severely mistaken. Neither a raspberry pi nor a typical laptop is safe for unexpected power removal of the actual power source, precisely because the data is stored in drives in ways that are not consistently safe to interrupt with incomplete or unflushed writes. And even where a file system is designed to be robust against power loss, something like an SD card is not - the problem exists at an internal level untouchable by the design of external software. Jun 18, 2017 at 16:32
13

You would very rarely want to remotely power off an embedded device. Instead, you put it into sleep mode, otherwise you can never remotely wake it again.

enter image description here

In sleep mode, normal functionality is suspended, but you can still remotely wake the device.

10

What is the preferred way to disconnect them from power? What if there is a power cut?

Most microcontrollers have a feature called "Brown out detection". This basically a supply voltage monitoring mechanism which keeps the MCU in reset while the supply voltage is below a certain threshold. This threshold is either preset or it can be changed by software. It is known as under-voltage lockout as well.

2
  • True, but if loss of power is handled OK, controlled shutdown comes for free Dec 8, 2016 at 22:00
  • 1
    That is true, but many IoT devices are more complex than simple "microcontrollers" - many are Embedded Linux (or comparable) systems with substantial state that is both critical to operation and modifiable in operation. Jan 15, 2017 at 22:57
8

Your smart devices (camera, sensors,...) manage very well power outage by design.

For your Rapsberry Pi, you can put an UPS or a powerbank and monitor (ping) your Internet gateway to check if there is a general loss of power and send a SMS with a 3G USB dongle.

Even without power outage consideration, you should always and regularly backup your data (databases, i.e. MySQL has a mysqldump feature for quick save) and clone your SD card.

4

What if there is a power cut? Is my data at risk?

For most well designed commercial IoT devices you need not worry about sudden power loss. Let's take case on the Nest Thermostat. The Nest Thermostat uses the Micron 2 Gb NAND flash memory. Given its NAND flash, the file system used must be YAFSS, as YAFFS has been designed specifically for use with NAND flash. YAFFS uses techniques such as journaling, error correction and verification techniques tuned to the way NAND typically fails. These techniques provide reasonable cover against corruptions due to power failures, crashes or unforeseen acts.

Should I buy a separate battery to power them to prevent the risk of corruption?

For a well designed commercial devices, No. For your own hobby projects based on Raspberry Pis, Arduinos, Yes, unless you get a fault tolerant file system in place.

If there is no physical power button on your IoT device, then you can safely assume the device has been designed for sudden power loss, device manufacturer must have used fault tolerance file system.

2

Different classes of IoT devices have different requirements as to functioning in light of power loss. Your weather station might not care if power goes down, but your security system might. Your temperature control system might want to function locally despite power loss.

As to how to control your device there should be a control channel that allows graceful power down. As others have said, this needs to be thought out if done remotely. Power down is just a special case of all the things you want to do remotely to your device.

2
  • 3
    Agreed, the question is not the best, but this answer is also rather non-specific. Saying 'it should work remotely' doesn't appear to answer the question. Jan 19, 2017 at 16:56
  • 2
    If you feel the question is vague or hard to answer in its current form, it's probably best to leave a comment first. You'll need to participate a little bit around the site first (50 rep is needed to comment); feel free to ask, answer or edit to get to that point.
    – Aurora0001
    Jan 19, 2017 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.