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?

Bence Kaulics
  • 7,843
  • 8
  • 42
  • 90
WayToDoor
  • 816
  • 7
  • 15

7 Answers7

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.

Aurora0001
  • 18,520
  • 13
  • 55
  • 169
Sean Houlihane
  • 10,524
  • 2
  • 26
  • 62
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.

bravokeyl
  • 1,550
  • 1
  • 13
  • 27
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.

Mawg
  • 3,147
  • 1
  • 13
  • 35
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.

Bence Kaulics
  • 7,843
  • 8
  • 42
  • 90
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.

Goufalite
  • 3,776
  • 17
  • 33
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.

sob
  • 2,640
  • 3
  • 19
  • 37
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.

Aurora0001
  • 18,520
  • 13
  • 55
  • 169
Gambit Support
  • 678
  • 3
  • 12