You are on page 1of 19

Module 5

Syllabus
Prototyping concepts, Basics of Embedded computing,
Embedded platforms for prototyping, Iot Connected
devices through Cloud Designing software for IoT,
Prototyping embedded device software

1.Prototyping concepts:
1. Embedded System: it denotes a system that embeds
software into a computing platform. It is a system dedicated
for either an application(s), specific part of an application,
product or a component of a large system.

2. Embedded device: it refers to a device, which embeds


software into a computing platform and performs the
computations and communication specific to the system

3. Microcontroller unit (MCU): Means a single-chip VLSI unit


(also called microcomputer). It may be having limited
computational capabilities and possess memory, flash,
enhanced input-output capabilities, and a number of on-chip
functional units.

4. Timer: Timer refers to a device which enables initiating new


action(s) on timer start ,on the clock inputs ,time outs or
when the number of clock inputs equal to a preset value.

5. General Purpose Input-Output (GPIO Pins): GPIO pins are the


pin that can be used in addition to digital input and output
for other purposes and protocol based reception and
transmission . Examples include Rx and Tx pin used during
UART serial bits transfer , SDA and SCK pin used during use
of I2C bits transfers

For more visit www.ktunotes.in


6. Port and USB Port: Port is a device that enables input output
(IO) communication between the MCU and another device
such as sensor or actuator or keypad or with an external
computing device. A USB port connects the device hardware
to a computer.

7. Interrupt (Software): Interrupt means diversion to a new


function (interrupt service routine) similar to function run on
catching an exception (condition) or callback function. An
interrupt means execution of a software instruction. The
system runs another function on execution of the INT
instruction

8. Interrupt (Hardware): Hardware interrupt results in an action


in which a running program interrupts on hardware signal
such as timer timeout. Action is diversion to a new function
(interrupt service routine) and system runs another function
upon an interruption.

9. Electronic Circuit Board: Board is an electronic hardware—an


electronic circuit board with MCU or SoC, circuits and
Connectors—which provide the connections to other ICs and
circuit components.

10. Shield: Shield is a supporting circuit with connection


pins, socket(s) and supporting software. It enables the
connectivity of a board or computing platform to external
circuits .It Connects the elements that can be plugged onto a
board or platform. Example, Ethernet shield for Ethernet
interface and connectivity to Wi-Fi

11. Integrated Development Environment (IDE): It means a


set of software components and modules which provide the
software environment for developing and prototyping

2. Basics of Embedded computing:

For more visit www.ktunotes.in


Embedding means embedding function software into a
computing hardware to enable a system function for a
specific dedicated application.

• Software: Software consists of instructions, commands and


data from hardware devices . A computing and
communicating Device needs software for performing
actions based on the data. Software does the bootloading of
the embedded OS. It may include the OS functions or we
have to load the OS from external flash or hard disk. A
Device embed software also includes the device APIs and
middleware which enable the device to perform computing
and communication functions.

• Bootloader: Bootloader is a program which runs at the start


of a computing device such as an MCU. It Initiates loading of
the system software (OS) when the system power is
switched on. It may also facilitate the use of system
hardware and networking capabilities according to our
requirements. Sometimes Bootloader loads the OS from an
external source or alternatively bootloader can itself function
as a system software. Booting is said to complete when
normal , operational runtime environment is attained.

• Operating system (OS): An OS facilitates the use of system


hardware and networking Capabilities according to our
needs. When loading of the OS into RAM completes then
MCU starts the normal operational runtime-environment.
When the device is executing multiple tasks or threads, then
also an OS required . The OS controls the multiple processes
and device functions.It also enables memory allocation to
different processes and prioritizing of the processes. The OS
is at the flash memory of the device. An OS may be open
source such as Linux

For more visit www.ktunotes.in


• Real-time Operating System (RTOS): RTOS is an OS that
enables real-time execution of processes on computing and
communication hardware. RTOS uses prioritization and run
as per assigned priorities. Priority assignment enables the
execution of processes in real time

• Integrated Development Environment (IDE): Application


