A Power Saving Hybrid Technique for IoT

Most IoT applications usually contain a battery inside, which provides good mobility for the system, but also limits lifetime of the application in general. A lot of work concentrated on power saving algorithms for software, and hardware solutions to provide better results. The proposed solution uses a hybrid technique that enables the IoT system to save power by installing a secondary low current microcontroller to put sensors and other devices in sleep mode, and depending on the IoT device’s application, it will be awakened by a needed trigger that is tuned according to the application (such as certain sensors readings, or time based trigger). This will provide high system flexibility.


Introduction
Smart homes and smart devices are taking the attention of consumers everywhere.Surveys show that almost 81% of Americans (Note 1), for example, are interested or already own smart devices for their smart homes.Connecting these devices (or things) through a wireless network to enable them to communicate and be remotely access or controller can be used to define the emerging technology of the Internet of Things (IoT).
The "Things" that are listed for this technology are limitless; they vary from cars to toasters, from the Air Conditioning Unit to the light bulbs (Al-Fuqaha et al., 2015).These things are used in almost every aspect of life, whether it is in homes, small shops or big institutions (Perera et al., 2014).
As with every other new technology, there come some limitations and concerns associated with the wide spread of it.The IoT connected devices are vulnerable to power sources limitations for example, since the chips that are designated for communication with other "things" in an IoT system use power to establish and confirm connections, or to send and receive data.
Most IoT applications usually contain a battery embedded within the device, but this might lead to limiting the lifetime of the application in general.For example, a microcontroller of type ESP8266 with built-in WiFi consumes 170mA while transmitting data, about 15mA in modem sleep mode, and with deep sleep, it consumes 0.01mA only (but software will not be able to wake it up, it needs hardware reset).
The proposed system shows a cutting edge technology for power consumption utilization using a hybrid technique that relies on installing a secondary chip to the original System on Chip (SoC) to enhance power consumption of smart devices in an IoT system.

Related Work
There have been many ideas and innovations concerning power saving and management in a IoT system, some focused on hardware integration (System on a Chip, aka SoC) of power sources, while others focused on software that enable devices to sleep and wake up based on certain triggers and conditions.
With around one trillion semiconductors that are used in IoT devices (Karimi and Atkinson, 2013), the need for an efficient power management protocols and devise is highly needed.Some promising technologies were proposed in the form of an Ultra-Low Power (ULP) devices (Myers et al., 2014) and (Rossi et al., 2017) that uses less than 10µW of energy, while being able to use sensors, process collected data, and transmit them (Rossi et al., 2017) , but such systems have limitations since a dedicated software that is efficient and "smart" need to co-exist with these devices, which might result in the opposite intention of adopting this technology; that is increase power consumption.Some researchers adopted devices that are battery-less, like (Yahya et al., 2017), where a System in Package (SiP) was integrated with a 1Mb/s Radio transmitter and a non-volatile memory, to increase SoC efficiency and reduce cost.The SoCs use a utilized Energy harvesting Platform to supply the SoC and off-chip components in the IoT environment.
Another technique was to adopt self-powered devices, as in the work of (Klinefelter et al., 2015) and (Shirvanimoghaddam et al., 2017) where energy is harvested from the environment and integrated into the SoC of an IoT device to make it functional.The main drawback with such technology is that they are best integrated with large systems, which implies they will not be suitable to certain IoT applications, like in medical monitoring systems (Lian, 2015).Another note relates to the unstable nature of environmental power sources where power might be lost and devices are turned off, some researchers tackled this problem, like (Jayakumar et al., 2017), but data was lost even when power was restored.
Availability of IoT devices should be maintained all the time.Since Wireless Sensor Networks (WSN) are an architecture where IoT devices can be connected and communicate through, the protocols that are used to save power in nodes of such a network are applicable to IoT systems (Kaur and Kaur, 2016), like the commonly known IEEE 802.15.4/Zigbee,Wi-Fi/IEEE 802.11 protocols (Mahmoud and Mohamad2016), or the Bluetooth Low Energy technology (Nieminen et al., 2014) and (Collotta and Pau, 2015).
The use of WSN for IoT system has been extensively studied from energy saving perspective, several techniques were developed to ensure power saving (Kaur and Kaur, 2016), the researchers of (Toklu and Erdem, 2014) recommended the employment of Base Station Controlled MAC (BSC-MAC) that is an emerging adaptive, power saving variation to the original MAC in terms of scheduling sleep turns.Others like (Shahgoshtasbi and Jamshidi, 2014) focused on the Demand response (DR) structure that utilized sum of timing through a Neuro-fuzzy paradigm to save energy and was proven effective given a network with no exceptional cases.

