Sciforce
Published in

Sciforce

Embedded programming in the Internet of Things

Embedded programming has a long history of making devices do what people need. However, it remains outshined by application programming: when application programmers were embracing high-level object-oriented languages like C++ or Java, or graphical application development environments like MATLAB, embedded programmers were only moving from assembly language to C. Besides, they were always outnumbered by app programmers — simply because now even hobbyists can develop an app using an easy language and upload it to cloud, while embedded programmers need to have profound knowledge of the hardware platform.

With the emergence of the Internet of Things (IoT), the balance can finally change. Now that every thermostat, toaster, watch, and light bulb is equipped with a processor, the market needs more embedded programmers to program these devices, and consequently more simpler tools to allow the programmers to write code without plunging into the hardware.

But first!

What is embedded programming?

According to Technopedia, embedded programming is a specific type of programming that supports the creation of consumer facing or business facing devices that don’t operate on traditional operating systems the way that full-scale laptop computers and mobile devices do. The idea of embedded programming is part of what drives the evolution of the digital appliances and equipment in today’s IT markets.

If explained in simpler words, embedded programming is designing software for small computers that drive devices; essentially, it is the dominant methodology for microcontroller and microcomputer programming used in small facilities-handling devices like thermostats, handheld games or other small devices.

Embedded programming and IoT

From the engineering perspective, the Internet of Things is an embedded microprocessor controlled system connected directly or indirectly to the web. The three pillars of the IoT are therefore embedded programming, network technology and information technology. The embedded system of a device collects data from a sensor and sends it to the cloud using a wifi module — basically, it means that you can turn your embedded device into an IoT device by simply giving it Internet access.

The IoT is everywhere, and so are embedded devices:

  • Industrial world, such as industrial machinery and control, temperature monitoring, or cognitive anomaly detection — the recent challenges of embedded systems turned them towards automation.
  • Healthcare, including blood pressure monitors, heartbeat monitors, and pacemakers.
  • Aerospace and Defense with such applications as flight control systems, actuation, air and thermal management, engine power control and many others.
  • Smart Homes, including Home Security system, Setup Box, Digital Camera, Television, Microwave Oven, Air Conditioner, Refrigerator and much more.

Embedded systems

Once I’ve read the saying that every complex system in the world can be reduced to two ideas: software and hardware. An embedded system is not an exception: to understand how embedded programming works, we need to understand its hardware and software parts.

Embedded Hardware

The embedded development board is divided into five modules: Processor, Memory, Input devices, Output devices and Bus controllers.

Hardware Components of an Embedded System

Processor

Embedded processors can be broken into two categories: ordinary microprocessors that use separate integrated circuits for memory and peripherals, and microcontrollers that have on-chip peripherals, reducing power consumption, size and cost. Some of the examples of microprocessors include:

  • Microcontroller (CPU) is an intelligent device that computes the tasks assigned by the user and is used to build small applications with precise calculation.
  • System on Chip (SoC) comprises a CPU, Peripheral devices (Timers, counters), Communication interfaces (I²C, SPI, UART), and Power Management Circuits on a single IC.
  • ASIC processor (Application Specific Integrated Circuit) is designed for use for a particular application and owned by a single company.
  • DSP processor removes the noise and improves signal quality in Audio and Video Applications.

Memory

Data storage and memory management require EEPROM. Some examples of the memories used in embedded systems include Non-Volatile RAM, Volatile RAM, DRAM (Dynamic Random Access Memory), etc.

Input Devices

Input devices, such as sensors, switches, photodiode, optocouplers, etc., take input from the outside world accepting input from the user and responding accordingly.

Output Devices

Output devices, including LCD, LED, seven segment displays, buzzers and relays, are indications or results of input events from outside the microcontroller.

Bus controllers

The bus controller is a communication device that transfers data between the components inside an embedded system. The most widely-spread bus controllers are serial buses (I2C, SPI, SMBus etc.), RS232, RS485 and universal serial bus.

Embedded Software

Embedded software, sometimes called firmware, is written for the device drivers, operating system, and applications, as well as for error handling and debugging.

Software Components of an Embedded System

Device Driver

A device driver is a piece of embedded code written for a particular hardware.

Operating System (OS)

Embedded systems have a range of operating systems, including RTOS (Real-time operating systems), mobile embedded, stand-alone and network embedded systems.

Most of the embedded software is now written in two languages, C and C++. There is not much difference between C and C++ in terms of syntax. However, C++ has some additional features, like enhanced security and closeness to real-world applications, while C is considered to be more reliable and showing better performance and directly interacting with the hardware.

Key steps to create an embedded product

Now, knowing the theory, we can prepare ourselves to try embedded programming.

Probably, the best way to start writing software that would directly affect physical objects is to explore such embedded platforms as Arduino, Raspberry Pi, or Particle.

To develop a viable product you should take the following steps:

Step 1. Learn C or C++

And this is where many (me included) stop. However, if you want to write embedded software, you have to learn C/C++ (and maybe eventually Rust).

Step 2. Learn Some Basic Electronics

At least to the extent that you understand what voltage, current, power, resistance, and ohms law are.

Step 3. Get the Basic Equipment

Embedded programmers actually interact with the physical world, so such things as soldering iron, Digital Multi-Meter (DMM), and a hardware debugger/ JTAG adapter (such as an ST-Link, or OLMEX adapter) or a Logic Analyzer would be of help.

Step 4. Choose a Microcontroller and Toolchain

To make your program run, you’ll need a microcontroller to actually run it, a compiler that would compile it for the microcontroller, and other tools to load the program onto your hardware. An example of the compbination of mictocontrollers with a toolchain is the STM32 microcontrollers that are supported by the arm-gcc along with openOCD toolchain.

Step 5. Understand the Datasheets

Before actually sitting down to write the first line of your code, you need to understand the (end user) specifications.

Step 6: Examine the components

Analyze and pick up the components (software and hardware) required to make the product.

Step 7: Design a product

Designing is always the most critical phase of any development cycle. The peculiarity of the embedded programming is that you have to develop the hardware and software parts individually and integrate both.

Step 8: Develop a prototype

A prototype is a sample version created to test the concept which is developed according to the specifications using the selected hardware and software tool.

Step 9: Test the application

Now that the prototype it is possible to run test cases to prove the possible potential of the application.

Step 10: Deploy the application

After testing the application, the result is checked in a real environment to realize the Proof Of Concept — a technique used to validate an idea.

Step 11: Support and Upgrade

If needed, you should be ready to provide support and upgrade the application with new features.

Eleven steps to create an embedded product

And now you are ready to start changing the world — for example, but creating a smart Lego city!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sciforce

Sciforce

3K Followers

Ukraine-based IT company specialized in development of software solutions based on science-driven information technologies #AI #ML #IoT #NLP #Healthcare #DevOps