software codes are perfected by a number of cycle of runs
and tests . A cycle in the development phase consists of
editing-testing and debugging. The cycles repeat during
different development phases till the system has thoroughly
tested and debugged the software. A system develops in a
larger time-frame than the hardware circuit design. IDE is a
set of software components and modules which provides the
software and hardware environment for developing and
prototyping . An IDE enables the codes development on a
computer, and later on enables download of the codes on to
hardware platform. IDE enables software that communicates
with the Internet web server or cloud service. The IDE or
prototype tool enables a prototype design. IDE is used for
developing embedded hardware and software platform,
simulating, and debugging . IDE is a tool for the software
development of embedded devices that makes application
development easy . It may be open source, Example Arduino
open source IDE from the Arduino website.

• Simulator in an IDE: Simulator is a software that enables


development on the computer without any hardware, then
prototyping hardware can be connected for embedding the
software and further tests.

• Embedded Hardware Units: The hardware includes the


following:

- Single VLSI (very large integrated) chip or

For more visit www.ktunotes.in


- A core in an application specific instruction set processor (ASIP), called
microcontroller (MCU) or
- A core in an application specific integrated circuit (ASIC) core or
- A core in system-on-chip (SoC) or an SoC chip with an SD card for
embedded software and operating system-software (OS).

• Example is a Microcontroller Unit. It is Application-specific


Integrated circuit(ASIC).It consists of basic on-chip functional
units, such as Internal RAM, flash, IO ports, GPIOs, serial
interfaces, timers, serial ports. It also have additional on-chip
functional units, PWM circuits (1, 2 or 3) , ADC (1, 2, 4 or
higher) and Other functional units. MCU can be 8 bit, 16 bit
or 32 bit controller. Its clock frequency can be 8 MHz,16MHz,
200MHz or higher. MCU includes RAM which can be 2kb,16kb
32kb or higher and alsoIncludes EEPROM and Flash memory.

• Another example is System-on-Chip. Soc is a circuit on a


single silicon chip, consisting of multiple processors,
hardware units and the embedded software. It also includes
the needed digital as well as analog circuits’ on-chip . An SoC
embeds processing circuit with memory and is specific to
dedicated application(s).

Embedded Platforms for Prototyping


Designing a product needs a prototype development first.
Several standard popular boards, modules and supporting
circuits are available from a number of sources to develop a
prototype of the hardware designed. Examples are Arduino,
Raspberry Pi, Intel Galileo board etc.

1. Arduino:
Arduino boards, modules and shields are popular
AVR® MCU based products . Each board has clear
markings on the connection pins, sockets and in-circuit
connections .Thus, Arduino boards are easy to work for
DIY (do-it-yourself) applications. It also simplifies the

For more visit www.ktunotes.in


prototyping of embedded platform for the IoTs.The IDEs
for Arduino development are open source making it
easy to program. The commonly used Arduino board is
the Uno board. For developing IoT applications internet
connection is required. For that we have to use
development boards like Arduino Ethernet, Arduino WiFi
and Arduino GSM shields along with Uno board or select
a board which has an inbuild Wifi connection like
nodeMCU board.
A board has preprogrammed bootloader in the MCU.
Bootloader software program is already been embedded
onto AVR MCU chip. This enables use of the AVR
platform with the Arduino IDE. The board needs no OS
after bootloading by default. A programmer develops
codes using the editor in an IDE. Then these are
downloaded onto the board.

Arduino UNO Specifications:

• It has an ATMega328/ 16 MHz MCU.

• Its Operating voltage is 5 V but you can power it up


external by providing an Input of 7 V–12 V

• It has an EEPROM of 1 kB, SRAM of 2 kB and Flash of


32 kB

• It has 6 Analog inputs and 14 digital IO

• It has 6 n-bit PWM pins

• One USB standard and a UART

For more visit www.ktunotes.in


Architecture of Arduino Fio board

The board analog input pins and PWM pins can connect
sensors, actuators and analog circuits and digital I/O pins
connect On-Off states, set of On Off states, digital inputs
from sensors, digital outputs to actuators and other digital
circuits. A board with a shield inserted into can makes a
wireless connection to a ZigBee, Bluetooth LE, WiFi, GSM, or
RF module or a wired connection to Ethernet LAN for
Internet. For burning programs into the board we have an
ICSP header. Burning is the process of programming an
EEPROM/ ROM. ICSP is in-circuit serial programming, which
means burning the code through connectivity with the ICSP
header.

Features Of Arduino Boards:

1. Prototyping ease

2. Flexibility and ease of assembling modules on the board

For more visit www.ktunotes.in


3. Open extensible source code, schematics, software,
middleware and IDE .

4. IDE latest version and appropriate OS are open source IDE


