IoT Tutorial: Birth of IoT

Let me begin the IoT instruction by presenting the individual who coined the word “Internet of Things.” In a lecture to Proctor & Gamble in 1999, Kevin Ashton invented the word “The Internet of Things” (IoT). He is a co-founder of the Auto-ID Lab of MIT. He developed RFID for the supply chain management domain (used in the bar code detector). He also founded Zensi, an energy sensing and technology tracking firm.

Let me bring you first through Kevin Ashton’s quote, which he wrote for RFID in 2009. This helps you to understand IoT from its heart.

If we had pcs that knew all about stuff — using information collected without any assistance from us — we could monitor and count everything, and cut waste, loss and costs considerably. We would know whether things needed to be replaced, repaired or remembered and whether they were fresh or past.

In order to see, hear and sense the world for themselves in all its random glory, we need to empower pcs with our own means of collecting data.

The above quote from Kevin would have provided you with an idea of the ideologies behind the IoT growth. Let’s attempt to simplify this word further now and basically comprehend IoT. We will then move forward and look to the advantages of IoT.

IoT Tutorial: Introduction to IoT

The ‘ Thing ‘ in IoT can be any device with any type of integrated sensors capable of capturing and transferring information over a network without any manual interaction. The integrated technology in the item enables them to communicate with inner and external states, which in turn enables them to take a decision on the process.

In short, IoT is a notion which links all devices to the internet and allows them to interact over the internet. IoT is an enormous network of connected devices that collect and share data on how they are used and their environments.

In this way, each of your machines, like humans, will learn from the experience of other machines. IoT seeks to increase human interdependence, i.e. communicate, contribute and work together. I know that sounds somewhat complex, let’s take an instance to understand that.

A developer submits the application with a document which contains the tester’s standards, logic, errors and exceptions. Again, Tester communicates it to the developer if there are any problems. It requires several iterations and a intelligent application is produced in this way.

Likewise, a room temperature sensor collects the information and sends it across the network, which then is adjusted accordingly by various device detectors. For instance, the cooler sensor can collect the outside temperature information and thus adjust the cooler temperature. Your air conditioners can also adjust their temperature to suit your needs. This is how devices communicate, contribute and work together.

Now, as you move forward in our IoT tutorial, we will address the advantages of IoT and the hardware used in the IoT implementation.

IoT Tutorial: Benefits of IoT

Since IoT enables devices to be remotely controlled across the internet, it offers the possibility of connecting the physical environment straight to computer systems via sensors and the internet. The interconnection of these various embedded devices will lead to automation in almost every field and will also allow sophisticated apps. This leads to better precision, effectiveness and financial gain with decreased human interference. It covers systems like intelligent grids, intelligent housing, smart transport and intelligent cities. The main advantages of IoT are:

  • Improved customer engagement – By automating the action IoT increases customer experience. For example, the sensors automatically detect any problem in the vehicle. The driver and the manufacturer are notified of this. The supplier ensures that the defective portion is accessible at the service station until the moment the driver reaches the service station.
  • Technical Optimization – IoT has greatly contributed to the improvement and improvement of techniques. The manufacturer can collect and evaluate information from distinct vehicle sensors to enhance its design and increase its efficiency.
  • Reduced waste – Our present insights are superficial but IoT offers data in real-time leading to efficient decision-making and resource management. For example, if a manufacturer finds a failure in many engines, he can track the manufacturing plant and correct the problem with the production belt.

Today, we are surrounded by many IoT-enabled devices which constantly transmit information and communicate via various devices. Go ahead, let’s discuss the hardware needed to build an IoT application. We will also look at the IoT devices we use in our everyday lives.

IoT Tutorial: IoT Hardware

Now you would wonder what hardware is needed to prepare an IoT solution. The response to this issue is that you need sensors to sense the environment, you need a remote dashboard to monitor and show your performance in a clearer and easier-to-conceive way. Finally, you will need a device with the ability to serve and route. The system’s main job would be to detect and take action accordingly. One thing to remember is to ensure communication between the appliances and the dashboard.

Some of the popular sensors around you are accelerometers, temperature sensors, magnetometers, proximity sensors, gyroscopes, acoustic sensors, light sensors, gas RFID sensors, humidity sensors and microflow sensors.

Today we have also much wearable equipment such as smartwatches, shoes and 3D glasses. This is the finest illustration of an intelligent solution. 3D glasses adjust your TV’s luminosity and contrast to your eyes and your smartwatches monitor your everyday actions and your fitness.

But I feel that cell phones are the most significant tool that has made an enormous contribution to IoT. Mobile apps have played a major role in revolutionizing the world of technology. Mobile phones are already covered by apps and sensors that disclose a lot of user information. It has geolocation data, it can sense and trace light, the device orientation and much more. There are also several connectivity choices, including Wi-Fi, Bluetooth and mobile phones, which help to interact with other devices. Thus it is the heart of the IoT ecosystem owing to these default characteristics of cell phones. Today, smartphones can communicate with smartwatch and the exercise group so that user experience is further facilitated and improved.

