Internet of Things and Arduino

Hans-Petter Halvorsen

1 Introduction

Internet of Things and Arduino (YouTube) + PowerPoint (PDF)

Cloud services and IoT solutions are becoming increasingly popular.  Even the industry embrace IoT as Industrial Internet of Things (IIoT), which is part of the next generation Automation Systems. We will use Arduino. Arduino is popular to use in different IoT applications.

Topics: Internet of Things (IoT), Microcontrollers (Arduino), PWM, Automation, ThingSpeak (IoT Cloud Service), and Cyber Security.

 

You may go through some of the resources (tutorials, videos, examples, exercises, etc.) below or you may start directly on the final delivery. Then you can use these resources if you need help solving some of the different tasks within the delivery.

 

1.1 Hardware

You will need the following IoT hardware and components:

 

1.2 Software

You will need the following software:

 

 

2 Arduino

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs, like light sensors, activating a motor, turning on an LED, etc. A lots of different Arduino boards exists, but Arduino UNO is the most popular Arduino board. Arduino is very popular in IoT projects and applications.

Engineering Essentials

Arduino is a Microcontroller. Arduino has a Bootloader and not an ordinary operating system. Arduino is NOT a computer, only a small microcontroller, whose purpose is to control things. Arduino has no Bluetooth, Wi-Fi (some models have) or Ethernet (but can be provided as so-called Shields). Arduino has very little RAM (a few Kb) and therefore inexpensive. Arduino is excellent for IoT Applications.

Introduction to Arduino (YouTube) + PowerPoint (PDF)

Programming with Arduino (Textbook) (PDF) - If you have no experience with Arduino, you should start to play with the Arduino and do the examples inside this textbook. The textbook is also available in Norwegian: Arduino Programmering (PDF).

Arduino Serial Monitor and Plotter (YouTube) + PowerPoint (PDF)

 

Are you using the new Arduino UNO R4? - See this Arduino UNO R4 Tutorial (PDF)

 

2.1 IoT Sensors

Here is an overview of some selected IoT Sensors:

Arduino and DHT22 Temperature and Humidity Sensor (YouTube) + PowerPoint (PDF)

Arduino and DS18B20 1-Wire Temperature Sensor (YouTube) + PowerPoint (PDF)

Arduino and AM2320 Temperature and Humidity Sensor (YouTube) + PowerPoint (PDF)

 

2.2 DAC

DAC – Digital to Analog Converter. Arduino UNO has no Analog Output Pins, so we need a DAC such as, e.g., Microchip MCP4911, MCP4725 or similar. MCP4911 is 10-bit single DAC, SPI Interface. The MCP4725 is a little more expensive, but simpler to use. MCP4725 has 12-bit resolution and I2C Interface.

Arduino and DAC (YouTube) + PowerPoint (PDF)

 

Here is another Arduino DAC Library used:

Using MCP49xx DAC chip in Arduino

SPI Arduino Library: https://www.arduino.cc/en/Reference/SPI

MCP49XX Arduino Library: https://github.com/exscape/electronics/tree/master/Arduino/Libraries

 

2.3 PWM

The Arduino UNO has no real analog out channels, but some of the digital channels can be used as PWM - Pulse Width Modulation.

You can convert a PWM output to an analog voltage level, producing a true DAC. You need to create a simple low-pass filter made from a resistor and a ceramic capacitor, a so-called RC circuit.

Arduino Pulse Width Modulation (PWM) (PDF)

 

2.4 Arduino Classes and Libraries

When using Arduino you typically use many existing Arduino Libraries. We will learn how we can create our own Arduino Libraries from Scratch.

Arduino Classes and Libraries (YouTube) + PowerPoint (PDF)

 

 

3 Automation

Automation and basic Control Engineering principles are important part of IoT application. Below we see a typical feedback system.

Arduino Resources:

Arduino Control System (YouTube) + PowerPoint (PDF)

Arduino Control Library (YouTube) + PowerPoint (PDF)

 

LabVIEW Resources:

LabVIEW in Automation (Website)

A Practical Guide for Connecting LabVIEW to the Industrial IoT (Website)

 

Lowpass Filter:

Implementing Low-pass Filter in LabVIEW (Tutorial)

Lowpass Filter in LabVIEW (YouTube) + PowerPoint (PDF)

 

Here you find more Control Theory:

Modeling, Simulation and Control (Textbook) - by Finn Haugen

Discretization of simulator, filter, and PID controller (Article in MIC Journal) - by Finn Haugen

 

 

4 ThingSpeak IoT Cloud Service

