0% found this document useful (0 votes)
13 views40 pages

Pim Kot 052 Unit1

The document outlines a course on Programming and Interfacing with Microcontrollers, focusing on IoT fundamentals, hardware like Arduino and Raspberry Pi, and relevant programming languages such as Python and Java. It covers the requirements for IoT systems, challenges with open-source IoT architecture, and various open-source platforms available for development. Additionally, it discusses sensor characterization, control flow in Arduino programming, and potential applications of IoT in various industries.

Uploaded by

priyanka singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views40 pages

Pim Kot 052 Unit1

The document outlines a course on Programming and Interfacing with Microcontrollers, focusing on IoT fundamentals, hardware like Arduino and Raspberry Pi, and relevant programming languages such as Python and Java. It covers the requirements for IoT systems, challenges with open-source IoT architecture, and various open-source platforms available for development. Additionally, it discusses sensor characterization, control flow in Arduino programming, and potential applications of IoT in various industries.

Uploaded by

priyanka singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Raj Kumar Goel Institute of Technology

Ghaziabad

Programming and Interfacing with


Microcontroller (KOT-052)
Evaluation Scheme
Syllabus
Course Objective

To provide foundation on the fundamentals of IOT, Hardware used in


IOT like Arduino, Raspberry Pi board, sensors and actuators.
Further it also covers the networking and communication protocols
among different IOT devices.
Course Outcome
End Semester Question Paper Template
Brief Introduction about the Subject with Videos

• https://www.youtube.com/watch?
v=KOa1aVijhao&t=873s&pp=ygUXcHJvZ
3JhbW1pbmcgdGhlIGFyZHVpbm8%3D
Prerequisite and Recap

PRE-REQUISITE:
Basic knowledge of programming of any language
CONTENTS

 History of microprocessor and microcontroller


 AVR and ARM devices
 Open source platforms
 PIC, Arduino and Raspberry Pi boards
 Python programming
 Sensor Characterization
 Code structures in programming
Objective of Unit-I

To Study of Basic concept of IOT and its


requirements.

Understand the basic idea about the different


open source platform used for development of IOT
infrastructure
Evolution of Intel Microprocessors
ARM and AVR
Open Source Platforms
• Open-source platforms and frameworks provide a
foundation for developers to build and deploy IoT
solutions quickly and cost-effectively.

• Additionally, open-source communities offer a


wealth of resources, such as
1. code,
2. documentation
3. support, that can help
developers accelerate their development efforts.
.

• open-source platform Eclipse Paho