and software runs on multiple environments, Linux, Windows
and Mac OS-X .

5. Number of times programmability of the board during the


editing-testing-debugging cycles, and for development of
number of new prototype using the same

2. Intel® Galileo Gen 2 Boards:


This board is based on the Intel® Pentium architecture which
Includes features of single threaded, single core and 400
MHz constant speed processor. An example is Intel Quark
SoC X1000 Application processor. Galileo has hardware and
software pin-to pin compatibility with shields designed for
the Arduino Uno R3 and Arduino IDEs. Additionally it provides
large 8 MB SPI flash to store firmware (Bootloader) and
enables the users to incorporate Linux firmware calls in their
Arduino sketch programming. Intel Galileo Arduino Softwares
(IDE and drivers) are downloadable from Intel communities
website. Galileo permits boot off and store drivers in the SD
card. Galileo5 supports a set of 30 sensors and accessories
for Arduino.

In addition to Arduino boards intel Galileo boards have 6-pin


ICSP , 3.3V USB TTL , a UART header, a USB host port and
USB client port and an I2C port. The board has the facility of
development of the codes on personal computer (PC) with
board running Linux. The developments tools and IDE are at
the connected computer. The codes can run on system using
Windows, Arduino Linux distribution, Linux, or MAC on the PC
or tablet.

For more visit www.ktunotes.in


Features Of Intel Boards:
• Prototyping ease
• Supports C programming languages, Arduino codes open extensible source
code, schematics, software, middleware and IDE
• Programmability number of times on downloading of codes through USB
port, that enabling the number of times download during edit-test and debug
cycles
• On-board 8 MB NOR Flash, 12-bit pulse-width modulation (PWM),
Integrated real-time clock (RTC)
• 12V Power-over-Ethernet (PoE) capability, a power regulation system that
accepts power supplies from 7V to 15V
• Reset button to reset the sketch and any attached shields
• Flexibility and ease of connecting the extended memory and hardware
connectivity
• Extended interfacing capabilities using, SPI, several PC industry standard
I/O ports

3. Intel® Edison

For more visit www.ktunotes.in


It is a high performance computation and communication
module. It includes advanced core in the SoC that is dual
core, dual threaded Intel ATOM x86 CPU running at 500 MHz.
It has a RAM of 1 GB in size which is four times that of
Galileo. It includes Wi-Fi and Bluetooth LE communication
interfaces. Interfaces enable seamless device
internetworking and device-to-cloud communication. The
board helps rapid prototype development thereby
producing IoT and wearable computing devices. Edison can
be used with Arduino board.

Features:

• It Includes tools for collection, storage, and processing data


in the cloud, trigger alerts when using advanced analytics

• Has higher performance.

3.Raspberry Pi

Raspberry Pi 3 (Rpi 3) model B is the latest (February 2016)


single board SoC based computing and communication
board. An Rpi runs on the OSes (Windows 10 IoT Core, RISC
OS, FreeBSD, NetBSD, Plan9, Inferno, AROS and additional
distributions of Linux such as Raspbian Ubuntu) on the
board. The RPi includes hardware and software which
provides high performance computing and graphics. RPi
clock speed is about 40 times that in Arduino and larger RAM
compared to Arduino. It Uses the processor (ARM Cortex
quad core) plus a graphic processor (Broadcom VideoCore
IV) for graphics and video. Rpi provisions for no real-time
clock (RTC) and therefore external chip is used for including
an RTC. It has 1 GB on-board Memory plus SD card (model B)
or MicroSDHC card (model B+) slot for external SD and
microSD cards.The core is a stripped down version of
Ubuntu, designed to run securely on autonomous machines.
Applications include Home automation and drones, In
networked security camera systems in home automation ,
ATMs, Applications in IIoT

For more visit www.ktunotes.in


Features:

• Computer like prototyping ease for developing media server


and home or ATM surveillance systems IoT applications and
services

• Coding in Python, C++

• Software runs on multiple environments, Python, Scratch,


Squeek, IDLE, C, Linux and BSD OSes, Windows 10 and
several OSes with external key board and display monitor

• Flexibility and ease of connecting the hardware to external


systems, Connectivity of Rpi takes place through two USB
hosts hub and Ethernet connector

• Connectivity to the extended memory through a Micro-SD


slot

• Extended interfacing capabilities using, SPI, UART, I2C, 40


