Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

The Control System: An IoT Device's Brain

DZone's Guide to

The Control System: An IoT Device's Brain

Here's an introduction to microcontrollers, the role they play in IoT, and how what criteria you should consider when trying to pick the right one.

· IoT Zone
Free Resource

Download Red Hat’s blueprint for building an open IoT platform—open source from cloud to gateways to devices.

We recently published an introduction to IoT Sensors and Actuators, where we learned that the enabling technology is a transducer, a physical device that converts one form of energy into another. Now let’s look at how this energy conversion is used as input for a control system in an IoT device.

Your IoT device may be smaller than a coin or larger than a refrigerator. It may perform a simple sensing function and send raw data back to a control center. It may combine data from many sensors, perform local data analysis, and then take action. Additionally, your device could be remote and standalone or be co-located within a larger system.

Regardless of the function, environment, or location, your IoT device requires two components, a brain and connectivity. The “brain” provides local control (or decision-making). Your device’s function will determine the size and capabilities of the brain component. Connectivity is needed to communicate with external control. The environment and location of your device will determine how it connects.

The “Brain” of the IoT Device

Your IoT device will most likely use a microcontroller as its brain. Think of a microcontroller as a small computer with a microprocessor core, memory, and input/output (I/O) ports. The microprocessor core of your microcontroller is a central processing unit. It handles all the number crunching and local data manipulation and decision-making. The memory includes Read Only Memory (ROM) and Random Access Memory (RAM). ROM stores the microcontroller’s software program. RAM stores and receives data while also supporting number crunching. The final microcontroller component, the I/O ports, may be either digital or analog. The input ports collect data from sensors. While the outputs support any necessary actuation or local control in the IoT device.

Usually, microcontrollers control various devices or subsystems within embedded applications. By integrating the microprocessor, memory, and input/outputs, microcontrollers reduce cost and make development easier. This makes it more affordable and less complicated to control many IoT devices.Simple IoT Device Microcontroller

 

Simple Microcontroller

To determine which microcontroller to use for an IoT application, you first need to understand a few basic specifications:

Microprocessor Type (“Brain”)

How fast your brain needs to think (clock speed) and how much information it can handle (data I/O bus size) determines the microprocessor type. Depending on your application, you may have a very simple microprocessor or a much faster, bigger, power hungry one. While you don’t need to be an expert on microprocessors, you should have an idea of what you want it to be able to do.

Amount of Memory

ROM “stores” your application program in the microcontroller. The size of the program is a function of the complexity. RAM performs two functions: It reads and writes data for file storage, and it holds data waiting for processing by the microprocessor. An important distinction between ROM and RAM is volatility. ROM is non-volatile, meaning that the data remains stored with or without power. RAM is volatile, meaning it may lose data if it is without power. This is an important factor for IoT devices which may be prone to an interruption of the power supply.

Operating Voltage and Current

The device needs adequate voltage to support its sensors and power sources. If a device is part of a larger system, it may use a local output voltage. Generally, sensor and battery technologies operate within a compatible voltage range. You will need higher output currents if you need control or activation (such as operating a motor).

Number and Type of Input/output (I/O) Ports

The I/O ports are the connection to your device sensors and actuators. There may be few, or many, depending on the application. The ports may act as inputs from sensor to device, as outputs from device to sensor (or actuator), or both. As mentioned above, I/O ports may be digital or analog. Digital ports are for simple logic, or yes/no type input. Examples include closing a switch, tripping a wire, presenting/not presenting something. When acting as an output, a digital port may turn something on or off. Analog ports are for continuous input/output like a temperature or speed. Keep in mind; microcontrollers are digital devices so signals moving in and out must also be in digital format. Inputs from analog sensors use an analog-to-digital converter (ADC). The purpose of the ADC is to convert data into a format that is usable by the microcontroller. Once you define your IoT device application, you can determine the type and number of I/O ports you need.

Control Interface

A control interface is a protocol allowing peripheral devices and the microcontroller to communicate with one another. Depending on the application, you may need a specific control interface. There are different ways the interface may facilitate communication. It may use an inter-integrated circuit (I2C), a serial peripheral interface (SPI), or a controller area network (CAN) communications protocol. While you do not need to know technical details about these, you do need to know which protocols your system requires. Those will determine if you need a control interface and how that interface should communicate.

Anatomy of an IoT Device

Build an open IoT platform with Red Hat—keep it flexible with open source software.

Topics:
iot ,microcontroller ,microprocessors ,interface ,tutorial

Published at DZone with permission of Jordan Eller, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}