System Schematic
Most IoT systems rely on enhancing either the hardware power management efficiency, or the sleep cycle of connected devices scheduling.The system proposed in this research employs a hybrid technique that enhances power management for IoT connected devices.
We suggest in this research embedding a secondary very low current microcontroller (ATTINY84), which consumes <0.5mA on idle mode with NPN transistors (2N2222A) to power off sensors, and main controller when needed (via a specially designed battery saving algorithm), which will reduce full system power consumption from 30 -80mA (including sensors after applying basic power saving algorithms) to 0.2mA after applying the proposed hybrid hardware/software technique.
The system's main idea concentrates on adding a secondary, very low power, microcontroller to the original NPN transistor that acts as a switch to power-off sensors when in idle state.This technique helps in saving around 99.3% of overall power consumption.

The Hardware
The secondary microcontroller that is used as a backup for the original SoC is of type Arduino ATTINY84, and has very low power consumption at various frequencies.The current consumed with mostly used frequencies are listed in table 1 The system was developed using a robot that contains ESP8266 microcontroller, motor actuators, motion sensor, LDR sensor, microwave sensor (type MO9 402), GPS unit (type Ublox NEO-6M) and a power source (Li-ion battery 3.7V 3000mA).Table 2 shows information about sensors/actuators used by the developed robot.The microcontroller unit used in this research (ESP8266) is popular in power saving systems (like the system developed in (Ram and Gupta, (2016)) because of it's easy to configure sleep modes.These modes are (EPS user guide, online resource): 1. Modem sleep: where system CPU and other internal hardware keeps running, but Wi-Fi modem circuit is powered off while keeping connection up with router but without any data transmission.The processor wakes up Wi-Fi circuit every pre-determined time period (say every 300 mS) to check and receive any packets that were waiting while in modem sleep, then goes back to sleeps.The Processor checks sensors readings while modem is sleeping.
2. Light sleep: which is similar to Modem sleep but includes powering off CPU and modem together.This means less energy consumption by the system, but, on the other hand, the CPU is unable to monitor sensors.This method may be used in insensitive applications and saves around 13mA more than modem sleep method 3. Deep sleep: where the Wi-Fi connection is not maintained, and the unit powers off both modem, and CPU.System wakes up every time period (much longer than modem sleep periods, like every five minutes) to check sensors readings and send it to Wi-Fi then sleeps again.This concept is not applicable in smart cities (that employ IoT) but it uses <1 mA on average.

The Algorithm
Depending on application, background algorithm in the ATTINY84 chip will initialize a timer interrupt depending on the highest sensor frequency.For example, motion sensor is being read 10 times a second while LDR, and microwave are being read 1 time a second.Thus, timers interrupt need to be set every 100mS (depending on highest frequency of 10Hz).
Inside the interrupt, if it is time to get a sensor's reading, it has switched on via NPN transistor, then read (reading time is same as measurement time plus time needed to stabilize the sensor).After all readings are taken, the serial port with ESP8266 is checked for any incoming data like instant need of sensors readings (as user command) or motor movement to specific position.
To achieve interrupt function, every time an interrupt occurs, motion sensor is being read, and a counter is increased by 1. Once the counter reaches 10, LDR, and microwave sensors are read in the interrupt, and the counter is cleared to 0 again, and so on.
In the main subroutine, a comparison between sensors readings takes place, and depending on user value set, microcontroller may decide to send these value readings (depending on timer, like send data readings every X seconds, or depending on action such as sensor abnormal activity).
Every time ESP8266 wakes up to check for new data receive, it will also check incoming serial connection for new sensors readings to send to cloud storage.Only one node will be listening to incoming packets in the system (chosen depending on power and RSSI signal connection to server) while other nodes Wi-Fi is off.If there is an incoming command to send sensors readings instantly, ESP8266 sends that command to ATTINY84 via serial and waits to receive sensors readings to send them back to user before sleeping again.The chart in figure 1 illustrates the interrupt event handling against time for the example mentioned above.Once node in charge of listening receives information, it will either forward them to the destination node directly (when the packet's size is small), or indirectly (when the packet's data is big or the data needs special permission to get access), or may decide to wake up all nearby nodes (if it is a firmware update packet or urgent broadcast packet).

The Case Study
A military robotic node in an IoT system is used to receive commands to actuate motors, and move to a specific GPS location to get data from, and, when Robot reaches the spot, it will start monitoring motion, LDR, sound and microwave sensors, and send information to base station every 5 minutes on normal state, or when a significant reading is received from any sensor.The Robot should also maintain a Wi-Fi connection with a router so that it moves immediately to new locations when needed.active for reading except the GPS unit (stays in sleep mode, consuming 10mA), where the total sensor power consumption is 326 mA (motors are not active).Thus, total ESP and sensors consume 340mA.Using a 3000mA battery, the system will run for about 8 hours 48 minutes.
In the proposed system, the chips basically depend on having two microcontroller units, a main unit which is ESP8266 and a secondary controller which is ATTINY84.The ESP unit will be in light sleep mode (but could be altered depending on application requirement) consuming 1mA, and ATTINY will be powered on using internal 4 MHz crystal and consuming 2mA.Sensors will be connected to ATTINY, which uses low current, and will be fully monitored by it.When needed (like receiving a reading from one of the sensors), ATTINY will send an interrupt signal to ESP unit causing it to wake up and send information via Wi-Fi.The systems hardware architecture and hardware connections is illustrated in figure 2.
In the system's connection, multiple NPN transistors were used to power off sensors when not needed, besides, same Serial (Tx, Rx) ports are used to communicate with ESP8266, GPS and Microwave sensors.It is known that only one device can communicate through serial at a given point of time, but since GPS and Microwave sensors can be turned off via NPN transistors, ATTINY84 microcontroller can cooperate via code on what device are open for communication and turn off other devices to prevent interference.By the time ATTINY84 microcontroller is trying to communicate with GPS or microwave sensors, ESP8266 will disable serial port via software code to prevent interference (because ESP8266 is an essential unit and can't be turned off via transistor, thus, its ports need to be disabled via code).
At this time, ESP will only monitor Wi-Fi to see if there is any incoming packet with a command to move to another location, in this case, ESP will send new location to ATTINY, which will not keep sensors on all the time, but will only power them on for a certain period of time to read data then power them off again using NPN transistors.This will make power consumption even less as shown in table 3. To show the strength points of the proposed system, we compared the values registered for power consumption with three different applications that used a somewhat similar technique to the one used in this research.
The authors of (Gia et al., 2018) developed a wearable device in an IoT system, where small chip was embedded inside the smart device to monitor falls for elderly people.While the authors in (Lombardo et al., 2012) focused the attention in power saving on the WiFi adapter in a Wireless Sensor Network, where an ATTINY 2313V chip was installed within an FPGA system to monitor and control energy consumption.In the research (Ignjatovic et al., 2012) the ATTINY 2313 microchip was used also for power management in an IoT system that monitors air filters performance and power consumption.