ThingSpeak is an IoT cloud service used to store IoT data. ThingSpeak is an IoT analytics platform service that lets you collect and store sensor data in the cloud and develop Internet of Things applications. The ThingSpeak service also lets you perform online analysis and act on your data. Sensor data can be sent to ThingSpeak from any hardware that can communicate using a REST API. ThingSpeak has a REST API that lets you collect and store sensor data in the cloud and develop Internet of Things applications.

Note! Arduino UNO R3 does not have WiFi included. For communication with WiFi and ThingSpeak you need Arduino UNO R4 WiFi, Arduino UNO WiFi R2, Arduino WiFi Shield or a Wifi module like ESP8266.

 

Resources:

Introduction to ThingSpeak (PDF)

Arduino and ThingSpeak (YouTube) + PowerPoint (PDF)

LabVIEW and ThingSpeak (YouTube) + PowerPoint (PDF)

 

Are you using the new Arduino UNO R4 WiFi? - See this Arduino UNO R4 WiFi and ThingSpeak Tutorial (PDF).

 

Note! Arduino and WiFi is not working with Eduroam, so you should setup a location network ("Personal/Mobile Hotspot") using your PC or your Phone. Make sure to use 2.4Ghz network band.

Note! A Free (which we are using) ThingSpeak Channel can only be updated every 15 sec. But it is possible to update uptill 8 fields at the same time (each channel in ThingSpeak can have uptill 8 fields).

 

Additional Resources:

ThingSpeak - Change Values from a HTML Webpage (PDF)

 

Arduino Wi-Fi Shield Firmware Update: For those using an Arduino Wi-Fi Shield: A Firmware update may be needed. This web site gives very good instructions how to do this. It takes about 5 minutes to do this.

 

 

5 LabVIEW LINX

The LabVIEW LINX Toolkit adds support for Arduino, Raspberry Pi, and other embedded platforms in LabVIEW. Here you can learn LabVIEW Fundamentals.

LabVIEW LINX Toolkit is an add-on for LabVIEW which makes it possible to program these devices using LabVIEW.

LabVIEW LINX with Arduino Tutorial (PDF)

You install the LabVIEW LINX Toolkit using the VI Package Manager. Note! If VI Package Manager does not appear under the Tools menu in LabVIEW, Launch VI Package Manager directly from the start menu of your computer. Then next time you open LabVIEW, it should be available under the Tools menu in LabVIEW.

Note! As far as I know, LabVIEW LINX is not working with Arduino UNO WiFi. It is only working with the standard Arduino UNO.

 

Videos:

Introduction to LabVIEW LINX and Arduino (YouTube)

LabVIEW LINX Arduino DAQ System (YouTube)

LabVIEW LINX Arduino Temperature Sensors (YouTube)

 

Additional LabVIEW LINX Resources:

LabVIEW LINX, Arduino and ThingSpeak (YouTube) + PowerPoint (PDF)

LabVIEW LINX and Arduino using SPI and I2C (YouTube) + PowerPoint (PDF)

 

 

6 Internet of Things and Cyber Security

IoT solutions and Data Security? How can we make sure our applications and data are safe? Security is crucial in IoT/IIoT Applications. Read more about Cyber Security.

Cyber Security Overview (PDF)

Cyber Security (Textbook) (PDF)

 

Additional Cyber Security Resources:

Cyber Security Tutorial (Website)

Cyber Security Tutorial Library (Website)

Delivery

In this Assignment we will create an embedded Arduino PI(D) controller from scratch. One of the challenges is that Arduino UNO has no Analog Out. How can we solve that? The Data should be stored in the Cloud. The final system should be tested on the Air Heater System. The final system should be able to control the real Air Heater using the Arduino PI controller without having a PC connected to the Arduino (you can use an external power supply or a battery), and where you log temperature data to ThingSpeak.

 

The following Tasks should be done as part of the delivery:

Part 1: Arduino Development

Part 2: LabVIEW LINX

In this part creating a Graphical User Interface (GUI) is an important part of the solution.

You can as an alternative to LabVIEW and LabVIEW LINX use Visual Studio/WinForms/C#, but no resources are made for this alternative.

You should start your work by creating a System sketch. In that way you will get an overview of the system you are going to create. Make System Sketch in PowerPoint (YouTube).

Note! All parts and tasks should finally be put together and presented as one final working system. Pretend you make this for a given customer/client.

Feel free to Explore! Make sure to Add Value and Creativity to your Applications! Try to add some extra value and be creative compared to the simplified examples given by me, in that way you learn so much more.

"Explore and Add Value" Examples (Voluntary, if you have some spare time):