provides a wide range of tools and
libraries for developing IoT applications.
• Paho can be used to connect to a variety
of IoT devices, including sensors,
actuators, and gateways.
• It also provides a variety of features for
managing IoT devices, such as data
collection, data storage, and data
analysis.
IoT-based system Requirements
IoT-based system should meet the following seven high-level
architecture requirements:
•Context: To capture context continuously, 24/7, throughout the
year.
•Standards: For utilizing communication protocols based on
standards between IoT devices and enterprise systems.
•Scalability: To respond to increased load by reducing performance,
not failing, and scaling capacity as resources are added.
•Data management: For efficiently handling massive volumes of
data.
•Connectivity: To offer high network connectivity for large data
payloads and uninterrupted streaming.
•Security: For securely moving and encrypting information, even
with introducing new risks and vulnerabilities posed by IoT.
•Interoperability: To connect all systems and ensure data
interoperability across the network.
How to choose an IOT product
• Cost
Open-source IoT frameworks don't cost any money because they're free. However, you may
need to adjust them to fit your specific needs.
• Innovation
The open-source code shared by the community encourages new ideas and creativity.
Developers can make different products that work on various systems like Android,
Windows, iOS, and Linux.
• Open APIs
Open-source IoT frameworks have special tools that let different software, hardware, and
systems talk to each other in a unified way.
• Libraries
Open-source IoT frameworks offer valuable resources like libraries, software development kits
(SDKs), and open-source hardware such as Raspberry Pi and Arduino. These tools help
companies stay updated with the latest technology and customize their IoT platforms.
• Security
Open-source software can protect people's data using strong security methods like encryption
(SSH, SSL, and PGP). It's an important part of keeping mobile devices secure and
protecting data.
• Interoperability
Open source technology helps different IoT systems work together smoothly, solving the
problem of devices being unable to talk to each other easily.
Challenges With Open Source IoT
Architecture
• Complexity: Open-source IoT can be complex for
organizations with limited expertise or resources.
• Fragmentation: Different open-source IoT components can
be incompatible, leading to integration challenges.
• Security risks: Improper implementation or maintenance of
open-source IoT can pose security threats.
• Scalability: Scaling open-source IoT may require additional
resources to handle many devices or data-intensive
applications.
• Integration with proprietary systems: Integrating open-
source IoT with existing proprietary systems can be difficult
due to differences in protocols, interfaces, and data formats.
• Intellectual property concerns: You must consider
intellectual property implications and comply with licenses
when adopting open-source IoT.
Different Open Source Platforms
• Things Board- ThingsBoard is for data collection, processing,
visualization, and device management. It upholds all standard IoT protocols like
CoAP(Constrained Application Protocol, MQTT (Message Queueing Telemetry
Transport, and HTTP.

• NODE-RED- It provides developers to connect physical devices, cloud


systems, databases and APIs using a browser-based flow editor. It is compatible
with Mac, Windows, Linux, Raspberry Pi and Industrial IOT gateways.

• Open Remote
• Flutter
• Arduino
• Kinoma
• Thinger.io
Creative Coding languages
Here are some of the top choices that are being used to build the foundations
of the next generation of things connected to the Internet.
1.Java
> known for being “write once, run anywhere.”
> The original project was aimed at set-top boxes, one of the first domains for non-desktop computing.
Developers can create and debug code on their desktop and then move it to any chip with a Java Virtual Machine.
That means the code can run not just on places where JVMs are common (servers and smartphones), but also on
the smallest machines.
Java ME, or micro edition, has been available on small phone handsets and other embedded devices.
 It saved space with a very limited collection of class libraries and other tools.

2. C programming
The syntax is cluttered with punctuation.
There are a million different little mistakes you can make, but the language is still the first choice for many
programmers who write for the lowest layer of software, the one closest to the hardware.
The language hides nothing from you, and that means you can fiddle with every part of the code to squeeze out
the best performance from an underpowered device.
 Every bit can be flipped. Every value on the stack is available. Just don’t make a mistake, because there are few
safety nets.
When a smartphone comes from Apple, much of the programming is still done in Objective C, but this will
probably be gradually replaced by Swift.
3. Python
Python is the language of choice for one of the most popular
microcontrollers on the market, the Raspberry Pi,” said Covey
It started as a scripting language to glue together real code, but it’s increasingly used as the main language for many
developers.
The syntax is clean and simple, attracting a greater range of programmers.
Extensive support libraries(NumPy for numerical calculations, Pandas for data analytics, etc.)
In Python, we don't need to declare the type of variable because the types and values can both be changed during
runtime.
Python can be used on various platforms such as iOS, Android, Windows phones, and desktops.

4. JavaScript
Normally JavaScript used as a language for popping up alert boxes on web pages.
Newfound popularity on the server makes it a surprisingly popular choice for IoT applications.
Focused on the servers and gateways or hubs that gather the information and then store it.
JavaScript is compatible with many hardware platforms such as Raspberry Pi and Arduino, making it a great choice for
IoT development.
There are various libraries and frameworks available for building IoT applications with JavaScript. Some popular ones
are : NODE-RED, Cyclon.js, Johnny-five, Noduino, Zetta etc.
5. Swift
Swift is still mainly used to build applications for Apple’s iOS and macOS devices.
If you want your things to interact with an iPhone or an iPad, you’re probably going to want to build the app in Swift (or
perhaps its predecessor, Objective C).

6. PHP
This language may be the first choice of bloggers and website prototypers, but it is also surprisingly popular in the IoT.
While the code’s role on the server to juggle microservices is an obvious application, it is also finding some traction at
the lowest level.
A number of Raspberry Pi developers are talking about starting up a full LAMP stack with Apache, MySQL, and PHP
running on top of Linux. They are effectively inverting the paradigm and turning the lowliest thing on the Internet into a
full web server.
Python in IOT:
• Automotive industry has allowed IoT to
revolutionize the automotive industry. The IoT
makes driving safe and efficient.
• Range of benefits in agriculture from
improving productivity to crop failure risks.
• IoT to diagnose a problem and avoid failure of
the system is helping in preventing the
breakdown scenario.
Python in IOT:
• Python is a very popular high-level programming language that
focuses on code readability. It is a dynamic and interpreted
programming language.
• Python can be used for software development, mathematics, web
development, and system scripting.
• In Python web development, developers use python on the server-
side to develop web applications. Python can handle big and complex
data easily. It can work on different platforms Windows, Mac, Linux,
and Raspberry Pi.
• Python can be treated as procedural, functional and object-oriented,
etc. With the scripting language, you can develop desktop
applications and web applications. It also translated into binary
language like java.
Python in IOT:
Languages used in IOT
•C
• C++
• Java
• Javascript
• PHP
• Python and many more
Python in IOT:
Easy to code: With the clear syntax developers get an idea on code identification instead of {};
Simple Syntax: Python has a simple syntax similar to the English Language
Interpreted Language: Python runs on interpreter system. The code can be executed as soon as it is
written. Prototyping can be very quick.
Embeddable: Python allows integration with other languages. It is possible to put our code in other
programming languages like C++ etc.
Extensible: Python is extensible language. It allows developers to write programs with fewer lines than
some other programming languages.
Portable: Python code is portable there is no need to change the code for different machines. You can run
one code in many machines.
Free and open-source: Python is open-source language. Its source code is freely available to the public you
can download it, change it and distribute it.
Community supports: Python has already got its huge response in the market with the above-mentioned
features thus provides many users grouped into community to support the advancements further.
Easy to debug: Python scripting language is one of the better language to debug than C++ and C. In this
source code is executed line by line.
Library support: Python supports large standard libraries. Installation of the libraries is easy, and it saves
time.
Python on Pi-Board
 The next great solution for Python in IoT devices is the Pi-Board with an ARM
microcontroller.
 Pi-Board is a compact & powerful electronics development board that runs
Micro Python.
 It connects to your PC via USB, giving you a USB flash drive to save your
Python scripts and a serial Python prompt (a REPL) for instant programming.
 This works with Windows, Mac, and Linux.
 The built-in Pib module contains functions and classes to control the
peripherals available on the board, such as UART, I2C, SPI, ADC, and DAC.
SKETCHES in Arduino
• A sketch is the name that Arduino uses
for a program.
• A sketch has 3 parts
1. Structure
2. functions
3. Variables and constants
Structure and Function
Arduino sketch has 2 functions in its structure
1.Setup()
Used to initialize the variables, pin modes, libraries etc.
Gets executed once
Formation is like
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output

}
2.loop()
Used to execute the desired function multiple times
void loop ()
{
}
Values(variable and constants)-:
.

A variable is a place for storing a piece of data. It has


•a name,
•a type(character, word, floating number, byte integer etc), and
•a value.
Variable types-
Local variable Global Variable
Declared inside the function Declared outside of the function
Void setup() { Int T,S ;
} Float c ;
Void loop() { Void setup() {
Int x, y ; }
Int z ; Void loop() {
Z=x+y ; }
}
Constant
.

•To declare a constant in the sketch


const int sensor_pin=1 ;
ARDUINO PROGRAM CONTROL FLOW, STRUCTURE AND STATEMENTS
Single threaded means lines of codes are executed one code at a time, while
sequential means onecode line is executed after another. This method of
program execution can be referred to as “Program Control Flow”.

Control statements are elements (functions) in a source code that control the
flow of program execution, either to wait, jump, repeat, etc. Arduino control
statements include:
• If statement • Else statement
• Else if statement • For statement
• While statement • Do while statement
If Statement
If and Else
For Loop
While Statement
Do while statement
Sensor Characterization
• Static Characteristics- sensor output when constant input is
applied
 Accuracy- output should be close to the standard known value.
 Range- maximum and minimum value that the sensor can measure.
Exp: temperature sensor range could be -10°C to 50°C
 Span- span = max – min value of sensor
Exp: for the above temp sensor, span= 50-(-10)= 60°C
 Precision- Capability of the device to give similar result every time at
similar applied input.
Sensor Characterization
 Linearity- Device must show constant change in output for a defined
change in input i.e. ratio of output to input must be constant
 Sensitivity-

Dynamic Characteristics
 Speed of response with respect to the input
 Response to the system i.e.
first order- normally have linear elements
second order or higher order system- normally have energy storing
elements
INTERFACING THE REAL WORLD
IoT applications promise to bring immense value into our lives. IoT
applications are expected to equip billions of everyday objects with
connectivity and intelligence. It is already being deployed extensively, the
outline of the article is as follows:
•Prediction of natural disasters
•Industry applications
•Water Scarcity monitoring
•Medical applications
•Design of smart homes
•Agriculture application
•Intelligent transport system design
•Design of smart cities
•Smart metering and monitoring
References
Text books:
1.Programming Interactivity, Second Edition By Josha
Noble, 2012
2.Programming the Raspberry Pi: Getting Started with
Python 2E, 2016

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy