An Introduction to the Internet of Things PDF

Document Details

AbundantOmaha

Uploaded by AbundantOmaha

Mississippi Gulf Coast Community College

2020

Einar Krogh

Tags

internet of things embedded systems iot technology

Summary

This book provides an introduction to the Internet of Things (IoT). It covers topics such as embedded systems, sensors, and actuators, as well as the architecture and programming of IoT systems.

Full Transcript

 EINAR KROGH AN INTRODUCTION TO THE INTERNET OF THINGS 2 An Introduction to the Internet of Things 1st edition © 2020 Einar Krogh & bookboon.com ISBN 978-87-403-3224-7 Peer review by: Professor Øystein Haugen and doctoral research fellow Marius Geitle, Høgskolen...

 EINAR KROGH AN INTRODUCTION TO THE INTERNET OF THINGS 2 An Introduction to the Internet of Things 1st edition © 2020 Einar Krogh & bookboon.com ISBN 978-87-403-3224-7 Peer review by: Professor Øystein Haugen and doctoral research fellow Marius Geitle, Høgskolen i Østfold 3 AN INTRODUCTION TO THE INTERNET OF THINGS Contents CONTENTS Introduction 7 Part 1 Embedded Systems 8 1 Introducing Embedded Systems 9 1.1 What Is an Embedded System? 9 1.2 Real-time Embedded Systems 10 1.3 Embedded Systems Compared to Computers 11 1.4 Features of Embedded Systems 13 1.5 Robots and Embedded Systems 14 2 Use of Embedded Systems 16 2.1 Embedded Systems in Vehicles 16 2.2 Some Examples of Embedded Systems 19 4 AN INTRODUCTION TO THE INTERNET OF THINGS Contents 3 Sensors and Actuators 20 3.1 Transducers 20 3.2 Sensors 21 3.3 Some Sensors 23 3.4 Sensor Fusion 30 3.5 Actuators 31 3.6 Use of Actuators 33 4 Architecture of Embedded Systems 37 4.1 Hardware Architecture 37 4.2 Software Architecture 40 4.3 Operating System Architecture 43 4.4 Middleware 45 4.5 Some Operating Systems for Embedded Systems 47 5 Programming of Embedded Systems 49 6 Design of Embedded Systems 54 6.1 A Model for Embedded Systems 55 6.2 Standards of Embedded Systems 55 Part 2 The Internet of Things 58 7 What Is the Internet of Things? 59 8 Examples of the Internet of Things 62 9 Advantages and Disadvantages of the Internet of Things 72 10 How the Cloud Works 75 10.1 What Is the Cloud? 75 10.2 The Cloud Architecture 79 11 How the Internet of Things Works 83 11.1 The Main Components of the Internet of Things 84 11.2 A Model for the Internet of Things 85 12 Big Data and the Internet of Things 89 12.1 Big Data 89 12.2 Data Collection 91 12.3 Data Aggregation 91 12.4 Machine Learning in the Internet of Things 91 12.5 The Role of Data Analysis in the Internet of Things 92 13 Some Basic Technologies in the Internet of Things 95 5 AN INTRODUCTION TO THE INTERNET OF THINGS Contents 14 The Architecture of the Internet of Things 98 14.1 An Overview of the Internet of Things Architecture 98 14.2 Some Requirements for an IoT Architecture 101 14.3 IoT Platforms 104 14.4 A four-stage Architecture of an IoT System 105 14.5 IoT Gateways 109 14.6 Edge Computing 113 14.7 IoT Mesh Networking 118 15 IoT Communication 123 15.1 Some Central Protocols in the IoT 124 15.2 Some Wireless Connectivity Technologies 125 15.3 Types of IoT Communication 129 15.4 Some Communication Protocols Used in the IoT 135 16 Platforms for the Internet of Things 145 16.1 Some IoT Platforms 145 17 Wiring the Internet of Things 148 18 Internet of Things Security 150 18.1 Some Threats to IoT Security 151 18.2 Security Challenges 153 18.3 More Layers of IoT Security Are Needed 156 18.4 How to Secure the Internet of Things? 158 19 Design for the Internet of Things 161 19.1 Understand the Application 162 20 Statistics About the Internet of Things 164 20.1 The Size of the IoT 164 20.2 How Much Money Is Involved in the IoT? 165 20.3 What Is the Future of the IoT? 166 References 170 6 AN INTRODUCTION TO THE INTERNET OF THINGS Introduction INTRODUCTION This book is written for introductory courses on embedded systems and the Internet of Things (IoT). The book consists of two parts. The first part introduces embedded systems. Central topics are sensors, actuators, and the architecture of embedded systems. The second part of the book is about the IoT. It introduces the IoT, the architecture of the IoT, and important IoT technologies. Other topics are also included, such as cloud computing and big data in connection with the IoT. In the time to come, the IoT will have an increasing impact on our lives. The IoT is also very popular. Many predict that the IoT will be the next big digital revolution. I would like to thank Professor Øystein Haugen and Doctoral Research Fellow Marius Geitle for reading the manuscript of the book and for many suggestions. 7 AN INTRODUCTION TO THE INTERNET OF THINGS PART 1 EMBEDDED SYSTEMS 8 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems 1 INTRODUCING EMBEDDED SYSTEMS 1.1 WHAT IS AN EMBEDDED SYSTEM? An embedded system is a combination of hardware and software to perform a specific task. Allowing the software to control the hardware provides an opportunity for intelligent behavior and smart solutions. An embedded system consists of three main components: Hardware Application software Operating system An operating system is computer software that manages hardware and other software. While hardware and software are always included in an embedded system, there are exceptions when it comes to the operating system. Very simple embedded systems do not always have an operating system. Most embedded systems do not have a user interface for humans, but some may have a kind of user interface, such as a touch screen. There are also embedded systems that have quite complex user interfaces, such as mobile phones. Software for embedded systems is usually referred to as firmware. Instead of storing data on a hard drive as in computers, individual programs in an embedded system are normally stored on a chip and called firmware. Figure 1.1 The development of embedded systems has become much easier since the introduction of two platforms: Arduino and Raspberry Pi. The figure shows a Raspberry Pi 3 Model B. 9 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems Electronic equipment designed for the engineering market is classified as embedded systems. An embedded system is an electronic system that can be programmed to operate and organize one or more tasks. Embedded systems are an important part of today’s electronic industry. 1.2 REAL-TIME EMBEDDED SYSTEMS Real-time systems are computer systems that monitor, respond to, or control an external environment. The external environment is connected to an embedded system that often has sensors, actuators, and other interfaces. A real-time system must be able to respond to events in an external environment as soon as they happen. Another name for real-time systems is reactive systems because their primary purpose is to respond to events in the environment. An example in which a real-time system is necessary is a system with the task of reducing the speed of a car when there is something on the road. Then the car must brake immediately (in real time) if an accident is to be avoided. There are two important features of real-time embedded systems: Real-time embedded systems must perform flawlessly accurate calculations for events. Response to events must occur very quickly during a predefined time interval. In real-time systems in which real-time calculations are required with accurate results to be delivered within a short time span, the operating system usually plays an important role. With the growing complexity of the hardware in embedded systems, there is a need for an operating system that meets the system requirements and does not miss deadlines. 10 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems Household systems for monitoring and control of devices Systems for cars, subways, aircraft, railways, and ships Traffic control for motorways, airspace, railway tracks, and ship routes Medical systems for radiation therapy and patient monitoring Military applications such as firearms, tracking, command, and control Robot production systems Telephone, radio, and satellite communication Computer games Figure 1.2 Some examples of real-time systems. Real-time embedded systems are everywhere. Today’s systems range from regular car management systems and kitchen appliances to control systems for air traffic, military weapons facilities, and production line control, including robotics and automation. 1.3 EMBEDDED SYSTEMS COMPARED TO COMPUTERS Unlike computers that can be used to do many different tasks, embedded systems are most often designed to perform only one particular task, for example, regulating a traffic light. Many embedded systems are also real-time systems, which ordinary computers are not. Since embedded systems have only one specific purpose, they are more limited in hardware and software functionality than computers. In the case of hardware, this may mean less processing power, less power consumption, less memory, less hardware functionality, and so on. In terms of software, this limitation may mean fewer or simpler applications and no or a small operating system. Since embedded systems focus only on a particular task, they can be made cheaper and more efficient than computers. 11 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems Desktop computer Embedded system Runs different programs at different times Runs a single, dedicated application at all times. depending on the needs of the user. Has large amounts of (RAM) memory and Has sufficient memory but no excess. Adding disk space; both can be readily and cheaply more memory is difficult. expanded if required. All PCs have an essentially identical hardware Embedded systems are highly variable with architecture and run identical software. Software different CPUs, peripherals, operating systems, is written for speed. and design properties. Boot-up time may be measured in minutes, and Boot-up is almost instantaneous, measured in the operating system is loaded from disk and seconds. initialized. Figure 1.3 The table shows some differences between embedded systems and computers. Focusing on the differences between computers and embedded systems can give a description of what an embedded system is. A simple description of an embedded system is as follows: An embedded system is any data system found in hardware equipment that is not a computer. WORK AT THE FOREFRONT OF AUTOMOTIVE INNOVATION WITH ZF, ONE OF THE WORLD’S LEADING AUTOMOTIVE SUPPLIERS. ZF.COM/CAREERS 12 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems 1.4 FEATURES OF EMBEDDED SYSTEMS An embedded system is a system that has a specific purpose and performs either a single or only a few operations. An embedded system is often hardware equipment without any user interface. Typical properties of embedded systems are low power consumption and low cost. This often results in limited processing possibilities. An embedded system is a system that demands high quality and reliability. Embedded systems are often used in hardware that must function flawlessly for many years. Some embedded systems demand very high quality and reliability. For example, if the technical equipment used for an operation in a hospital breaks down, this could have life- threatening consequences, or if a system that controls a car fails on the highway, this can lead to an accident. Requirements Processing power Microcontrollers or microprocessors control embedded systems. The embedded operating system must be reliable and capable of running Operating system with restrictions on memory, size, time, and processing power. Computer programs designed for embedded systems are handled as Memory firmware and are stored in ROM or on flash memory chips. Power consumption is an important factor for any embedded battery- Power powered system. It is the amount of power consumption that determines consumption the life of the battery. Flexibility is the ability to change system functionality without extra costs. Flexibility Software is considered flexible if it can be updated with a new version at any time. Size An embedded system should preferably be as small as possible. An embedded system should be highly reliable for achieving good Reliability performance over its lifetime. Security If a system failure occurs, there should be no damage to the components. It is important that an embedded system can be repaired or replaced as Maintenance soon as possible, that is, within a specified time interval. Figure 1.4 Common features of embedded systems. 13 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems 1.5 ROBOTS AND EMBEDDED SYSTEMS A robot is a mechanical and programmed device that performs tasks to help people. In the old days, robots were controlled by large and expensive computer systems. Many of these robots were stationary because they were too heavy to be carried around. Mobile robots had to be connected to a computer via cables or wireless, but connection and response speed was problematic. The development of embedded systems has had great significance for robots because it has solved this problem. Figure 1.5 Example of an embedded system. The GoPiGo is a mobile robot car controlled by a Raspberry Pi card. The Raspberry Pi card contains program code controlling the robot’s movements (Dexter Industries). 14 AN INTRODUCTION TO THE INTERNET OF THINGS Introducing Embedded Systems A robot consists of three main components: 1. Sensors that provide feedback from an external environment 2. A mechanical unit (actuator) that can perform actions on the environment 3. An embedded system for communicating between a mechanical device and the sensory data Very few robots look like the metallic robots in science fiction. Any mechanism that has actuators, sensors, and a controller can be classified as a robot. The definition also includes units that we would not regard as robots, such as the block-free braking system of modern cars. Some types of robots Use Handling, welding, and inspection of materials, as well as improving Industrial robots productivity. Laboratory applications. A collaborative robot is a robot that can safely and effectively interact Collaborative robots with human workers while performing simple industrial tasks. Mobile robots Robots that move around on legs, tracks, or wheels. Educational robots feature learning platforms that are geared to Educational robots teaching robotics to children, students, and amateurs. Domestic robots Vacuum cleaners, floor-washing robots, ironing robots, etc. Use of robots for military combat. Smart missiles and autonomous Military robots bombs can be considered robots. Figure 1.6 The table shows some types of robots. 15 AN INTRODUCTION TO THE INTERNET OF THINGS Use of Embedded Systems 2 USE OF EMBEDDED SYSTEMS Embedded systems are found everywhere. For example, they can be found in washing machines, microwave ovens, and household appliances. Other examples are digital watches, toys, traffic lights, industrial robots, and agricultural machinery. Embedded systems are used in consumer electronics, including mobile phones, video game consoles, digital cameras, GPS receivers, and printers. Home automation uses embedded systems to control light, sound, climate, security, and monitoring. Embedded systems are used in transportation, fire protection, medical applications, and life-critical systems, as these systems can be isolated from hacking and are therefore more reliable. For fire protection, the embedded systems can be designed to have a greater ability to withstand higher temperatures and will therefore continue to function if there is a fire. Aircraft and car transport systems are increasingly using embedded systems. Modern aircraft include advanced technology that also has high-security requirements. 2.1 EMBEDDED SYSTEMS IN VEHICLES The use of advanced embedded systems in automobiles has increased rapidly in the past two decades. It is expected that by 2020, 90% of automobiles will be connected to the Internet. Every year, automobile manufacturers pack more embedded systems into their cars for different functionalities, such as ignition, security, and audio systems. The aim is to make the vehicle more efficient and safer. We shall look at some applications of embedded systems in cars. Adaptive Cruise Control If someone in the late 1900s had told us that there would soon come a new technology that would end car accidents, no one would have believed it. However, the situation is that embedded systems that support the driver make driving much safer. 16 AN INTRODUCTION TO THE INTERNET OF THINGS Use of Embedded Systems Many modern cars have an embedded adaptive cruise control (ACC) system. ACC is a control system for road vehicles that automatically adjusts the vehicle speed to maintain a safe distance from vehicles ahead. It determines the car’s speed using a braking system that takes into account the distance between the vehicle it is in and the vehicles in front. Such cars are usually equipped with radar or LIDAR (light detection and ranging) to determine distance. Lane Centering Lane centering, also known as auto steer, is a mechanism designed to keep a car centered in the lane, relieving the driver of the task of steering. Together with ACC, this feature may enable driving without a driver. Airbag Control System All modern cars have airbags to make driving safer. In order to inflate the airbags at the right time, you have an airbag control system. It detects a collision using a crash sensor and sends a signal to the airbags so that they are inflated. The entire process from start to finish takes 0.1 seconds. Anti-Lock Braking System (ABS) An anti-lock braking system (ABS) is designed to control vehicle braking in a way that gives less chance of slipping on slippery roads. An ABS operates by preventing the wheels from locking up during braking, thereby maintaining tractive contact with the road surface. It ensures better contact with the road by controlling brake pressure if a car begins to slip while braking. Other Uses of Embedded Systems in a Car Other uses of in-vehicle systems include the embedded navigation system, electronic stability control (ESCESP), the traction control system (TCS), tire air pressure control, automatic four-wheel drive, and electronic fuel injection. 17 AN INTRODUCTION TO THE INTERNET OF THINGS Use of Embedded Systems Figure 2.1 Today’s automobiles contain dozens of computer chips (Vintage Computer). 18 AN INTRODUCTION TO THE INTERNET OF THINGS Use of Embedded Systems 2.2 SOME EXAMPLES OF EMBEDDED SYSTEMS Embedded systems have become part of our daily lives. Figure 2.2 lists some examples of the use of embedded systems. Washing machines and dishwashers Lighting systems Refrigerators and freezers Vacuum cleaners Mobile phones Smartwatches and digital watches Air conditioners and thermostats Electric cookers and coffee machines Electronic parking meters and parking services CD, iPod and MP3 players Home security systems Fire alarms and carbon monoxide detectors Printers, copiers, fax machines, and scanners Digital cameras Electronic safes GPS navigation devices Heart rate monitors and pacemakers Wi-Fi routers Electronic toys Figure 2.2 Examples of the use of embedded systems. 19 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators 3 SENSORS AND ACTUATORS A sensor is a device that detects and responds to some type of input from the physical environment. Sensors sense; that is, they act as the eyes and ears of an embedded device and detect changes in the environment around them. Actuators are devices that accept a control command and produce a change in the physical system by generating force, motion, heat, flow, and so forth. You may say that actuators are the hands of embedded systems. Both sensors and actuators have many practical applications. 3.1 TRANSDUCERS A transducer is any physical device that converts one form of energy into another. Transducers that convert physical quantities into mechanical quantities are called mechanical transducers. Transducers that convert physical quantities into electrical quantities are called electrical transducers. The following are some examples of the actions of transducers: An electric motor converts electricity into mechanical energy or motion. A speaker converts electrical signals into sound waves. An incandescent lamp produces light by converting electrical energy into optical energy. A solar cell converts light into electricity. Transducers enable technical equipment to interact with the physical environment. A transducer must therefore have a processing unit and a communication interface. A sensor is a kind of transducer. A sensor transforms a physical phenomenon into an electrical impulse that can be used in a technological system. For example, a microphone is a transducer (sensor) converting sound waves into electrical signals. 20 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators 3.2 SENSORS Sensors are key components of the IoT. They are important in the work of monitoring processes, measurements, and data collection. A sensor is a device that detects events or changes in the environment and that sends information about them to another location, for example, a server or a web page. Most sensors are designed to measure a physical quantity and then to transform it into a digital value that can be read by humans or used by some data systems. The sensors are the reason why the IoT is constantly growing. There are many different types of sensors on the market, and they are used for various purposes that encompass all aspects of human life. Sensor technology is being developed faster and faster because of new discoveries in materials and nanotechnology. The result is increased accuracy, reduced size and cost, and the ability to measure or find values that have not previously been possible to capture. In fact, the sensor technology is developing so rapidly and becoming so advanced that we will see billions of new sensors in production annually within a few years. WHY WAIT FOR PROGRESS? DARE TO DISCOVER Discovery means many different things at Schlumberger. But it’s the spirit that unites every single one of us. It doesn’t matter whether they join our business, engineering or technology teams, our trainees push boundaries, break new ground and deliver the exceptional. If that excites you, then we want to hear from you. careers.slb.com/recentgraduates 21 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators The low price of most sensors helps keep the IoT expenses down and enables the use of embedded systems on a large scale. The IoT has changed the manufacturing industry, and sensors are central to the use of the IoT. Use of Sensors Sensors are widely used, and there are hundreds of different types of sensors. We have temperature sensors, flow sensors, voltage sensors, humidity sensors, and so on. For example, autonomous vehicles are full of sensor technology and have sensors to measure power, load, torque, motion, speed, displacement, position, vibration, and shock. Sensors used in production equipment in a factory can help identify bottlenecks in a manufacturing process. By tackling bottlenecks, factories can reduce waste of production time. Instead of standard preventive maintenance, which means machine maintenance, predictable maintenance involves using sensors to predict quite accurately when machines need maintenance. Sensors and actuators must be reliable. In complex embedded systems, a fault in a sensor or an actuator can trigger catastrophic events. Detection of sensor and actuator errors can be difficult, and it affects the performance of critical systems. Storage of Data From Sensors Deciding whether to store data from sensors locally or in the cloud is often a dilemma. There are advantages and disadvantages of both options. Speed is one of the main advantages of local storage. Storing data on external hard drives is faster than uploading to the cloud. You also have full control of your backups, which means better control of who accesses your data. Disconnecting the drives from the network protects your data against attacks. There are many advantages of backing up sensor data to the cloud. For one, it is cost- effective, and maintenance is not an issue as cloud storage providers handle all the upgrades and troubleshoot any issues that might arise. 22 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Another advantage of cloud storage is scalability. When you need to increase storage space, it is as simple as notifying your service provider. You can increase or decrease space as needed. Should a disaster occur on-site, your data will remain safe. Securing data remotely means that you do not have to worry about losing backups of your data. Accessibility is also a plus of cloud storage. Data stored in the cloud is easily accessed on any device that has an Internet connection. You can log into your cloud account, and your data is there when you need it. A disadvantage of cloud storage is security and privacy. There are concerns with valuable and important data being stored remotely. Before adopting cloud technology, you should be aware that you are giving sensitive information to a third-party cloud service provider, and this could potentially be a risk. Another disadvantage is lifetime costs. With public cloud storage, the price costs might increase over the years and tend to add up. At this point, the lifetime costs will hit you. If your applications are local and your data is in the cloud, then it can add to networking costs. 3.3 SOME SENSORS Sensors perform very different tasks, and each IoT system requires a specific type of sensor. We will look at some sensors and their use. Temperature Sensors This widely used sensor type measures the temperature or the heat of a given medium. There are several types of temperature sensors on the market. Temperature sensors are used in everything from simple thermostats to highly sensitive semiconductors that are capable of controlling complex processes. 23 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Proximity Sensors A proximity sensor is a sensor capable of determining the distance to a nearby object without having physical contact with the object. Proximity sensors use electromagnetic radiation or radar to detect movements or obstructions. Proximity sensors are good at detecting movement. They are a common component of equipment that involves safety, security, or efficiency. These sensors are therefore used in vehicles to detect obstacles in front of the vehicle when in motion. Proximity sensors are used in stores. Retailers use proximity sensors in their stores to investigate which goods customers get most close to and are most interested in. The data is processed and sent to the retailers’ mobile phones. Find and follow us: http://twitter.com/bioradlscareers www.linkedin.com/groupsDirectory, search for Bio-Rad Life Sciences Careers http://bio-radlifesciencescareersblog.blogspot.com John Randall, PhD Senior Marketing Manager, Bio-Plex Business Unit Bio-Rad is a longtime leader in the life science research industry and has been voted one of the Best Places to Work by our employees in the San Francisco Bay Area. Bring out your best in one of our many positions in research and development, sales, marketing, operations, and software development. Opportunities await — share your passion at Bio-Rad! www.bio-rad.com/careers 24 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Proximity sensors can be used in parking systems, museums, airports, etc. For example, parking sensors are proximity sensors designed for vehicles to alert the driver of obstacles when parking. A ground proximity warning system (GPWS) is a system to alert pilots if their aircraft is in immediate danger of flying into the ground or an obstacle. Motion Detector Sensors A motion detector is an electronic device used to detect physical motion in an area and to transform this motion, both movement of an object and movement of people, into an electrical signal. Motion detection plays an important role in the security industry. Companies use these sensors in areas where there never should be any movement at all. With these sensors installed, it is then easy to notice if anyone or anything is moving. They are used, for example, for intrusion detection, door control, automatic parking systems, automated sinks, toilet fans, hand dryers, and automated lighting. Although their primary use is now in the security industry, the number of possible applications of these sensors will only grow as the use of motion detection technology develops. LIDAR Light detecting and ranging (LIDAR) is a type of sensor that measures the distance to a target by measuring a laser pulse reflection on the target. LIDAR broadcasts laser energy. As a laser hits an object, some of the energy will be reflected back toward the LIDAR transmitter. This type of active sensing machine is also capable of analyzing anything that crosses its path. LIDAR is now used in automated and self-driving vehicles, robotics, surveillance, and agriculture. 25 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Pressure Sensors A pressure sensor is a device that senses pressure and converts it into an electrical signal. Pressure sensors are used to measure the pressure of a gas or liquid by converting the physical pressure into an electrical signal. They are also good at measuring other variables such as speed and height. Barometers and pressure gauges are the most popular pressure sensors used in IoT systems. Barometers help in weather forecasts, as they accurately measure the air nearby. Pressure gauges are used in industrial buildings, where they monitor the pressure in closed environments. Pressure sensors can be used in very different areas. For example, they are employed in touch screens and biological medical instrumentation, and they are used in the industry, for example, in the automotive industry. Water Quality Sensors Water quality sensors are used to estimate water quality and to monitor ions, primarily in water distribution systems. Water is used practically everywhere. These sensors therefore play an important role as they monitor the quality of water used for various purposes. They are in use in several industries. 26 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Optical Sensors Fiber optic sensor technology is used to detect electromagnetic energy such as light, electricity, and similar elemental particles. They can send, receive, and convert light energy into electrical signals. Fiber optic sensors are used in energy, healthcare, aviation, chemicals, and environmental IoT platforms. Optical sensors can be ideal for environments such as oil refining, mining operations, pharmaceutical production, and chemical treatment. We can expect high growth of fiber optic sensors as part of the increase in industrial applications in automation, as they are considered very suitable sensors for the IoT. 27 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Chemical Sensors Chemical sensors are used in several different industries. The goal of these sensors is to indicate changes in fluid or in the air. They play an important role in large cities, where it is necessary to record chemical changes to protect the population. An important use of chemical sensors is found in industrial environmental monitoring and process control, detection of intentionally or accidentally released harmful chemicals, detection of explosive and radioactive materials, space station recycling processes, pharmaceutical industries and laboratories, etc. Level Sensors A sensor used to determine the level or amount of liquids or other substances flowing in an open or closed system is called a level sensor. Level sensors measure the level of fluids. Level sensors can be used for smart waste management and recycling purposes. Other applications include measurement of tank levels, diesel meters, high- or low-level alarms, and irrigation control. Level sensors are also commonly used in fuel gauges and fluid-level detectors in open or closed containers, sea and tsunami monitoring, water reservoirs, medical equipment, compressors, hydraulic reservoirs, machine tools, beverage and pharmaceutical treatment, high- or low-level detection, etc. 28 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Infrared Sensors An infrared sensor is an electronic sensor that measures infrared (IR) light radiating from an object nearby. Infrared light has several applications. It can help doctors monitor the blood flow in humans, visualize heat leakage in houses, and identify environmental chemicals in the environment. IR sensors are now used in a variety of IoT projects, especially in healthcare systems as they facilitate blood flow and blood pressure monitoring. They are even used in several common smart devices, such as smartwatches and smartphones. Other common applications include household appliances and remote control, breathing analysis, IR visualization (i.e., visualizing heat leakage in electronics, monitoring blood flow, looking below the surface of paintings), usable electronics, optical communication, non-contact temperature measurements, and blind angle detection. IR sensors will play an important role in the smart-home industry, as they have a wide range of applications. Image Sensors Image sensors are devices used to convert images into electronic signals for display or storage to file. The large use of image sensors is found in digital cameras, medical imaging and night vision equipment, thermal imaging equipment, radar, and sonar. One of the most well-known uses includes the automotive industry, in which images play a crucial role. With these sensors, an automobile can recognize signs, obstacles, and many other things that a driver would generally notice on the road. They play a pivotal role in the IoT industry, as they directly affect the progress of self-driven cars. They are also used in security systems, in which images help to capture details of a perpetrator. 29 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators In the retail industry, these sensors serve to collect customer data and help businesses gain a better insight into who is visiting their stores. 3.4 SENSOR FUSION In the previous sections, we have seen that we can obtain information from many different sensors. If we get information about an event from more than one sensor, it may be an advantage to combine the different pieces of information. Sensor fusion is the combining of sensory data derived from disparate sensors such that the resulting information has less uncertainty than when these sources were used individually. Sensor fusion will reveal more about the context than a single sensor can provide. This is important in the IoT space, since a single thermal sensor, for example, has no notion of what causes a rapid thermal change. With time-correlated data from multiple sensors, processing can make better decisions based on more data. Choose a university where life is possible. Bachelor programmes in Business and Economics | Design and Humanities | Computer Science/IT | Natural Science Master programmes in Business and Economics | Computer Science/IT | Design and Humanities | Natural Science | Social and Behavioral Science | Technology and Engineering Summer Academy courses Ellen, Marketig, Master programme 120 credits 30 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators There are different methods for sensor fusion. Some of these methods use the central limit theorem (CLT), Kalman filters, or Bayesian networks. 3.5 ACTUATORS Actuators are transducers that work in the opposite direction of sensors. An actuator takes electrical signals and converts them into physical action. An example of an actuator is an electric motor that creates movement. An actuator is a mechanism that is responsible for moving or controlling something. An actuator requires a control signal and an energy source. The energy source may be electric current, hydraulic fluid pressure, or pneumatic pressure. When the control signal is received, the actuator responds by converting the energy into mechanical motion. Electric Actuators A motor that converts electrical energy into mechanical energy powers an electric actuator. It is a clean and easily accessible form of actuator because it does not directly use oil or other fossil fuels. Hydraulic Actuators A hydraulic actuator consists of a cylinder or fluid motor that uses hydraulic power to facilitate mechanical operation. The mechanical movement produces an effect that can be a linear, rotating, or oscillating motion. As liquids are difficult to compress, a hydraulic actuator can exert great force. 31 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Pneumatic Actuators Pneumatics is the utilization of energy by means of compression and expansion of gases. A pneumatic actuator converts energy generated by vacuum or compressed air into either a linear or a rotary motion. Pneumatic energy can react quickly at start and stop, as there is no need for a reserve power source for operation. Pneumatic actuators can produce considerable forces from relatively small pressure changes. Thermal or Magnetic Actuators Actuators that can be activated by thermal or magnetic energy have been used in commercial applications. Thermal actuators are often compact, lightweight, and economical, and they have high power. Mechanical Actuators A mechanical actuator works by converting some kind of motion, such as rotational motion, into another type of motion, such as linear motion. An example is a gear that runs around driving a vehicle moving straight ahead. The operation of mechanical actuators is based on combinations of structural components, such as gears and rails, or pulleys and chains. 32 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators 3.6 USE OF ACTUATORS Actuators are devices that convert some type of stored energy into motion. Embedded systems in electric motors can create movement. Electric motors convert electrical energy into mechanical energy so that they can perform environmental operations. This leads to the following definition: Types of equipment that can convert electrical energy into mechanical energy are called actuators By using an actuator, you get the opportunity to perform many different tasks, including robot control, activities at home such as watering flowers, camera control, unmanned aircraft, and 3D writing control. One task that electric motors are often used for is the generation of rotation around a fixed axis to drive wheels, pumps, belts, and robot arms, for example. There are three types of engines that are commonly used, namely servomotors, DC motors, and stepper motors. Striking a match, reconnecting with your family through Skype or over a phone network from Ericsson, refurnishing your apartment at IKEA or driving safely in your Volvo - none of this would be possible if not for Sweden. Swedish universities offer over 900 international master’s programmes taught entirely in English. Don’t just pick a place - pick a future. >studyinsweden.se 33 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Servomotors A servomotor is an actuator that enables precise control of position, speed, or acceleration. It consists of a motor that is connected to a sensor that provides feedback about the position. Servomotors are controlled by sending an electrical pulse that determines how large the movement is. Servomotors are small and extremely energy efficient. These features enable them to be used to control remote- or radio-controlled toy cars, robots, and aircraft. Servomotors are used in applications such as robotics, CNC machinery, or automated manufacturing. CNC (computer numerical control) is the automated control of machining tools (drills, boring tools, lathes) by means of a computer. Servomotors are also used in industrial applications, robotics, in-line manufacturing, pharmaceuticals, and food services. DC Motors A DC (direct current) motor converts electrical energy into mechanical energy. The DC motor is the most common actuator used in electronics projects. DC motors are used in many contexts from toys to advanced robots. They are ideal motors to use when there is a need for continuous rotation, as well as to drive the wheels of an electric vehicle. DC motors are cheap and easy to use. They also come in a large selection of sizes to accommodate different tasks. DC motors convert electrical energy into mechanical energy. The speed of rotation can be adjusted by the size of the power supply. Low power supply provides low rotation, and high power supply provides rapid rotation. 34 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Stepper Motors Stepper motors are DC motors that move with fixed steps. Stepper motors share a full rotation in a series of equal steps. The motor will rotate one-step at a time. Stepper motors rotate a certain angle such as 1.8 degrees. This means that each time it receives a power pulse; it will rotate 1.8 degrees. This allows Stepper engines to rotate quite accurately with a rotation error of less than 5%. With a computerized control, you can therefore achieve very precise positioning and/or speed regulation. Stepper motors therefore rotate in a different way than DC motors, which rotate continuously, based on the amount of power supplied. Linear Actuators A linear actuator is an actuator that creates movement in a straight line, as opposed to the circular motion of a conventional electric motor. Linear actuators are used in machine tools, in industrial machines, in peripherals such as disk drives and printers, in valves and dampers, and in many other places where linear motion is required. 35 AN INTRODUCTION TO THE INTERNET OF THINGS Sensors and Actuators Relays A relay is an electrically operated switch. Many relays use an electromagnet to operate a switch mechanically, but other operating principles are also used, such as solid-state relays. The advantage of relays is that it takes a relatively small amount of power to operate the relay coil, but the relay itself can be used to control motors, heating elements, lamps, or AC (alternating current) circuits that can themselves draw much more electrical power. Relays are used wherever it is necessary to control a high-power or high-voltage circuit with a low-power circuit, especially when galvanic isolation is desirable. INDEPENDENT DEDNIM LIKE YOU We believe in equality, sustainability and a modern approach to learning. How about you? Apply for a Master’s Programme in Gothenburg, Sweden. www.gu.se/education 36 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems 4 ARCHITECTURE OF EMBEDDED SYSTEMS An embedded system is made up of three components, as shown in Fig. 4.1. Hardware Software Operating System Figure 4.1 Main components of an embedded system. We will look at the architecture of each of these components. 4.1 HARDWARE ARCHITECTURE Embedded systems consist of electronic equipment placed on a circuit board. The main components of such a board are a processor, memory, data buses, and input and output devices. Two different architectures for how these components work together are the von Neumann architecture and the Harvard architecture. Von Neumann Architecture The von Neumann architecture is a way of designing computers in which both program instructions and data reside in the same memory device. The processor is separate from the memory device. The mathematician John von Neumann developed this type of architecture in 1945. He suggested an architecture consisting of the following components: 37 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems 1. A memory that should contain both data and instructions in binary form 2. A processing unit that could perform mathematical and logical operations 3. A controller that interprets instructions in memory and ensures that they are executed 4. Input and output devices that provide communication between user and control unit The von Neumann architecture supports simple hardware. It enables the use of a single memory. It also has a small memory (cache) near the processor. The von Neumann architecture is used in personal computers, laptops, and workstations. All modern computers use this architecture. Harvard Architecture The Harvard architecture uses different memory devices for program instructions and data. Instructions and data also use different data buses. This enables the processor to access both instructions and data at the same time. In a system with a pure von Neumann architecture, instructions and data are stored in the same memory, so instructions and data are retrieved over the same data bus. This means that a central processing unit (CPU) cannot read an instruction and perform data storage at the same time. In a computer that uses the Harvard architecture, the CPU can both read an instruction and perform a data storage access simultaneously. Using the Harvard architecture will thus be faster than using the von Neumann architecture. The Harvard architecture is used in digital signal processors and microcontrollers. Typical of microcontrollers is that they have little software and memory for data, and they benefit from the Harvard architecture for fast processing while simultaneously accessing instructions and data. Microprocessors and Microcontrollers Embedded systems are based on microprocessors or microcontrollers. Both types are designed to perform calculations. 38 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems Microprocessors have a slightly simpler construction than microcontrollers, since the microprocessor consists only of one CPU and thus requires the connection of other components as well as memory chips. Microprocessors are used in various areas of technology. For example, they are present in mobile phones. They are also used in MP3 players, refrigerators, microwaves, some remote controls, printing devices, GPS receivers, etc. Microcontrollers, on the other hand, are designed as independent devices. Microcontrollers have not only a CPU but also memory and external devices such as flash memory, RAM, or a serial communication port. The majority of microcontrollers in use today are embedded in other types of machinery, such as automobiles, robots, telephones, medical equipment, household appliances, and peripherals for computer systems. ARM Processors ARM is short for advanced RISC machine. RISC is an abbreviation for reduced instruction set computer. The ARM architecture is used in many products. The reason that the ARM processor has become a success is that it is small, is relatively inexpensive to produce, and has low power consumption. LIFE SCIENCE IN UMEÅ, SWEDEN – YOUR CHOICE! 32 000 students world class research top class teachers modern campus ranked nr 1 in Sweden by international students study in English – Bachelor’s programme in Life Science – Master’s programme in Chemistry – Master’s programme in Molecular Biology APPLY NOW! 39 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems ARM processors have low power consumption, making them well suited for use in portable devices. Almost all modern mobile phones and personal digital assistants contain ARM processors. This makes them the most widely used 32-bit microprocessor family in the world. ARM processors currently account for over 75% of all 32-bit embedded processors and are used in 98% of mobile phones sold every year. In tablets, ARM processors provide longer battery life because they use less power. ARM processors also produce less heat than larger Intel processors, enabling tablets to be thinner. While not as fast as Intel PC or portable processors, ARM processors still provide reasonable speed, especially for mobile computing. 4.2 SOFTWARE ARCHITECTURE An embedded system is usually designed to perform one specific task. Performing only one simple task does not require large resources. The software in an embedded system is therefore often designed for the following: 1. Little available memory 2. Low processor speed 3. Minimal power consumption Different embedded systems can be designed for very different tasks. Therefore, there are several types of software architecture for embedded systems. We shall look at different types of software architecture. Simple Control Loop In this design, the program consists of only a single loop. The loop calls a function that performs some task or another. This design is therefore called either a simple control loop or just a control loop. Interrupt-controlled System Some embedded systems are controlled by interrupts. This means that a specific event will call software that performs a task in the system. 40 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems This type of system is used if events need a short time to be executed and if event handling is simple. Usually, these systems run a simple task in the main loop as well, but this task can wait a little bit when an unexpected event occurs. Cooperative Multitasking A multitasking system resembles the simple control loop system, except that the program system is designed to perform multiple tasks, and each task has its own run environment. The advantages and disadvantages of collaborative multitasking are the same as for the control loop, except that it is easier to add new software. Pre-emptive Multitasking or Multithreading This type of system is using context switching, which switches threads in the processor. This system has an operating system kernel. Since code may damage data in another task, the programs must be carefully designed and tested. Shared data access must be synchronized with some kind of synchronization mechanism. Simple Operating System Kernel A microcore is a small and simple operating system core. The usual functioning is that the operating system kernel allocates memory and switches different running threads in and out of the CPU. Processes in user mode implement key functions such as file systems, network interfaces, etc. In general, microkernels succeed when the context switching and the communication are fast but fail if they are slow. Embedded Systems With a Large Operating System Core In this case, a relatively large operating system core is adapted to an embedded system. This gives programmers an environment similar to a computer operating system such as Linux or Microsoft Windows, which is therefore very suitable for development. The downside is that it requires significantly more hardware resources. It is often more expensive, and the complexity of these cores can lead to less predictability and reliability. 41 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems Examples of embedded operating system core are Embedded Linux and Windows IoT. Despite the increased cost of hardware, this type of embedded system grows in popularity, especially on the more powerful embedded devices such as wireless routers and GPS navigation systems. Additional Software Components In addition to the core operating system, many embedded systems have additional components in the upper layer. These components consist of network protocols such as TCP/IP, HTTP, HTTPS, FTP, and CAN. They can also contain storage functions such as FAT and have flash memory systems. If the embedded device has audio and video features, the current drivers will be present in the system. As far as the monolithic cores are concerned, many of these components are included. 42 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems 4.3 OPERATING SYSTEM ARCHITECTURE An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. If you want to make an embedded system, it must have an operating system. Very simple embedded systems can do without an operating system, but it is rare for embedded systems not to have an operating system. Often, embedded systems use operating systems designed specifically for embedded use. For example, all mobile phones use an operating system made for mobile phones. The operating system handles the user interface and all the basic functions of the phone. An embedded operating system is designed to be efficient and reliable. Efficiency often comes at the expense of losing some functionality. An embedded operating system has fewer features than a standard computer operating system. The embedded operating system is often adapted to the embedded system. Often, many of the usual operating system components are removed, as they are not needed. The hardware that runs an embedded operating system is often limited in terms of resources such as memory. The operating systems often have a limited task adapted to run a particular program that performs a particular operation. In order to take advantage of the processing power of the CPU, software developers often implement critical code they write into the operating system. This machine-efficient language can potentially result in better speed and performance at the expense of portability and maintenance. Embedded operating systems are most often written in a system programming language such as C. An embedded operating system can either be an operating system designed specifically for the embedded device, or it can be one of the many operating systems adapted to run on top of an embedded system. Common embedded operating systems include Symbian, Windows Phone, Windows IoT, and Linux. Embedded Operating Systems vs. Computer Operating Systems An important difference between most embedded operating systems and computer operating systems is that the software of an embedded operating system is part of the operating system, often so that the entire software is only a single executable. Often, the system can run only a single program. Unlike PC operating systems, embedded operating systems are unable to load and execute various applications. 43 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems Since embedded operating systems often run only one application, hardware has little memory, and a slow CPU is typically used. Embedded operating systems are typically programmed in machine language to optimally benefit from the limited computing resources. This means that the operating system is adapted to the hardware for which it was designed, and this operating system will not be compatible with other hardware systems with other configurations. Commercial Operating Systems There are many operating systems on the market. These operating systems have both advantages and disadvantages compared with free operating systems. There are many commercial real-time operating systems, and many are from well-established and reputable suppliers. However, buying one of these systems is something that should be carefully considered. The company’s size, product quality, and use are important factors. An important requirement is the possibility of technical support. When buying an operating system, both the buyer and the seller make a long-term commitment. One side of the relationship is the consideration of possible CPU migration in the future. A well-established provider of real-time operating systems can deliver new versions of the operating system, and their product is probably designed to simplify upgrades. Good documentation is important and can be expected from a commercial real-time operating system vendor. One disadvantage of commercial operating systems is that, technically, each embedded system is different. CPU, memory, and external devices vary from device to device. Moreover, the operating system must fit the embedded system. Commercial operating systems also require licenses. Free Operating Systems Free operating systems are often easily downloadable real-time operating systems that are quite popular. Linux is not a completely free operating system because a supported version of Linux is not free. However, a supported and packaged version of Linux is something most embedded developers are likely to spend money on. 44 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems The advantage of free operating systems is that you do not have to pay anything for the operating system, nor will you have to do so later, as there are no license fees. Free operating systems often include the source code, which is useful for reference as the documentation may be limited and it may be difficult to get support later. It is also a requirement for the configuration and transfer to a new hardware environment. A disadvantage of free operating systems is that implementing an operating system on an embedded device is a long-term commitment, so the issue of long-term support is important. For a free operating system, you cannot rely on long-term support. 4.4 MIDDLEWARE Middleware is software that can be defined as any type of system software that is not part of the operating system kernel, the device drivers, or the user applications. However, although middleware is not part of the operating system, some operating systems can integrate middleware into the operating system. HUNGRY FOR SOMETHING NEW? GET GROWING WITH LIDL We’re one of Europe’s largest retailers coming to the U.S. Apply today at careers.lidl.com 45 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems In an embedded system, middleware is system software that is usually located either on device drivers or on top of the operating system, and it can sometimes be part of the operating system itself. Applications Middleware Operating System Device Drivers Memories and Peripherals Figure 4.2 The embedded systems architecture. Middleware is usually software that lies between applications and the core or driver software. Middleware can also be software that serves other software. More specifically, middleware is an abstraction layer commonly used on embedded systems with two or more applications to provide flexibility, security, portability, connectivity, interconnection, and application collaboration mechanisms. An important advantage of using middleware is that it can reduce the complexity of the applications by centralizing the software infrastructure. However, using middleware in a system can affect scalability and performance. In short, middleware affects the embedded system in all layers. There are many different types of middleware, but most types of middleware usually fall under one of the two following general categories: General-purpose middleware Market-specific middleware General-purpose middleware is usually implemented in a variety of devices, such as network protocols, file systems, or virtual machines. Market-specific middleware is unique to a particular family of embedded systems, such as a digital TV standard-based software that sits on an operating system or virtual machine. 46 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems 4.5 SOME OPERATING SYSTEMS FOR EMBEDDED SYSTEMS The following are some operating systems designed for embedded systems. Linux Linux can be used as an operating system in embedded systems. The benefits of using Linux as the basis for an embedded operating system include the following: supplier independence, low cost, open source, and hardware support. Windows IoT Windows 10 IoT Core is built for small, secure smart devices and supports ARM processors. With all the power of Windows, Windows 10 IoT shares all the benefits of developing Windows systems worldwide. TinyOS TinyOS is an embedded operating system and a platform for wireless devices that use low power. It is an open-source operating system, BSD licensed for low-power wireless devices. It is used in sensor networks, personal networks, smart buildings, and smart meters. The developer is TinyOS Alliance. Contiki Contiki is an operating system for network-based systems focusing on low energy used in wireless devices in the IoT. The open-source operating system is highly portable and supports multitasking for embedded systems in memory-efficient networks and in wireless sensor networks. Contiki is designed to run on types of hardware devices that are severely constrained in memory, power, processing power, and communication bandwidth. The developer is Adam Dunkels. Mantis Mantis is a multithreaded embedded wireless sensor network operating system. It is an open- source, multithreaded operating system written in C for wireless sensor network platforms. A simple C API enables Mantis operating systems to provide simplified programming of wireless sensor nodes. 47 AN INTRODUCTION TO THE INTERNET OF THINGS Architecture of Embedded Systems Nano-RK Nano-RK is a fully pre-emptive real-time operating system (RTOS) with network support for use in wireless sensor networks. Nano-RK supports fixed-priority multitasking to ensure that task times are met, along with support for the CPU, network, and sensors and actuators. Tasks can specify resource needs, and the operating system provides timely, guaranteed, and controlled access to CPU cycles and network packets. The developer is Carnegie Mellon University. LiteOS LiteOS is an open and interactive Unix-like operating system designed for wireless sensor networks. With the tools provided with LiteOS, you can operate one or more wireless sensor networks in a Unix-like manner, transfer data, install applications, retrieve results, or configure sensors. You can also develop applications for nodes and distribute such programs wirelessly to sensor nodes. LiteOS is open source, and the developer is Huawei Technologies Co., Ltd. 48 AN INTRODUCTION TO THE INTERNET OF THINGS Programming of Embedded Systems 5 PROGRAMMING OF EMBEDDED SYSTEMS The following sections describe some programming languages that are popular in the programming of embedded systems. Many embedded systems are written in C or C++. C is a good choice for embedded system development. C combines the low-level functionality of an assembly language very neatly with modern-day programming conventions. In C, porting embedded programs across different devices is much easier than in most other languages. It can be used on almost any existing advanced embedded system platform. C++ is an object-oriented language based on C. If you want to develop slightly larger program systems, C++ may be preferable to C. The ability to use overloaded functions and constructors makes C++ an ideal choice for embedded systems programming. The object- oriented nature of C++ enables developers to program even the most complex embedded systems without overflowing the memory. Embedded C++ Embedded C++ is a subset of the C++ programming language aimed at making embedded systems. The language includes only the parts of C++ that are used heavily in the embedded systems community and omits key C++ features such as exception handling, multiple inheritances, namespaces, templates, and virtual base classes. Any standard C++ compiler can be used to compile embedded programs written in Embedded C++. Embedded C++ tries to avoid excessive memory consumption by removing most C++ core functionalities that are not exclusively used in embedded systems programming. 49 AN INTRODUCTION TO THE INTERNET OF THINGS Programming of Embedded Systems Python Python has gradually become popular with embedded systems. Python is in many ways a flexible language. What makes Python good for programming is its good readability. The design specifications for the language emphasize the importance of readable code and compact, elegant syntax. Python may not be as useful for embedded programming as C or C ++, but with many available libraries, it is easy to implement functions. It is excellent for the automation of testing and data collection and analysis. Java is widely used to develop embedded systems. Java is an object-oriented language that is highly portable. Java makes it much easier to write extensible, portable, and downloadable embedded systems applications. A wide array of developer tools and powerful libraries make Java a suitable choice for embedded systems programming. Go was developed by Google and is available for a variety of processors and platforms. Go is an open-source programming language that makes it easy to build simple, reliable, and efficient software. Go comes with built-in features for unit testing, thus making testing your embedded application very easy. The rich API documentation of this embedded systems programming language is beneficial for both new and veteran developers alike. Go adds an explicit hash table type, as well as types that can be very useful for collecting data from and sending data to separate sensors and actuators. The ability to process a network of sensors and devices is supported. 50 AN INTRODUCTION TO THE INTERNET OF THINGS Programming of Embedded Systems JavaScript Programmers who make software for embedded systems are often familiar with scripting. They can often choose a scripting language because it is a fast way to solve problems. JavaScript sounds like a variant of Java, but it is very different from Java. The two languages​​ are similar in that there are, for example, some libraries that can be used by both, but the languages ​​are developed separately and share no syntax or semantics. The massive array of developer tools and third-party libraries makes JavaScript a suitable choice for developing fast and reliable embedded software. The event-driven, functional programming paradigm employed by JavaScript can be utilized to build stable embedded systems easily. 51 AN INTRODUCTION TO THE INTERNET OF THINGS Programming of Embedded Systems B# is a small, object-oriented programming language designed to run multiple threads. B# is designed specifically for small embedded systems. B# is similar to C#, but many of the features of C# that are not required for embedded projects are removed from B#. B# was designed from the ground up as a small, highly efficient embedded control language. B# supports real-time control features. The embedded virtual machine allows B# to run on a variety of platforms. It uses only 24K memory, much less than what is needed for many of the other languages ​​used. C# is widely popular for building enterprise software. However, this innovative programming language is also used heavily for developing embedded systems for industrial purposes. With its strongly typed, component-oriented programming style, C# encompasses many useful features for embedded systems programming. Moreover, as Microsoft maintains this embedded systems programming language, you can easily find tons of documentation on this language. Rust Rust is one of the most modern programming languages being used to develop embedded systems. Rust combines the benefits of low-level languages ​​such as C and C ++. From small microcontrollers to powerful single-board computers, Rust allows you to port your embedded system’s code easily across a wide range of systems. Rust offers great community support. 52 AN INTRODUCTION TO THE INTERNET OF THINGS Programming of Embedded Systems Forth Forth is a language designed and optimized for embedded system programming. It is a stack-oriented language and is primarily used for system-level programming. A language that has existed since the 1970s, Forth is still used today in many embedded systems (small computerized devices) because of its portability, efficient memory use, short development time, and fast execution speed. Verilog Verilog is an HDL (hardware description language) for developing electronic devices such as embedded systems. This is a widely used language in the field of embedded systems programming and offers very low-level access to system hardware. You can access and control almost every hardware-specific detail by incorporating this language into your embedded systems development. Assembler Machine code is the most basic code that can be used by the processor unit. The code is normally in hex code and provides basic instructions for each operation of the processor. This type of code is rarely used for embedded systems these days. Writing in machine code is very laborious and time-consuming. It is difficult to understand, and it is difficult to search for errors in the code. To overcome this, high-level programming languages such as C, C ++, etc., are often used. When you want to keep your project as compact as possible, Assembler is the language you want to choose. Assembler offers a way to pack and build clean machine code that is ultimately done by the processor. The advantage is that an expert can use optimizing tricks that are not available in any other programming language. 53 AN INTRODUCTION TO THE INTERNET OF THINGS Design of Embedded Systems 6 DESIGN OF EMBEDDED SYSTEMS Every embedded system has an architecture. This is because an embedded system is composed of different components that work together, both software and hardware. An architecture consists of these components and the relationship between them. If you want to design an embedded system, you must be familiar with the architecture of the equipment you want to create. Understanding the architecture of an embedded system is necessary for making a good system design. It is important to plan the design for embedded systems to avoid mistakes or an expensive result. If you want to develop an embedded system, you must think about the following issues: The process of designing the system Equipment required System limitations with regard to processing power, memory, battery life, etc. The reliability and safety of the system The cost of the system Market and sale opportunities. 54 AN INTRODUCTION TO THE INTERNET OF THINGS Design of Embedded Systems All elements of an embedded system must interact with each other. Without understanding this interaction, it will be difficult to understand how the embedded system will behave under different conditions in the real world. 6.1 A MODEL FOR EMBEDDED SYSTEMS All embedded systems are based on the model shown in Fig. 6.1. Software layer System software layer Hardware layer Figure 6.1 A model for the architecture of embedded systems. This model is a layered model that represents the architecture of an embedded system. Not all embedded systems have all these layers, but the hardware layer is always included. The hardware layer contains the physical components that are part of an embedded system. 6.2 STANDARDS OF EMBEDDED SYSTEMS Some of the key components of embedded systems are made by specific procedures called standards. Standards dictate how components should be made and which other components the system needs to function satisfactorily. The Institute of Electrical and Electronics Engineers (IEEE) is a professional association for electronic engineering and electrical engineering. The IEEE Standards Association (IEEE SA), a globally recognized standards-setting body within the IEEE, develops consensus standards through an open process that engages industry and brings together a broad stakeholder community. IEEE standards set specifications and best practices based on current scientific and technological knowledge. The IEEE SA has a portfolio of over 1,250 active standards and over 650 standards under development. 55 AN INTRODUCTION TO THE INTERNET OF THINGS Design of Embedded Systems Standards can determine the functionality of all the three layers in the model for the architecture of an embedded system. Standards can be classified as market-specific standards, general-purpose standards, or a combination of the two. Most market-specific standards, except network and some TV standards, are often made for special groups of embedded systems. General-purpose standards, however, are often made for a market of embedded systems. Programming language standards are an example of general-purpose standards. A programming language can be used in various embedded systems. Network functionality standards can be implemented in all equipment that uses network communication. Standards classified as market-specific standards define a functionality that belongs to a particular group of embedded systems. Some examples of market-specific standards are the following. Consumer Electronics This group includes equipment used by consumers, such as PDAs, TVs, games, toys, home appliances such as microwave ovens, dishwashers, and washing machines, and Internet- enabled equipment. Medical Equipment Medical equipment is defined as instruments, apparatus, devices, and articles used alone or in conjunction with any other software included. These are equipment that can be used for diagnosis, prevention, reading, treatment, or control of the physical condition of patients. 56 AN INTRODUCTION TO THE INTERNET OF THINGS Design of Embedded Systems Industrial Automation and Control This group includes robotic equipment such as sensors, controllers of movement, human/ machine communication equipment, and industrial switches. Networking and Communication This is equipment that connects endpoints in networks, routers, hubs, and switches. This category also includes equipment used for audio/video transmissions. GET GROWING WITH LIDL US JOIN OUR TEAM TODAY We’re one of Europe’s largest retailers coming to the U.S. Apply today at careers.lidl.com 57 AN INTRODUCTION TO THE INTERNET OF THINGS PART 2 THE INTERNET OF THINGS 58 AN INTRODUCTION TO THE INTERNET OF THINGS What Is the Internet of Things? 7 WHAT IS THE INTERNET OF THINGS? When embedded systems were connected to the Internet on a large scale, this led to something that we today call the Internet of Things (IoT). The IoT means that any embedded device connects to the Internet so that it can communicate with other devices connected to the Internet without people being involved. We can define the IoT as a network of connected devices in which each device has an IP address and embedded technology that enables it to communicate with other devices over the Internet. The IoT is a scenario in which objects, people, or animals are equipped with unique IP addresses so that they can transfer data over a network without people being involved in the communication. The IoT is a gigantic network of connected things and people. It includes an extraordinary number of objects of all shapes and sizes: from smart microwave ovens that automatically cook at the right time, to self-driving cars that have sensors that detect obstructions in front of them, to portable exercise devices that measure your heart rate and the number of steps you have taken that day and then use this information to suggest training plans tailored to you. A thing in the IoT can be something as different as a ceiling light, a human with a heart monitor, a refrigerator that alerts when goods run out, a jet engine filled with thousands of sensors that collect and send data, or a car that has built-in sensors to alert the driver when other cars or objects come too close. The IoT consists of hardware devices that are equipped with electronics, software, sensors, actuators, and a network that enables the devices to communicate with each other. Almost all possible physical devices can be connected to the Internet. What makes the IoT possible is the development of wireless technologies, microelectromechanical systems, and the Internet. Thanks to cheap processors and wireless networks, it is possible to make everything from shoes to airplanes part of the IoT. This enables devices that otherwise would be unintentional to get digital intelligence so that they can communicate with each other without people being involved. The IoT will bridge the gap between the physical and digital world to improve the quality and productivity of people, communities, and industries. 59 AN INTRODUCTION TO THE INTERNET OF THINGS What Is the Internet of Things? How the Internet of Things Is Built The following are the main components of the IoT: A thing A local network The Internet The cloud A thing contains an embedded system that transmits and receives information over a network for the purpose of controlling another device or communicating with a user. A thing in the IoT has one or more of the following components: A unique Internet address connection A communication device that can send and receive messages Built-in computer software that can perform information processing One or more sensors An actuator that can perform actions in the physical environment In order for something to become a thing in the IoT, we must add some or all of the features mentioned above. This means that a chair, a refrigerator, or a lamp must contain an embedded system to become a thing in the IoT. A key component of a thing in the IoT is a microcontroller or microprocessor that can execute software instructions. Another key component is the IPv6 protocol that will have a central role in managing all the things that are and will be connected to the Internet. It is estimated that by 2020, 20 billion things will be connected to the Internet. Machine-to-Machine Communication The IoT is based on machine-to-machine (M2M) communication. M2M communication refers to direct communication between physical devices using any means of communication, including wired and wireless communication. 60 AN INTRODUCTION TO THE INTERNET OF THINGS What Is the Internet of Things? M2M communication and the IoT both deal with machines that communicate with each other, but there is a small difference between M2M communication and the IoT. M2M communication has traditionally been communication between two specific machines. The IoT, on the other hand, is equipment that communicates using an IP network and can thus communicate with any embedded device and computer connected to the Internet. Common applications for M2M communication have been the traffic control system, telemedicine, company security, and telemetry. M2M communication has been used in traffic control. In a typical traffic control system, there are sensors used to monitor the speed and size of traffic. This information is sent to computers that control the traffic. With such incoming data, M2M communication can regulate traffic flow. 61 AN INTRODUCTION TO THE INTERNET OF THINGS Examples of the Internet of Things 8 EXAMPLES OF THE INTERNET OF THINGS The IoT is used in many contexts, and its use only increases. In particular, IoT technology is used in smart homes, smart cities, connected cars, connected portable assets, and associated healthcare. Market Use Smart homes Heating, ventilation, air conditioning, lighting control, etc. Wearables Smartwatches that provide information about the user’s health Smart cities Parking, health, pollution, traffic jams, lights, etc. Connected cars Operation, maintenance, brake control, finding parking spaces IoT in agriculture Soil moisture, fertilizer, control, etc. Smart retail Finding the best item placement for goods in a store Energy connection Discovering power outages faster IoT in healthcare Providing information about people’s health IoT in poultry and Smart farming agriculture Smart surroundings Fire detection, air quality, earthquake detection Figure 8.1 The table gives some examples of the use of the IoT. Smart Homes It will be nice to be able to turn on the air conditioning before you get home, to turn the light off automatically after you leave a room, or to unlock the door of your apartment to others for temporary access, even when you are not at home. The IoT can make life easier and more convenient for people. Smart homes are currently popular. Embedded systems can be used extensively in the home, and it is in the home that most people probably encounter things connected to the Internet. This is a use of the IoT for which the major technology companies compete hard, especially Amazon, Google, and Apple. 62 AN INTRODUCTION TO THE INTERNET OF THINGS Examples of the Internet of Things Smart homes have become a success, and it is predicted that smart homes will soon be as common as mobile phones. The cost of owning a house can be a huge expense. The use of IoT technology in the home can save money, time, and energy. Smart homes use more or less automated and intelligent features that will contribute to lower energy consumption, better comfort, easier operation, and a higher level of safety. Smart homes often use different control systems for light, heat, refrigerator, fire protection, burglary protection, and ventilation. From your mobile phone, you can control light, heat, power consumption, blinds, garage door, exterior door, camera, ventilation, sound, and pictures in your home. Smart homes can help older people live longer in their own homes instead of having to move to homes for the elderly. IoT equipment makes it easier for family and caregivers to communicate with them and monitor them. Using the IoT as an aid provides a better understanding of how our homes work, and it enables you to save energy, for example, by cutting down on heating costs. Example Use Light control system You can turn on/off lights in your apartment from your mobile phone. Heating Smart thermostats can reduce monthly energy consumption by up to 30%. Checking that the oven is switched Smart outlets can turn on/off any plugged device in your off living room via the Internet. Air quality You can monitor the air quality of your home and the level of pollution in the city. Monitoring an elderly family Wireless sensors are placed around the home so that you member can follow a person’s daily routine. Monitoring a baby Parents are provided with information about a baby’s breath, skin temperature, body position, and activity level on their smartphone. Avoiding sudden infant death syndrome (SIDS). Keeping your plants alive Watering and grooming plants based on their actual growing needs and conditions saves time and resources. Figure 8.2 The table gives some examples of the use of the IoT in homes. 63 AN INTRODUCTION TO THE INTERNET OF THINGS Examples of the Internet of Things Wearables Wearables have become popular. Wearables in the form of activity gauges, sports watches, and smartwatches make it easy to track your health, chart how active you are, and set personal goals for your physical exercise. With an action camera mounted on your body, it is easy to film what you see wherever you are and what you experience. Figure 8.3 Smartwatches have been designed to integrate themselves into every moment of the wearer’s life, whether awake or asleep; they record heartbeats, sleep patterns, and workouts, among other aspects. Wearables have experienced an explosive demand worldwide. Companies such as Apple, Google, and Samsung have invested heavily in building such devices. Wearables are installed with sensors and software that collect data and information about the user. This data is later pre-processed to extract important information about the user. The prerequisite for such IoT technologies to provide useful applications is that they are energy efficient and have a small size. Smart Cities Smart cities are an interesting application of the IoT. Smart monitoring, automated transport, smarter energy management systems, water distribution, city security, and environmental monitoring are all examples of the IoT used in smart cities. By spreading many sensors over a city, the authorities will get a better idea of what​​ is happening in real time. As a result, smart city projects are a key element of the IoT. Cities already generate large amounts of data from security cameras and environmental sensors and already contain large infrastructure networks used for some form of control, such as control of traffic lights. 64 AN INTRODUCTION TO THE INTERNET OF THINGS Examples of the Internet of Things Smart Home Smart Buildings Smart Energy Smart Smart Street Smart Parking Environment Lights Traffic Waste Air Pollution Management Management Intelligent Electric Vehicle Public Safety Shopping Charging Figure 8.4 Some uses of the IoT in smart cities. The IoT will solve major problems for cities, such as pollution, traffic congestion, lack of energy supply, and so on. For example, sensors with mobile communication enable you to send alerts to municipal services when a trashcan can be emptied. By installing sensors and using web applications, citizens can find available parking spaces throughout the city. The sensors can also detect general errors or any type of problem in the city system. If it really matters, make it happen – with a career at Siemens. siemens.com/careers 65 AN INTRODUCTION TO THE INTERNET OF THINGS Examples of the Internet of Things Smart cities span several applications, from environmental monitoring to water distribution, waste management, traffic management, and city security. The popularity of smart cities is driven by the fact that many smart city solutions promise to reduce the problems of people living in cities. IoT solutions in smart cities reduce noise and pollution, solve traffic congestion problems, and help make cities safer. Sensors can help the elderly in daily life, while others can keep track of whether a beach has become too crowded and then offer swimmers another option. Other examples are monitoring infrastructures such as roads, bridges, and railways with sensors to investigate structural changes such as cracks and tiles. The ability to understand better how a city works should enable governments to make changes and monitor how these improve citizens’ lives. Example Use Smart parking Monitoring of available parking space in a city Structural health Monitoring of vibrations and material fat

Use Quizgecko on...
Browser
Browser