GPIO pins, supports Wi-Fi module, stereo audio, video with Pi
Camera module, and streaming High-definition HDMI output.

4.BeagleBone (BB)

Texas Instruments BeagleBone-X15 (BB-X15) is the latest


(November 2015) single board computer for computing and
communication. BB Runs on the OSes Linux, RISC OS,
FreeBSD, OpenBSD and additional distributions of Linux such
as Ubuntu boards. The SoC uses the processor (ARM Cortex
A15 core) and DSP processor (TMS320C64x plus multimedia
4 GB eMMC) for graphics and video. The power required is 2
W. It has 2 GB on-board Memory and support for using
microSD cards. Applications include for media, 2D and 3D
graphics, and video servers. Performance of BeagleBone is
nearly twice faster than Rpi 2.

Features of BB-X15:

For more visit www.ktunotes.in


• It is a Single-board computer and has on board
communication facility.

• Prototyping is easy for media, graphics and video servers


needing IoT applications

• IDEs for BB includes environment for code development in


Python, Scratch, Squeek Cloud9/Linux, C, Linux and BSD
OSes.

• Programmability for number of times ie downloading of


codes through USB port during edit-test-debug cycles of
development

• It has inbuilt Pulse-width modulation (PWM), CAN/SPI//DVI-D,


Integrated real-time clock (RTC) and Reset button to reset
the sketch and any attached modules

• Flexibility and ease of connecting the extended memory and


hardware connectivity board to external sockets

• Extended interfacing capabilities using 157 GPIO pins

• Flexibility and ease of connecting the hardware connectivity


board to external hardware through three USB 3.0 and USB
hub

5.mBed

mBed is an ARM-based platform . ARM’s software framework


provides the cloud development environment, mBed OS and
mBed device server. mBed board is Open source and is
extensible using the modules, shields and other circuits. It
enables the use of open version of modules, support of
software library for peripheral components, sensors, radios,
protocols and cloud service APIs under the Apache License
2.0.

Features:

For more visit www.ktunotes.in


• Open extensible source code, schematics, software,
middleware and online SD (IDE), with mbed C/C++ software
platform tools for testing and debugging scripts

• mbed online IDE enables IoT/M2M applications development


on the mbed platform

• Open source code editor with web-based C/C++


programming environment

• Open source web browser using the cloud ARMCC C/C++


compiler

• IDE latest version and appropriate OS are open source


Eclipse

• Built-in USB drag and drop FLASH programmer

Iot Connected devices through Cloud


To Connect an Arduino board to Internet is an easy task.
Arduino board IDE supports USB. USB port connects to a
mobile or computer or tablet with Internet connection using
IDE USB port function. Computer then connects to the
Internet using network interface cards. This is the simplest
way. We can also Connect Arduino to Internet using Ethernet.
Arduino IDE supports Ethernet protocol Library.Library means
set of codes which enable use of functions in the library for
specific purposes. Ethernet LAN connects to the network
router.

For more visit www.ktunotes.in