To interact with devices depending on demands, IoT utilizes various techniques and protocols. Bluetooth, wireless, NFC, RFID, radio protocols and Wifi-Direct are the main technologies & protocols.

IoT apps thrive in all sectors and markets. IoT is expanding in many different sectors. It covers all groups of customers, from those who try to decrease and preserve power at home to big businesses who want to enhance their company activities. In addition to proving helpful in the optimisation of critical apps in many organizations, IoT has enhanced the notion of sophisticated automation, which we envisioned a decade earlier. Let’s know the capacities of IoT in various sectors and see how they revolutionize it.

IoT Tutorial: IoT Across Various Domains

Energy Applications: The levels of energy have increased to a big instinct. Individuals and organizations seek methods of reducing and controlling consumption. IoT offers a way not only to monitor the energy consumption on a device level but also on a house, grid-level or at the distribution stage. In order to track power usage, Smart Meters & Smart Grid are used. It also identifies system performance and stabilization threats that safeguard devices from inactivity and damage.

Healthcare Application: Smartwatches and fitness equipment have altered health surveillance frequency. People can regularly monitor their own health. Not only this but if a patient arrives at the hospital by ambulance, his health report is diagnosed by physicians and the hospital begins therapy rapidly when he enters the hospital. Data collected from various healthcare apps are now collected and used to evaluate various conditions and to find a cure.

Education: IoT offers educational assistance to address the gaps in the education sector. It not only increases education quality but optimizes costs and increases leadership by taking into account student reaction and results.

Government: Governments use IoT alternatives to construct smart cities. IoT enhances the systems and facilities of the armed forces. It offers better border safety through cost-effective and high-performance appliances. IoT supports government agencies to monitor information in real-time and enhances facilities such as healthcare, transport, education etc.

Air and Water Pollution: Various sensors allow us to detect air and water pollution by regular sampling. This helps to prevent major contamination and associated disasters. IoT enables activities to minimize human intervention in agricultural assessment and surveillance. Systems detect changes in plants, soil, climate and more automatically.

Transportation: The transport industry has been altered by IoT. We now have self-driving vehicles with sensors, traffic lights, which automatically senses and switches, parking aid, free parking space etc. Also, several sensors in your car tell you the present condition of your car so you do not face any problems during your journey.

Marketing your product: Using IoT, companies can better evaluate and react by providing appropriate content and solutions to their customers ‘ preferences. It helps improve corporate policies in real-time.

Now that we know of the strong IoT solutions that have had an amazing effect on different domains, let’s take a deep dive and comprehend Raspberry Pi, widely used to develop IoT solutions. We will develop an IoT application after knowing Raspberry Pi.

IoT Tutorial: Raspberry Pi

The Raspberry Pi is a small credit-card-sized computer developed by the Raspberry Pi Foundation in the United Kingdom. Their main reason was to support and promote the teaching of basic computer science at schools and in developing countries. Far more than expected, it has done wonders in numerous areas including robotics.

The present version is RPi 3, published on February 2016. The figure below shows this physically.

CPU speeds vary between 700 MHz and 1.2 GHz for the Pi 3 and 1 GB of RAM are available. SD cards are used to store the memory and operating system. There are four USB slots, HDMI and composite video output, and a 3.5 mm audio jacket. It has several GPIO buttons for lesser levels that support popular protocols like I2C. Pi 3 also has Wi-Fi 802.11n and Bluetooth.

It is used for a variety of reasons. It may be used as a general computer for Internet browsing, playing HD videos, creating tablets, word processing or playing games. However, it is now mainly used for IoT initiatives such as infrastructure cameras, safety systems, music machines and weather station sensors. As mentioned previously, Raspberry Pi is becoming extremely popular in robotics because of its mobile size and its excellent processing power needed for individual devices.

A list of Raspberry Pi operating systems such as RISC OS Pi, FreeBSD, NetBSD, Plan 9 from Bell Labs, Windows 10 IoT Core, xv6, Haiku, HelenOS, the Genode OS Framework and much more are available. The Raspberry Pi Foundation proposes the use of Raspbian, a Linux operating system based on Debian. Follow the measures to install Raspian on your Raspberry Pi:

  • Download NOOBS from the official website of the Raspberry Pi Foundation.
  • Extract the files in the SD card which you will be using for storing the operating system and the program memory.
  • Put the SD Card in Raspberry Pi SD Card slot.
  • Follow the installation steps.