Testing Results
After running the developed robot that is equipped with the aforementioned Chips, the total sensor power consumption was registered to be around 660µA, and both controllers consumed 3 mA, which summed up to a total of 3.66 mA, compared to the originally needed 340 mAs, the 13.1mA recorded in the work of (Gia et al., 2018), and the 31.65mAconsumed in the research in (Lombardo et al., 2012).
The systems that are used for comparison show data for the WiFi adapter only (with the ESP chip installed).The proposed system of this research has the following data listed in table 4 for the WiFi adapter at different states to facilitate relating numbers.This is a strong indication that the system's working time per charge went up from 8 hours and 48 minutes to 34 days (816 hours), while the similar technique that was developed in (Gia et al., 2018) made the system operable for 228 hours (9 days and 12 hours), and 106 hours (4 days and 5 hours) for the controlling system in (Ignjatovic et al., 2012).Figure 3 shows the trend of power consumption of the proposed system, while the trend of the power saving technique mentioned in (Gia et al., 2018) is plotted in figure 4, and the trend for the Wireless Filters Monitoring System (WFMS) of power consumption is shown in figure 5.A brief comparison of the proposed work in this research with the related work mentioned in (Gia et al., 2018), (Lombardo et al., 2012), and (Ignjatovic et al., 2012) is summarized in table 5 Table 5.Comparison between power consumption between proposed system and other systems from literature

Mode
Elderly Fall detection (Gia et al., 2018) FPGA for WSN (Lombardo et al., 2012) WFMS (Ignjatovic et al., 2012) Proposed The Proposed algorithm proved to be very efficient and can increase battery life (while keeping same system performance) to up to 98%.Though we believe the comparison might not be fair, given that we are comparing the overall performance of the system (where the WiFi adapter is only one of several parts of the system), yet the comparison numbers were in favor of the developed system of this research.

Conclusion
There is an undeniable need for an efficient power management scheme to accompany the widely spreading use of IoT in smart homes and institutions.Most devices need to stay up almost at all-time to ensure the benefits of IoT systems are met.
A hybrid technique was proposed in this research that makes power consumption as minimum as possible, while making the smart devices always available.The technique depends on installing and additional chip with very small power consumption to the already operating SoC installed in most smart devices in an IoT system to regulate the sleep modes cycle of connected devices.
The performance and testing of the innovation shows huge saving in power, which lead to prolonging the battery life and reduced the number of recharging times needed, thus enhancing the overall efficiency of the entire IoT system.

Figure 2 .
Figure 2. Proposed system connection in the case study Usually; ESP microcontroller unit is installed and kept in modem sleep mode consuming 14mA and all sensors are

Figure 3 .
Figure 3. Power consumption trend of the proposed hybrid technique

Figure 4 .
Figure 4. Power consumption trend of the power saving technique in(Gia et al., 2018)

Table 2 .
Robot has used sensors/actuators

Table 3 .
Different sensors power consumption rates (EPS user guide, online resource)