We can Connect Arduino to WiFi. Arduino IDE supports
WiShield Library. WiShield connects to a network router
without wires. However, sufficient energy for Wi-Fi
communication is required from the power Supply.For Using
WiShield the program has to predefines (i) network type ie
infrastructure fixed network or ad hoc network (ii) security
type, 1 (WEP), 2 (WPA) or 3 (WPA2)(iii)WEP key (wired
equivalent security key or 128-bit when security type = 1
(means WEP) (iv) SSID (Service Set identifier), a unique ID of
32 characters and is used for naming wireless networks.
Service set means a set of networked interconnected
devices which communicate using SSID of the set. The
Header files in Arduino Ethernet Library are :

#include<SPI.h> - serial IO functions between Arduino SPI


port and Ethernet shield

For more visit www.ktunotes.in


#include<EthernetUdp.h> -UDP protocol for sending
datagram to the web server.

#include<EthernetClient.h> - Ethernet shield is used as a


client.

#include<EthernetServer.h> - Ethernet shield is used as


server to the connected computer with the board.

#include<Ethernet.h> - Ethernet LAN functions.

Prototyping Embedded Software


• Develop the codes, design and test the embedded devices
for IoT and M2M using the IDEs and development platforms.
First level in IoT concept is Gathering (data from
devices/sensors) + consolidating (enriching). Second level is
Connection to Internet. An IDE enables development of
software for functions at first and second levels. IDE may
also enable usages of the OS or RTOS functions at an
embedded device. Bootloader firmware stores at flash/ROM
of a microcontroller in a device and enables communication
with computer having an IDE. The IDE, in general, consists of
the APIs, libraries, compilers, RTOS, simulator, editor,
assembler, debugger, emulators, logic analyser, code
burner, and other software for integrated development of the
system. IDE enables the development of codes on a
computer, and later on downloading (pushing) of codes on to
embedded device, such as Arduino or microcontroller board.
A code-burner places codes into flash memory or EEROM or
EPROM. The specific application codes thus embed into the
device.

Arduino board programming:

• The Arduino board has a pre-installed bootloader embedded


into firmware. Arduino board can be Programmed in C++

For more visit www.ktunotes.in


using avr-gcc tools. Arduino programmer develops the codes
using a graphical cross-platform IDE. Arduino provides
simplicity based on processing language. The board
connects to a computer which runs the IDE. Bootloader
program handovers the control and enables running of
loader, which loads the required OS functions and software
into the system hardware and networking capabilities into
the board. The Arduino Bootloader Provisions For
Multitasking Using interrupt (analogous to eventing) handing
functions for each task. Multitasking is done by assigning
multiple values for the number n for the tasks (n > 0). When
an instruction for interrupt, INT n executes, then interrupt-
handing function n is called for execution. Each task or
thread can have the number n associated with it. The
Arduino IDE provide provisions For Multitasking. First, a
computer downloads an appropriate IDE version, as per the
computer OS. A computer usually runs Windows or Mac OS X
or Linux. The IDE consists of a set of software modules,
which provide the software and hardware environment for
developing and prototyping the software for the specific
device platform.

Only two functions are necessary to define executable


program functions for the board setup() and loop(). The
function setup() runs at the start and is used for initialising
setting. The function loop() has a program in endless loop
using statement ‘while (true) {statements ;}’ which runs till
power off

Sensor ADC output reading using serial input SPI:

• A temperature sensor used for measuring temperature


between 0 degree and 100 degree Celsius. A sensor sends
analog output at an analog input of a 10 bit ADC. An RH%
sensor can also be used in similar manner where measured
value is in RH% in place of degree Celsius. Set interfacing

For more visit www.ktunotes.in


circuit such that the ADC output for sensor at 100 degree or
100% = decimal 1023 (=binary 1111111111) and = decimal
0 (=0000000000) for 0 degree. ADC output is coverted to
serial by a parallel input to serial-output (PISO) converter.
The serial output connects to serial SPI input pin at Arduino
Uno board. Include the necessary header files in the program
like

#include for using SPI pins

#include for IO utility functions.

Includes UART interface, which connects to computer for


display of messages on computer-screen

IDE software provides the functions for display using serial


interface output of board

Once header files has been included we have to declare


functions and variables.

initial value = 0

#define TempSensorADCinput 0

/*calibCoeff = output change in parameter per unit rise in


temperature by 1 degree Celsius.

#define calibCoeff = 0.097752 when sensed parameter


analog value is between 0 degree Celsius to 100 degree
Celsius and digital ADC out is between 0 and 1023

float observedV, parameter; /*observedV = Voltage input


from Sensor. The parameter = sensed parameter value
0….1023*/

int internalLED = 13; /* initialise internal Port 13 Digital IO


Pin LED for test Function. */

For more visit www.ktunotes.in


char [ ] unit; /* degree Celsius, %, any other for sensed
parameter*/

Next provide setup() and loop() functions

setup()

Add initial values

parameter = 0.0; // Declare the initial value of the parameter


ADC output

observedV= 0.0; Initial value observe = 0 mV

loop()

Run the following functions

observedV = analogRead (TempSensorADCinput);

parameter = calibCoeff*obesrvedV *1023/3.3;

Serial.print (“Temperature =”); //Assume sensed parameter


is temperature

Serial.println (parameter, unit);

test ( );

test ( )

Run the following functions

digitalWrite (internalLED, HIGH);}

for ( int i = 1, i<=600) , i++) {

delay (3000);

digitalWrite (internalLED, LOW); delay (3000); // Wait 6 s

digitalWrite (internalLED, HIGH); for internal LED blink every


6 s during hour loop after which again read sensed value.

For more visit www.ktunotes.in


For more visit www.ktunotes.in

You might also like