IoT Class for Undergraduate Study

In recent years the Internet of Things (IoT) and related topics have received much attention from the public due to widespread and efficient use of the internet for data sharing and communication. The improved cost v.s. performance of microcontrollers and electronics is another important factor. Now we can buy a 32-bit WiFi-ready CPU board such as ESP8266 NodeMCU for under USD 5.00. Furthermore, many cloud services, domestic or abroad, offer free accounts with limited usage. All of these bring good opportunity for a novice to start his/her first IoT project.

Many real applications would benefit greatly by appending IoT functions to the overall systems. Imminent advantage is the ability to monitor and control the system remotely. Hence, we would see more companies list IoT requirements on their job positions. In order to cope with such demand, academic institutions must adapt to catch up with the new trends. IoT is not a study subject only for IT/computer sciences students anymore. It should be added to courses in other disciplines such as agriculture, medical, and, of course, engineering.

A typical IoT workshop must include lectures as well as lab exercises. In this article, we discuss an approach to manage a class consisting of both, which is actually deployed this semester in a course for International Undergraduate Program (IUP) at Faculty of Engineering, Kasetsart University.

Hardware for Classroom Use

Normally, undergrad courses are categorized to lecture or lab. A lab-based course is one that requires bulky instruments such as oscilloscopes, signal generators, power supplies, etc. Lab exercises for IoT, on the other hand, does not have to be that demanding. It typically requires only an MCU board connected to some sensors, LEDs, and perhaps an OLED panel. Power to the board can be supplied from a USB port.

The simplest setup is connect a circuit of MCU development board and electronics on a protoboard using jumper wires. This can be time-consuming, error prone, and leave students with unpleasant learning experience. On the other extreme, the instructor may use some commercial development board that is designed for universal experiments. Such product often comes in a large board with more components than necessary, equipped with an external supply and those jumpers and connectors that often appear intimidating to a beginner. Teaching assistant(s) may be required for lab setup and individual problem fixing.

My approach is to mediate between these ends. To learn something new, a student would oppose something that is overly complicated. So hardware must be kept quite simple, compact, and easy to use. Unlike the protoboard experiments, the board must be designed to minimize errors from wrong connection and loose wires. Connectors and jumpers are provided only as necessary. The picture below shows some examples that are used successfully in classes and workshops.

Software Tools for MCUs

To a beginner, we have found Arduino IDE, together with Arduino cores from the hardware developer, makes programming for ESP8266 and ESP32 MCUs more convenient than other options. After the cores and all libraries are properly installed, the process is not much different from other Arduino board such as UNO. Students have to learn some basic C programming for the Arduino IDE environment. Library examples are always helpful. Before getting into IoT, they should master low-level MCU functions and peripherals such as digital I/O’s, ADC, PWM, external sensors and actuators, and learn how to control sampling period for a code section of interest.

For more advanced MCU such as ESP32, FreeRTOS library already embedded in the Arduino core helps us specify code sections to each of the two MCU cores, to create a true multitasking system. This is particularly useful when some important thread is required to run without any interruption. Control algorithm is a good example. We do not want its sampling rate affected by, say, internet traffic or WiFi instability. This advanced topic is optional, and may be omitted in an introductory course.

IoT Cloud Services

As its name implies, an IoT device must connect to the internet to transfer data and communicate with some other parties. Few people maintain their own servers for their IoT devices. A prime reason is that the approach is expensive and unreliable. General users choose from IoT cloud platforms available; many of them offer free basic usage. Blynk and Google Firebase are among famous choices.

After some regional, reliability, cost, and ease of use considerations, we choose NETPIE, a cloud platform developed by Thailand’s National Electronics and Computer Technology Center (NECTEC). The service is provided free of charge, with some limitation in terms of free credits. Read more on their official website https://netpie.io/

NETPIE Freeboard and Feed are two components for data gathering, display, and control. Communication is carried out in the background by sharing the same application ID. Keys and secrets are assigned for authentication. A library named “microgear” needs to be installed on Arduino IDE for the MCU to communicate using MQTT-based protocol. REST API is another method provided for some legacy devices unsupported by the microgear library.

Constructing a workable user interface shown in the figure above is fairly easy. It can be done in less than an hour after students understand the concept and structure. Normal flow for the course starts from NETPIE basics (html-based and microgear), Feed and Freeboard development, to more advanced topics.

Conclusion

This article addresses the importance of providing IoT knowledge to undergraduate study, and suggests some course design to achieve such objective. The hardware and software components may be adjusted to suit instructor’s background and experience. The course structure is also applicable beyond academic environment, for example, IoT training for R&D department in a private company.

About the Aurhor: Dr. Varodom (Dew) Toochinda is a researcher/lecturer at the Department of Mechanical Engineering, Faculty of Engineering, Kasetsart University. He received NETPIE Certified Trainer from NECTEC in 2017 and was invited to lead IoT workshops for domestic and international events in Thailand.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s