You can then use it as your general computer. Raspberry Pi comes with many accessories that can be fitted to Raspberry Pi and can be equipped with various sensors and extra features. Some of the most frequently used are:

  • HAT (Hardware Attached on Top) expansion boards – The Raspberry Pi Foundation designed the interface for HAT boards alongside the Model B+, inspired by the Arduino shield boards. Each HAT board has a tiny EEPROM with appropriate board information. The HAT and the technical information of Raspberry Pi’s OS are notified.
  • Camera – In addition to a firmware update, the Raspberry Pi camera board was introduced on 14 May 2013. It is an 8-megapixel camera with a flexible flat cable connecting to the CSI connector. The connector is between HDMI and Ethernet ports. The user must allow Raspi-config to use the camera panel. It generates video quality of 1080p, 720p and 640x480p.
  • Infrared Camera – In October 2013, the basis began to produce an infrared-filter camera module called the Pi NoIR.
  • Gertboard – This instrument is intended for education. It extends Raspberry Pi’s GPIO pins to allow LEDs, switches, analogue signals, sensors and other devices to interface and control. It involves an optional Arduino-compatible Pi interface controller.

We will talk more about Raspberry Pi in detail in our next Raspberry Pi blog for hardware setup. Now let us check out a practice in this IoT tutorial that uses HAT, senses the atmosphere (that is, temperature, humidity and pressure) and sends it as an Android notice. RPi & HAT are used by astronauts in real-time to monitor and adjust the atmosphere around them. You can extend this request to adjust its temperature accordingly using your air conditioners and refrigerators.

IoT Tutorial: IoT Application – Sensing the Environment & Notifying  

In this demo, we use a Python program to allow our Raspberry Pi to sensor the environment with the HAT first, to print the temperature on the LED matrix and to then send notifications using the InstaPush API on your android phone based on some triggers.

You must first develop an InstaPush ID and then create an application. Then you must generate an incident that sends notifications as shown in the picture below. During the creation of activities, you’ll ask Event Title, Trackers and Push Message where Push is your Android device’s message. You need to mention the message variable with curly braces in trackers and the same in your Push Message.

Now that you effectively created an event in your application, download the InstaPush application on your Android phone and log in with the same account, as the notice is sent to just the same account the application and the event is generated from. Also note in your application details tab the application ID and application secret, as shown in the figure below. These parameters are needed when using the InstaPush API to send notifications.

Now take a deep dive, let’s look at the program of pythons. First, you must import packages as shown in the picture below:

The json module can be used to encode python items like JSON strings and decode JSON strings in python objects. We will use it to send push messages. The next is pycurl, which is a Python interface to libcurl, the library for the transfer of multiprotocol files. Simile to the Python urllib module, pycurl can be used to retrieve Python URL-identified items. For fundamental Raspberry Pi input-output operations, Rpi. GPIO allows you to control HAT detectors and show information via the LED matrix by using Sense hat.

Here we now have the warm and cold temperatures that will trigger the incident and send out a notification. The matrix has 8 * 8 i.e. 64 pixels. The left and the top form OFFSET is described to leave columns & rows from top to left simultaneously, as shown in the figure below.

The NUMS matrix has 3 * 5 pixels, i.e. 3 columns and 5 rows. The numbers indicate which pixel and which pixel should be off. We will show 2 digits, one digit will appear in the blue region as shown in the figure above and ten digits in the green region. Now let us know how to write the single and two-digit logic for the display.

The first feature describes how a digit is displayed. It recognizes argument number, offset added to the x and y-axis in default offset and RGB code to display the pixel. Then in the show digit function declared here, the offset variable must skip the above pixels and only pick 15 pixels of the NUMS matrix of the respective number. xt is modulo 3 because in each row we have just three pixels. Pixels will be displayed on the LED matrix in the last set pixel feature.

Now we’re separating tens and one digit first for showing the 2-digit number and then calling show digit both tens digit and one digit. We add four-digit columns to separate one digit and tens digit.

Then we create a pycurl instance in our next step and pass all necessary data on the InstaPush API such as the App ID, the app Secret, in the header.

We now specify the information that is sent via the InstaPush API, such as the name of the Event & Tracker message. We are then dumping the information. VERBOSE enables us to view the transmitted message status.

Since we are all configured to send notification & logic on the LED matrix with our InstaPush API, it is high time we sensed the environment using HAT sensors for temperature, moisture and pressure. You can see from the picture above the features used to get each of them. The round) (feature rounds off an entire amount of the value acquired. Finally, the message includes all the environmental information that needs to be transmitted.

Because we continually sensed the atmosphere, we specify the circumstances which cause the incident and send notification via the android phone. Let’s now take a look at the entire code.

After running this program, you will receive notifications if the temperature falls or increases as shown in the figure below.

I hope that this instance will add value to your understanding. We are going to talk more about Raspberry Pi and discuss more practical aspects on Raspberry Pi in our next blog. I hope you found this IoT tutorial blog informative and useful to get an understanding of how IoT revolutionizes the modern world. I would suggest you remain tuned for IoT apps on Edureka channel.