In a typical IoT system, a sensor may collect information and route to a control center. There, previously defined logic dictates the decision. As a result, a corresponding command controls an actuator in response to that sensed input. Thus, sensors and actuators in IoT work together from opposite ends.
All IoT applications need to have one or more sensors to collect data from the environment. Sensors are essential components of smart objects. One of the most important aspects of the Internet of Things is context awareness, which is not possible without sensor technology. IoT sensors are mostly small in size, have low cost, and consume less power. They are constrained by factors such as battery capacity and ease of deployment. Schmidt and Van Laerhoven  provide an overview of various types of sensors used for building smart applications.
5.1. Mobile Phone Based Sensors
First of all, let us look at the mobile phone, which is ubiquitous and has many types of sensors embedded in it. In specific, the smartphone is a very handy and user friendly device that has a host of built in communication and data processing features. With the increasing popularity of smartphones among people, researchers are showing interest in building smart IoT solutions using smartphones because of the embedded sensors [16, 26]. Some additional sensors can also be used depending upon the requirements. Applications can be built on the smartphone that uses sensor data to produce meaningful results. Some of the sensors inside a modern smartphone are as follows.(1)The accelerometer senses the motion and acceleration of a mobile phone. It typically measures changes in velocity of the smartphone in three dimensions. There are many types of accelerometers . In a mechanical accelerometer, we have a seismic mass in a housing, which is tied to the housing with a spring. The mass takes time to move and is left behind as the housing moves, so the force in the spring can be correlated with the acceleration. In a capacitive accelerometer, capacitive plates are used with the same setup. With a change in velocity, the mass pushes the capacitive plates together, thus changing the capacitance. The rate of change of capacitance is then converted into acceleration. In a piezoelectric accelerometer, piezoelectric crystals are used, which when squeezed generate an electric voltage. The changes in voltage can be translated into acceleration. The data patterns captured by the accelerometer can be used to detect physical activities of the user such as running, walking, and bicycling.(2)The gyroscope detects the orientation of the phone very precisely. Orientation is measured using capacitive changes when a seismic mass moves in a particular direction.(3)The camera and microphone are very powerful sensors since they capture visual and audio information, which can then be analyzed and processed to detect various types of contextual information. For example, we can infer a users current environment and the interactions that she is having. To make sense of the audio data, technologies such as voice recognition and acoustic features can be exploited.(4)The magnetometer detects magnetic fields. This can be used as a digital compass and in applications to detect the presence of metals.(5)The GPS (Global Positioning System) detects the location of the phone, which is one of the most important pieces of contextual information for smart applications. The location is detected using the principle of trilateration . The distance is measured from three or more satellites (or mobile phone towers in the case of A-GPS) and coordinates are computed.(6)The light sensor detects the intensity of ambient light. It can be used for setting the brightness of the screen and other applications in which some action is to be taken depending on the intensity of ambient light. For example, we can control the lights in a room.(7)The proximity sensor uses an infrared (IR) LED, which emits IR rays. These rays bounce back when they strike some object. Based on the difference in time, we can calculate the distance. In this way, the distance to different objects from the phone can be measured. For example, we can use it to determine when the phone is close to the face while talking. It can also be used in applications in which we have to trigger some event when an object approaches the phone.(8)Some smartphones such as Samsungs Galaxy S4 also have a thermometer, barometer, and humidity sensor to measure the temperature, atmospheric pressure, and humidity, respectively.
We have studied many smart applications that use sensor data collected from smartphones. For example, activity detection  is achieved by applying machine learning algorithms to the data collected by smartphone sensors. It detects activities such as running, going up and down stairs, walking, driving, and cycling. The application is trained with patterns of data using data sets recorded by sensors when these activities are being performed.
Many health and fitness applications are being built to keep track of a persons health continuously using smartphones. They keep track of users physical activities, diet, exercises, and lifestyle to determine the fitness level and give suggestions to the user accordingly. Wang et al.  describe a mobile application that is based completely on a smartphone. They use it to assess the overall mental health and performance of a college student. To track the location and activities in which the student is involved, activity recognition (accelerometer) and GPS data are used. To keep a check on how much the student sleeps, the accelerometer and light sensors are used. For social life and conversations, audio data from a microphone is used. The application also conducts quick questionnaires with the students to know about their mood. All this data can be used to assess the stress levels, social life, behavior, and exercise patterns of a student.
Another application by McClernon and Choudhury  detects when the user is going to smoke using context information such as the presence of other smokers, location, and associated activities. The sensors provide information related to the users movement, location, visual images, and surrounding sounds. To summarize smartphone sensors are being used to study different kinds of human behavior (see ) and to improve the quality of human life.
5.2. Medical Sensors
The Internet of Things can be really beneficial for health care applications. We can use sensors, which can measure and monitor various medical parameters in the human body . These applications can aim at monitoring a patients health when they are not in hospital or when they are alone. Subsequently, they can provide real time feedback to the doctor, relatives, or the patient. McGrath and Scanaill  have described in detail the different sensors that can be worn on the body for monitoring a persons health.
There are many wearable sensing devices available in the market. They are equipped with medical sensors that are capable of measuring different parameters such as the heart rate, pulse, blood pressure, body temperature, respiration rate, and blood glucose levels . These wearables include smart watches, wristbands, monitoring patches, and smart textiles.
Moreover, smart watches and fitness trackers are becoming fairly popular in the market as companies such as Apple, Samsung, and Sony are coming up with very innovative features. For example, a smart watch includes features such as connectivity with a smartphone, sensors such as an accelerometer, and a heart rate monitor (see Figure 4).
Another novel IoT device, which has a lot of promise are monitoring patches that are pasted on the skin. Monitoring patches are like tattoos. They are stretchable and disposable and are very cheap. These patches are supposed to be worn by the patient for a few days to monitor a vital health parameter continuously . All the electronic components are embedded in these rubbery structures. They can even transmit the sensed data wirelessly. Just like a tattoo, these patches can be applied on the skin as shown in Figure 5. One of the most common applications of such patches is to monitor blood pressure.
A very important consideration here is the context . The data collected by the medical sensors must be combined with contextual information such as physical activity. For example, the heart rate depends on the context. It increases when we exercise. In that case, we cannot infer abnormal heart rate. Therefore, we need to combine data from different sensors for making the correct inference.
5.3. Neural Sensors
Today, it is possible to understand neural signals in the brain, infer the state of the brain, and train it for better attention and focus. This is known as neurofeedback  (see Figure 6). The technology used for watching brain signals is called EEG (Electroencephalography) or a brain computer interface. The neurons inside the brain communicate electronically and create an electric field, which can be measured from outside in terms of frequencies. Brain waves can be categorized into alpha, beta, gamma, theta, and delta waves depending upon the frequency.
Based on the type of wave, it can be inferred whether the brain is calm or wandering in thoughts. This type of neurofeedback can be obtained in real time and can be used to train the brain to focus, pay better attention towards things, manage stress, and have better mental well-being.
5.4. Environmental and Chemical Sensors
Environmental sensors are used to sense parameters in the physical environment such as temperature, humidity, pressure, water pollution, and air pollution. Parameters such as the temperature and pressure can be measured with a thermometer and barometer. Air quality can be measured with sensors, which sense the presence of gases and other particulate matter in the air (refer to Sekhar et al.  for more details).
Chemical sensors are used to detect chemical and biochemical substances. These sensors consist of a recognition element and a transducer. The electronic nose (e-nose) and electronic tongue (e-tongue) are technologies that can be used to sense chemicals on the basis of odor and taste, respectively . The e-nose and e-tongue consist of an array of chemical sensors coupled with advance pattern recognition software. The sensors inside the e-nose and e-tongue produce complex data, which is then analyzed through pattern recognition to identify the stimulus.
These sensors can be used in monitoring the pollution level in smart cities , keeping a check on food quality in smart kitchens, testing food, and agricultural products in supply chain applications.
5.5. Radio Frequency Identification (RFID)
RFID is an identification technology in which an RFID tag (a small chip with an antenna) carries data, which is watch by a RFID watcher. The tag transmits the data stored in it via radio waves. It is similar to bar code technology. But unlike a traditional bar code, it does not require line of sight communication between the tag and the watcher and can identify itself from a distance even without a human operator. The range of RFID varies with the frequency. It can go up to hundreds of meters.
RFID tags are of two types: active and passive. Active tags have a power source and passive tags do not have any power source. Passive tags draw power from the electromagnetic waves emitted by the watcher and are thus cheap and have a long lifetime [40, 41].
There are two types of RFID technologies: near and far . A near RFID watcher uses a coil through which we pass alternating current and generate a magnetic field. The tag has a smaller coil, which generates a potential due to the ambient changes in the magnetic field. This voltage is then coupled with a capacitor to accumulate a charge, which then powers up the tag chip. The tag can then produce a small magnetic field that encodes the signal to be transmitted, and this can be picked up by the watcher.
In far RFID, there is a dipole antenna in the watcher, which propagates EM waves. The tag also has a dipole antenna on which an alternating potential difference appears and it is powered up. It can then use this power to transmit messages.
RFID technology is being used in various applications such as supply chain management, access control, identity authentication, and object tracking. The RFID tag is attached to the object to be tracked and the watcher detects and records its presence when the object passes by it. In this manner, object movement can be tracked and RFID can serve as a search engine for smart things.
For access control, an RFID tag is attached to the authorized object. For example, small chips are glued to the front of vehicles. When the car reaches a barricade on which there is a watcher, it watchs the tag data and decides whether it is an authorized car. If yes, it opens automatically. RFID cards are issued to the people, who can then be identified by a RFID watcher and given access accordingly.
The low level data collected from the RFID tags can be transformed into higher level insights in IoT applications . There are many user level tools available, in which all the data collected by particular RFID watchers and data associated with the RFID tags can be managed. The high level data can be used to draw inferences and take further action.
Let us look at some examples of actuators that are used in the Internet of Things. An actuator is a device, which can effect a change in the environment by converting electrical energy into some form of useful energy. Some examples are heating or cooling elements, speakers, lights, displays, and motors.
The actuators, which induce motion, can be classified into three categories, namely, electrical, hydraulic, and pneumatic actuators depending on their operation. Hydraulic actuators facilitate mechanical motion using fluid or hydraulic power. Pneumatic actuators use the pressure of compressed air and electrical ones use electrical energy.
As an example, we can consider a smart home system, which consists of many sensors and actuators. The actuators are used to lock/unlock the doors, switch on/off the lights or other electrical appliances, alert users of any threats through alarms or notifications, and control the temperature of a home (via a thermostat).
A sophisticated example of an actuator used in IoT is a digital finger, which is used to turn on/off the switches (or anything which requires small motion) and is controlled wirelessly.
As smart things collect huge amount of sensor data, compute and storage resources are required to analyze, store, and process this data. The most common compute and storage resources are cloud based because the cloud offers massive data handling, scalability, and flexibility. But this will not be sufficient to meet the requirements of many IoT applications because of the following reasons .(1)Mobility: most of the smart devices are mobile. Their changing location makes it difficult to communicate with the cloud data center because of changing network conditions across different locations.(2)Reliable and real time actuation: communicating with the cloud and getting back responses takes time. Latency sensitive applications, which need real time responses, may not be feasible with this model. Also, the communication may be lossy due to wireless links, which can lead to unreliable data.(3)Scalability: more devices means more requests to the cloud, thereby increasing the latency.(4)Power constraints: communication consumes a lot of power, and IoT devices are battery powered. They thus cannot afford to communicate all the time.
To solve the problem of mobility, researchers have proposed mobile cloud computing (MCC) . But there are still problems associated with latency and power. MCC also suffers from mobility problems such as frequently changing network conditions due to which problems such as signal fading and service degradation arise.
As a solution to these problems, we can bring some compute and storage resources to the edge of the network instead of relying on the cloud for everything. This concept is known as fog computing [11, 45] (also see Section 2.2). The fog can be viewed as a cloud, which is close to the ground. Data can be stored, processed, filtered, and analyzed on the edge of the network before sending it to the cloud through expensive communication media. The fog and cloud paradigms go together. Both of them are required for the optimal performance of IoT applications. A smart gateway  can be employed between underlying networks and the cloud to realize fog computing as shown in Figure 7.
The features of fog computing  are as follows:(1)Low latency: less time is required to access computing and storage resources on fog nodes (smart gateways).(2)Location awareness: as the fog is located on the edge of the network, it is aware of the location of the applications and their context. This is beneficial as context awareness is an important feature of IoT applications.(3)Distributed nodes: fog nodes are distributed unlike centralized cloud nodes. Multiple fog nodes need to be deployed in distributed geographical areas in order to provide services to mobile devices in those areas. For example, in vehicular networks, deploying fog nodes at highways can provide low latency data/video streaming to vehicles.(4)Mobility: the fog supports mobility as smart devices can directly communicate with smart gateways present in their proximity.(5)Real time response: fog nodes can give an immediate response unlike the cloud, which has a much greater latency.(6)Interaction with the cloud: fog nodes can further interact with the cloud and communicate only that data, which is required to be sent to the cloud.
The tasks performed by a smart gateway  are collecting sensor data, preprocessing and filtering collected data, providing compute, storage and networking services to IoT devices, communicating with the cloud and sending only necessary data, monitoring power consumption of IoT devices, monitoring activities and services of IoT devices, and ensuring security and privacy of data. Some applications of fog computing are as follows [10, 11]:(1)Smart vehicular networks: smart traffic lights are deployed as smart gateways to locally detect pedestrians and vehicles through sensors, calculate their distance and speed, and finally infer traffic conditions. This is used to warn oncoming vehicles. These sensors also interact with neighboring smart traffic lights to perform traffic management tasks. For example, if sensors detect an approaching ambulance, they can change the traffic lights to let the ambulance pass first and also inform other lights to do so. The data collected by these smart traffic lights are locally analyzed in real time to serve real time needs of traffic management. Further, data from multiple gateways is combined and sent to the cloud for further global analysis of traffic in the city.(2)Smart grid: the smart electrical grid facilitates load balancing of energy on the basis of usage and availability. This is done in order to switch automatically to alternative sources of energy such as solar and wind power. This balancing can be done at the edge of the network using smart meters or microgrids connected by smart gateways. These gateways can analyze and process data. They can then project future energy demand, calculate the availability and price of power, and supply power from both conventional and alternative sources to consumers.