0% found this document useful (1 vote)
342 views57 pages

Unit-2: Embedded Devices-1: Dr. M.S. Pradeep Kumar Patnaik

The document discusses embedded devices and introduces concepts related to embedded systems including microcontrollers, system-on-chips, choosing development platforms, and the Arduino platform. It outlines the course objectives which are to introduce IoT fundamentals, expose students to embedded boards and IoT platforms, and enable students to create simple IoT applications. The learning outcomes are for students to explain microcontroller basics, outline the Arduino architecture, and develop simple applications using Arduino.

Uploaded by

Vamshidhar Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
342 views57 pages

Unit-2: Embedded Devices-1: Dr. M.S. Pradeep Kumar Patnaik

The document discusses embedded devices and introduces concepts related to embedded systems including microcontrollers, system-on-chips, choosing development platforms, and the Arduino platform. It outlines the course objectives which are to introduce IoT fundamentals, expose students to embedded boards and IoT platforms, and enable students to create simple IoT applications. The learning outcomes are for students to explain microcontroller basics, outline the Arduino architecture, and develop simple applications using Arduino.

Uploaded by

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

Unit-2: Embedded Devices-1

Dr. M.S. Pradeep Kumar Patnaik


Assistant Professor
Department of EECE
GITAM Institute of Technology (GIT)
Visakhapatnam – 530045
Email: [email protected]
Course Objectives

• Introduce the fundamental concepts of IoT and physical computing


• Expose the student to a variety of embedded boards and IoT
Platforms
• Create a basic understanding of the communication protocols in IoT
communications.
• Familiarize the student with application program interfaces for IoT.
• Enable students to create simple IoT applications.
Learning Outcomes:

• After completion of this unit, the student will be able to:


• explain the basics of microcontrollers(L2)
• outline the architecture of Arduino(L2)
• develop simple applications using Arduino(L3)
Overview
 Embedded Computing Basics
 Microcontrollers
 System-on-Chips
 Choosing Your Platform
 Arduino
 Developing on the Arduino
 Some Notes on the Hardware
 Openness.

SESSION -1
Electronics Overview

• One of the main areas where something vastly overpowered, and in theory much more expensive, can be the
right choice for prototyping is using a mobile phone, laptop, or desktop computer to develop the initial software.
• If you already have a phone or computer which you can use, using it for your prototype isn’t actually any more
expensive.
• Even if you know that the board you’re using won’t be the ideal fit for a final version, if it lets you try out some
of the functionality more quickly or more cheaply, that can mean it’s the right choice for now.
• Most of the prototyping can be done on what are called solderless breadboards.
• They enable you to build components together into a circuit with just a push-fit connection, which also
means you can experiment with different options quickly and easily.
• When it comes to thinking about the electronics, it’s useful to split them into two main categories:
• A. Sensors: Sensors are the ways of getting information into your device, finding out things about your
surroundings.
• B. Actuators: Actuators are the outputs for the device—the motors, lights, and so on, which let your device
do something to the outside world.
• Within both categories, the electronic components can talk to the computer in a number of ways.
SCALING UP THE
ELECTRONICS
• From the perspective of the electronics, the starting point for prototyping is usually a “breadboard”. It lets push-fit
components and wires to make up circuits without requiring any soldering and therefore makes experimentation
easy.
• When things are wired up, it’s common to solder the components onto some protoboard, which may be sufficient to
make the circuit more permanent and prevent wires from going astray.
• For small production runs, use through-hole components, so called because the legs of the component go through
holes in the PCB and tend to be soldered by hand.
• Can often create your designs as companion boards to an existing microcontroller platform, generally called shields
in the Arduino community.
• Breadboard PCB(printed circuit board)

• Moving to a combined board allows you to remove any unnecessary components from the microcontroller
board, and switching to surface mount components, where the legs of the chips are soldered onto the same
surface as the chip, eases the board’s assembly with automated manufacturing lines.
Embedded Computing Basics
• When talking about computing power getting cheaper and more powerful,
cannot just throw a bunch of PC components into something and call it an
Internet of Things (IoT) product.
• If ever opened up a desktop PC then might have seen that it’s a collection of
discrete modules to provide different aspects of functionality.
• It has a main motherboard with its processor, one or two smaller circuit boards
providing the RAM, and a hard disk to provide the long-term storage.
• So, it has a lot of components, which provide a variety of general-purpose
functionality and which all take up a corresponding chunk of physical space.
• A device embeds software into the computing and communication
hardware, and the device functions for the applications.
Embedded Software
Software consists of instructions, commands and data.
A computing and communicating device needs software.
Software does the bootloading and enables the applications and
services. The software includes an OS.
A device embeds software which also includes the device application
programming interface (API)  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.
A bootloader initiates loading of system software (OS) when the system
power is switched on, and power-on-self test completes.
Bootloader may also facilitate the use of system hardware and networking
capabilities. Bootloader loading of the OS may be from an external source.
Alternatively, bootloader can itself function as a system software, when
the codes for IO functions and OS basic system functions happen to be
from the same source.
Booting is said to complete when normal, operational runtime
environment is attained.
Operating System
An operating system is a program that acts as an interface
between the user and the computer hardware and controls the
execution of all kinds of programs.
An operating system (OS) is system software that
manages computer hardware, software resources and provides
common services for computer programs.
Integrated Development
Environment (IDE)
 Integrated Development Environment (IDE) is a set of software
components and modules which provide 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 the hardware platform.
IDE enables software that communicates with the Internet web server
or cloud service.
The work of a developer is complex and time-consuming, but arming
yourself with the most sophisticated tools makes the job both quicker
and easier. That’s why many developers turn to integrated
development environments (IDEs) to manage workflows, access a suite
of development tools within a single dashboard, and reduce errors that
can have catastrophic consequences if deployed unchecked.
Operating System
Important functions of an operating
System.
Memory Management
Processor Management
Device Management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
Real Time Operating System (RTOS)

 RTOS is stands for “Real time operating system”, and


it is also known as embedded operating system.
 This operating system intended to serve real time
application that process data as it comes in, mostly
without buffer delay.
It enables real-time execution of processes on
computing and communication hardware. RTOS uses
prioritisation and priority allocation concept to enable
the execution of processes in real-time.
IDE consists of the device APIs, libraries, compilers, RTOS,
simulator, editor, assembler, debugger, emulators, logic analyser,
application codes’ burner for flash, EPROM and EEPROM and
other software components for integrated development of a system.
IDE may be open source.
 For example, Arduino has opensource IDE from the Arduino
website.
IDEs offer a central interface featuring all the tools a developer needs,
including the following:
Code editor: This feature is a text editor designed for writing and editing
source code. Source code editors are distinguished from text editors
because they enhance or simplify the writing and editing of code.
Compiler: This tool transforms source code written in a human
readable/writable language into a form executable by a computer.
Debugger: This tool is used during testing to help debug application
programs.
Build automation tools: These tools automate common developer tasks.
Benefits of IDE

The overall goal and main benefit of an integrated development environment is


improved developer productivity. IDEs boost productivity by reducing setup time,
increasing the speed of development tasks, keeping developers up to date and
standardizing the development process.
 Faster setup: Without an IDE interface, developers would need to spend time
configuring multiple development tools. With the application integration of an
IDE, developers have the same set of capabilities in one place, without the need
for constantly switching tools.
 Faster development tasks: Tighter integration of all development tasks improves
developer productivity. For example, code can be parsed and syntax checked while
being edited, providing instant feedback when syntax errors are introduced.
Developers don’t need to switch between applications to complete tasks. In
addition, the IDE’s tools and features helps developers organize resources, prevent
mistakes and take shortcuts.
Further, IDEs streamline development by encouraging holistic
thinking. They force developers to think of their actions in terms of the
entire development lifecycle, rather than as a series of discrete tasks.
 Continual learning: Staying up to date and educated is another
benefit. For instance, the IDE’s help topics are constantly being
updated, as well as new samples, project templates, etc.
Programmers who are continually learning and current with best
practices are more likely to contribute value to the team and the
enterprise, and to boost productivity.
 Standardization: The IDE interface standardizes the development
process, which helps developers work together more smoothly and
helps new hires get up to speed more quickly.
Embedded Hardware Units
The hardware includes the following:
 Single VLSI (very-large integrated) chip
 A core in an application specific instruction set
processor (ASIP), called MCU
A core in an application specific integrated circuit (ASIC)
core
 A core in System-On-Chip (SoC) or an SoC chip with an
SD card for embedded software and operating system
(OS) software.
MICROCONTROLLERS
• A microcontroller (MCU for microcontroller unit) is a small computer on
a single metal-oxide- semiconductor (MOS) integrated circuit (IC) chip.
• A microcontroller contains one or more CPUs (processor cores) along
with memory and programmable input/output peripherals.
• Internet of Things devices take advantage of more tightly integrated and
miniaturised solutions, from the most basic level of microcontrollers to
more powerful system-on-chip (SoC) modules.
• These systems combine the processor, RAM, and storage onto a single
chip, which means they are much more specialised, smaller than their PC
equivalents, and also easier to build into a custom design.
• Application-specific MCUs have additional on-chip functional units,
such as PWM circuits (1, 2 or 3), ADC (1, 2, 4 or higher) and other
functional units.
https://www.theengineeringprojects.com/2018/03/introduction-to-microcontrollers.html
https://www.electronicshub.org/microcontrollers-basics-structure-applications/
Figure shows the on-chip functional units in
a microcontroller.

 An MCU(microcontroller unit) is an IC chip, available from a number of sources, such as ATMEL,


Nexperia, Microchip, Texas Instruments or Intel.
MCU Specifications
 MCU can be of 8-bit, 16-bit or 32-bit family.
 MCU clock frequency can be 8 MHz, 16 MHz, 100 MHz, 200 MHz or
higher. The clock frequency depends on the version and family.
Performance defines number of instructions executed per sec that
primarily depends on the clock frequency also. A metric for performance
is Million Instructions Per Second (MIPS). Another metric for
performance is Million Floating Point Operations Per Second (MFLOPS).
 MCU includes RAM which can be 4 kB, 16 kB, 32 B or higher. RAM
read and write of byte takes an instruction cycle each. RAM is used for
temporary variables, stacks and run-time need of the memory.
 MCU includes EEPROM and flash memory, which may be 512 B, 1 kB, 2 kB, 4 kB,
16 kB, 64 kB, 128 kB, 512 kB or higher. Flash stores the programs, data, tables and
required information during building and testing stages, and then stores a final
version of the application program in the embedded device.
 MCU includes timers, I/O ports, GPIO pins, serial synchronous and asynchronous
ports and interrupt controllers.
 MCU includes several functional units in specific version, such as ADC, multi-
channel ADC or ADC with programmable positive and negative reference voltage
pins, PWMs, RTC, I2C, CAN and USB ports, LCD interface, ZigBee interface,
Ethernet, modem or other functional units, depending on a specific source, family,
group and version.
https://
www.youtube.com/watch?v=jKT4H0bstH8&ab_channel=MicrochipTechnology
System On Chip
A system on a chip, also known as an SoC, is essentially an integrated circuit
or an IC that takes a single platform and integrates an entire electronic or
computer system onto it. It is, exactly as its name suggests, an entire system
on a single chip.
An SoC for a sound-detecting device, for example, might include an audio
receiver, an analog-to-digital converter (ADC), a microprocessor, memory,
and the input/output logic control for a user - all on a single chip.
An SoC integrates a microcontroller, microprocessor or perhaps several
processor cores with peripherals like a GPU, Wi-Fi and cellular
network radio modems, and/or one or more coprocessors. 
Similar to how a microcontroller integrates a microprocessor with peripheral
circuits and memory, an SoC can be seen as integrating a microcontroller
with even more advanced peripherals. 
https://
www.youtube.com/watch?v=L4XemL7t6hg&ab_channel=Techquickie
https://
www.youtube.com/watch?v=FUhCrWoNA2c&ab_channel=ALLABOUTELE
CTRONICS
 System-on-a-chip technology is used in small, increasingly complex
consumer electronic devices. Some such devices have more processing
power and memory than a typical 10-year-old desktop computer.
In the future, SoC-equipped nanorobots (robots of microscopic
dimensions) might act as programmable antibodies to fend off
previously incurable diseases.
SoC video devices might be embedded in the brains of blind people,
allowing them to see and SoC audio devices might allow deaf people
to hear.
Handheld computers with small whip antennas might someday be
capable of browsing the Internet at megabit-per-second speeds from
any point on the surface of the earth.
Benefits of Socs
 One of the main motivators behind the creation of
systems on a chip is the fact that moving ahead into
the future, our primary goal is to reduce energy waste,
save up on spending costs, as well as reduce the space
occupied by large systems.
With an SoC, you achieve all of those goals as you
essentially size down what is normally multichip
designs onto a single processor that uses much less
power than before.
An SoC usually contains various components such as

Operating system
Utility software applications
Voltage regulators and power management circuits
Timing sources such as phase lock loop control systems or
oscillators
A microprocessor, microcontroller or digital signal processor
Peripherals such as real-time clocks, counter timers and
power-on-reset generators
External interfaces such as USB, FireWire, Ethernet, universal
asynchronous receiver-transmitter or serial peripheral
interface bus
Analog interfaces such as digital-to-analog converters and
analog-to-digital converters
RAM and ROM memory
SoC Advantages
Essentially the great benefits of using an SoC are:
power saving, space saving and cost reduction
SoCs are also much more efficient as systems as their
performance is maximized per watt
Systems on chip also tend to minimize the latency
provided the various elements are strategically placed
on the motherboard in order to minimize interference
and interconnection delays as well as speed up the
data transmission process
CHOOSING YOUR PLATFORM
 An IoT platform is an integral part of any IoT product. It can help you accelerate your
time-to-market, minimize risk, reduce development cost, and help you arrive at product-
market fit faster.
Selection among the number of different available platforms depends on a number of
factors like price, open-source availability, ease of application development and needed
capabilities, performance required from IoT device and suitability for developing and
using for prototyping and designing.
 Think of an Internet of Things platform as a group of technologies that provide the
building blocks for developing your product. IoT platforms provide the “infrastructure”
you use to create the specific features of your solution.
The goal of an IoT platform is to provide all the generic functionality for your application
so you can focus on building features that differentiate your product and add value for
your customers.
An IoT product needs to:

1.Acquire real-world data via sensors


2.Analyze data locally (edge computing)
3.Connect to the cloud to transmit data and
receive commands
4.Store data in the cloud
5.Analyze data in the cloud to create insights
6.Command the “things” to perform specific tasks based
on insights
7.Present insights to users
Additionally, there are important “behind-the-scenes”
capabilities IoT platforms should provide:
1.Perform all operations securely across the IoT
technology stack.
2.Identify and manage all of your IoT devices (at scale)
Based on this simplified description, a good IoT
platform should provide the tools and infrastructure to
cover as many of these tasks as possible.
a)Hardware
The choice, beside the price, of embedded hardware depends on the following:
 Processor speed required which depends upon the applications and
services. For example, image and video processing need the high-speed
processors.
 RAM need which may be 4 kB or higher depending upon the OS and
applications. For example, requirement is 256 kB for using the Linux
distribution. New generation mobile phones have over one GB RAM.
 Connection needs to ZigBee, ZigBee IP, Bluetooth LE, Wi-Fi or Wired
Ethernet for networking using a supporting circuit (shield)
USB host
Sensor, actuator and controllers interfacing circuits, such as ADC, UART,
I2C, SPI, CAN single or multiples
Power requirements, V- and V+, 0 V and 3.3 V or 0 V and 5 V or other.
b)Processor Speed
• Processor speed tells how fast it can process the individual instructions in
the machine code for the program it’s running. Naturally, a faster processor
speed means that it can execute instructions more quickly.
• Some processors may lack hardware support for floating-point calculations,
so if the code involves a lot of complicated mathematics, a by-the-numbers
slower processor with hardware floating-point support could be faster than a
slightly higher performance processor without it.
• Microcontrollers tend to be clocked at speeds in the tens of MHz, whereas
SoCs run at hundreds of MHz or possibly low GHz.
c)RAM
• RAM provides the working memory for the system.
If you have more RAM, you may be able to do more
things or have more flexibility over your choice of
coding algorithm.
• If handling large datasets on the device, that could
govern how much space is needed then can often
find ways to work around memory limitations, either
in code or by handing off processing to an online
service.
• Microcontrollers with less than 1KB of RAM are
unlikely to be of interest, and if you want to run
standard encryption protocols, you will need at least
4KB, and preferably more.
• For SoC boards, particularly to run Linux as the
operating system, it is recommended at least
256MB.
d)Networking
• Wired Ethernet is often the simplest for the user—generally plug and play—and
cheapest, but it requires a physical cable.
• Wireless solutions obviously avoid that requirement but introduce a more complicated
configuration.
• Wi-Fi is the most widely deployed to provide an existing infrastructure for connections,
but it can be more expensive and less optimized for power consumption than some of its
competitors.
• Other short-range wireless can offer better power-consumption profiles or costs than Wi-
Fi but usually with the trade-off of lower bandwidth.
• ZigBee aimed particularly at sensor networks and scenarios such as home automation.
The recent Bluetooth LE protocol (also known as Bluetooth 4.0) has a very low power-
consumption profile similar to ZigBee’s and could see more rapid adoption due to its
inclusion into standard Bluetooth chips included in phones and laptops.
• For remote or outdoor deployment, little beats simply using the mobile phone
networks.
• For low-bandwidth, higher-latency communication, could use something as basic as
SMS; for higher data rates, will use the same data connections, like 3G, as a
smartphone.
e)USB
• If a device can rely on a more powerful computer being
nearby, tethering to it via USB can be an easy way to
provide both power and networking.
• Can buy some of the microcontrollers in versions which
include support for USB, so choosing one of them reduces
the need for an extra chip in the circuit.
• USB “host” configuration connect items that would
normally expect to be connected to a computer—devices
such as phones, for example, using the Android ADK,
additional storage capacity, or Wi-Fi dongles.
• Devices such as Wi-Fi dongles often depend on additional
software on the host system, such as networking stacks, and
so are better suited to the more computer-like option of
SoC.
f)Power Consumption
• For devices which might be portable or rely on an
unconventional power supply (batteries, solar power)
depending on where they are installed, power
consumption may be an issue.
• Even with access to mains electricity, the power
consumption may be something to consider because
lower consumption may be a desirable feature.
• Processors may have a minimal power-consumption
sleep mode.
• This mode may allow you to use a faster processor to
quickly perform operations and then return to low-
power sleep.
• Therefore, a more powerful processor may not be a
disadvantage even in a low-power embedded device.
g)Interfacing with Sensors
and Other Circuitry
• In addition to talking to the Internet, device needs to interact with something else—
either sensors to gather data about its environment; or motors, LEDs, screens, and so
on, to provide output.
• Can connect to the circuitry through some sort of peripheral bus—SPI and I2C
being common ones—or through ADC or DAC modules to read or write varying
voltages;
• or through generic GPIO pins, which provide digital on/off inputs or outputs.
• Different microcontrollers or SoC solutions offer different mixtures of these
interfaces in differing numbers.
h)Physical Size and Form
Factor
• The continual improvement in manufacturing techniques for silicon chips means that long passed the point
where the limiting factor in the size of a chip is the amount of space required for all the transistors and other
components that make up the circuitry on the silicon.
• Nowadays, the size is governed by the number of connections it needs to make to the surrounding
components on the PCB.
• With the traditional through-hole design, most commonly used for homemade circuits, the legs of the chip
are usually spaced at 0.1" intervals. Even if chip has relatively few connections to the surrounding circuit—16
pins is nothing for such a chip—will end up with over 1.5" (~4cm) for the perimeter of your chip.
• More complex chips can easily run to over a hundred connections; finding room for a chip with a 10" (25cm)
perimeter.
• The limit to the size that each connection can be reduced to is then governed by the capabilities and
tolerances of your manufacturing process.
• Some surface-mount designs are big enough for home-etched PCBs and can be hand-soldered.
• Others require professionally produced PCBs and accurate pick-and-place machines to locate them correctly.
Physical Size and Form
Factor
• Due to these trade-offs in size versus manufacturing complexity, many chip designs are available
in a number of different form factors, known as packages.
• This lets the circuit designer choose the form that best suits his particular application.
• All three chips pictured in the following figure provide identical functionality because they are all
AVR ATmega328 microcontrollers.
• The one on the left is the through-hole package, mounted here in a socket so that it can be
swapped out without soldering.
• The two others are surface mount, in two different packages, showing the reduction in size but at
the expense of ease of soldering.
Below are some of the factors you could look out for when selecting a platform;
1.Type of Service and Model
2.Compatibility (Architecture and Technology Stack)
3.Domain Expertise
4.Reliability
5.Connectivity
6.Scalability
7.Security
8.Device management and monitoring features
9.Integrations and Data handling
10.Support
11.Cost
ARDUINO
• The poster child for the Internet of Things, and
physical computing in general, is the Arduino.
• It’s birth was in Ivrea in Northern Italy in 2005. A
group from the Interaction Design Institute Ivrea
(IDII) wanted a board for its design students to use
to build interactive projects.
• The team put together a board which was cheap to
buy—around £20—and included an onboard serial
connection to allow it to be easily programmed.
• Combined with an extension of the Wiring
software environment, it made a huge impact on
the world of physical computing.
Wiring: Sketching in
Hardware
• http://wiring.org.co/about.html
• “The idea is to write a few lines of code, connect a few electronic components to the hardware of
choice and observe how a light turns on when person approaches to it, write a few more lines add
another sensor and see how this light changes when the illumination level in a room decreases.
• This process is called sketching with hardware—a way to explore lots of ideas very quickly, by
selecting the more interesting ones, refining them, and producing prototypes in an iterative
process.”
• The Wiring platform provides an abstraction layer over the hardware, so the users need not worry
about the exact way to, say, turn on a GPIO pin, and can focus on the problem they’re trying to
explore or solve.
• That abstraction also enables the platform to run on a variety of hardware boards.
• There have been a number of Wiring boards since the project started, although they have been
eclipsed by the runaway success of the project that took the Wiring platform and targeted a lower-
end and cheaper AVR processor: the Arduino project.
ARDUINO contd…
• The Arduino team’s focus on simplicity rather than raw performance for the
code has made the Arduino the board of choice in almost every beginner’s
physical computing project, and the open source ethos has encouraged the
community to share circuit diagrams, parts lists, and source code.
• It’s almost the case that whatever your project idea is, a quick search on
Google for it, in combination with the word “Arduino”, will throw up at least
one project that can help bootstrap what you’re trying to achieve.
• The “standard” Arduino board has gone through a number of iterations:
• Arduino NG, Diecimila, Duemilanove, and Uno.
[https://www.arduino.cc/en/main/boards]
• The Uno features an ATmega328 microcontroller and a USB socket for
connection to a computer. It has 32KB of storage and 2KB of RAM, the
Uno also provides 14 GPIO pins (of which 6 can also provide PWM
output) and 6 10-bit resolution ADC pins.
• The ATmega’s serial port is made available through both the IO pins and,
via an additional chip, the USB connector.
• For more space or a greater number of inputs or outputs, refer the Arduino
Mega 2560. It marries/(combines with) a more powerful ATmega
microcontroller to the same software environment, providing 256KB of
Flash storage, 8KB of RAM, three more serial ports, a massive 54 GPIO
pins (14 of those also capable of PWM) and 16 ADCs.
• Alternatively, the more recent Arduino Due has a 32-bit ARM core
microcontroller and is the first of the Arduino boards to use this
architecture. RAM to 96KB.
DEVELOPING ON THE
ARDUINO
• The experience of working with a board is the most important factor,
at the prototyping stage.
• The Arduino is optimised for simplicity and ease of use.
• A single USB cable is used not only to power the board but also push
code onto it, and (if needed) communicate with it(example, for
debugging or to use the computer to store data retrieved by the sensors
connected to the Arduino).
a) Integrated Development
Environment
• Arduino is developed using the integrated development environment
(IDE) although this is a fully functional IDE, based on the one used
for the processing language, it is very simple to use.
• Most Arduino projects consist of a single file of code, so IDE is
mostly as a simple file editor.
• The controls that are used to check the code (by compiling it) or to
push code to the board.
b) Pushing Code
• Connecting to the board should be relatively straightforward via a USB cable. Sometimes
issues are present with the drivers (especially on some versions of Windows) or with
permissions on the USB port.
• Then need to choose the correct serial port and the board type from the appropriate menus,
should need to look carefully at the labelling on your board and its CPU to determine
which option to select.
• When the setup is correct, the process of pushing code is generally simple:
• First, the code is checked and compiled, with any compilation errors reported to the user.
• If the code compiles successfully, it gets transferred to the Arduino and stored in its flash
memory.
• At this point, the Arduino reboots and starts running the new code.
c)Operating System
• When board is switched on, it simply runs the code that was
compiled until the board is switched off again (or the code crashes).
• A lightweight real-time operating system (RTOS) such as
FreeRTOS/DuinOS is uploaded to the arduino.
• The main advantage of one of these operating systems is their built-
in support for multitasking. For many purposes, reasonable results
can be achieved with a simpler task-dispatching library.
• It is even possible to compile code without using the IDE but by
using the toolset for the Arduino’s chip—for example, for all the
boards until the recent ARM-based Due, the avr-gcc toolset.
http://www.nongnu.org/avr-libc/
• The avr-gcc toolset (www.nongnu.org/avr-libc/) is the collection of
programs that let you compile code to run on the AVR chips used by
the rest of the Arduino boards and flash the resultant executable to
the chip.
• It is used by the Arduino IDE behind the scenes but can be used
directly.
d) Language
• The language usually used for Arduino is a slightly modified dialect of C++ derived from the
Wiring platform.
• It includes some libraries used to read and write data from the I/O pins provided on the Arduino
and to do some basic handling for “interrupts” (a way of doing multitasking, at a very low level).
• This variant of C++ tries to be forgiving about the ordering of code. This alteration is useful to be
able to order things in a way that the code is easy to read and maintain, given that it tends to be
written in a single file.
• The code needs to provide only two routines:
◾ setup(): This routine is run once when the board first boots. Use it to set the modes of I/O pins
to input or output or to prepare a data structure which will be used throughout the program.
◾ loop(): This routine is run repeatedly in a tight loop while the Arduino is switched on. Typically
check some input, do some calculation on it, and perhaps do some output in response.
simple example across all the
boards—blinking a single LED
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
delay(1000); // wait for a second
}

• setup() function does very little; it just sets up that pin number 13 is the one that is going to control.
• In loop(), the LED is turned on and then off, with a delay of a second between each flick of the (electronic) switch.
e) Debugging
• C++ is a compiled language, a fair number of errors, such as bad syntax or failure to declare variables, are caught at
compilation time.
• So, compiler provides detailed and possibly helpful information about the type of problem.
• Ex: Blink.cpp: In function ‘void loop()’:Blink:21:
error:’digitalWrite’ was not declared in this scope
• in the function loop(), deliberately misspelled the call to digitalWrite.
• Arduino isn’t generally connected to a screen, it is hard for it to tell user when something goes wrong.
• Even if the code compiled successfully, certain errors still happen. An error could be raised that can’t be handled, such as
a division by zero, or trying to access the tenth element of a 9-element list.
• Or perhaps your program leaks memory and eventually just stops working.
• Or (and worse) a programming error might make the code continue to work dutifully but give entirely the wrong results.
• In the absence of a screen, the Arduino allows you to write information over the USB cable using Serial.write().
• Arduino IDE provides a serial monitor which echoes the data that the Arduino has sent over the USB cable.
• This could include any textual information, such as logging information, comments and details about the data that the
Arduino is receiving and processing.
SOME NOTES ON THE
HARDWARE
• https://
www.youtube.com/watch?v=Yj639_ez6TM&ab_channel=Make%3A
Lilypad
• https://www.youtube.com/watch?v=Tt649mcmi5Y&ab_channel=Laur
enDehrone
• http://shieldlist.org/
OPENNESS
 The Arduino project is completely open hardware and an open hardware
success story. The only part of the project protected is the Arduino
trademark, so they can control the quality of any boards calling
themselves an Arduino. In addition to the code being available to
download freely, the circuit board schematics and even the EAGLE PCB
design files are easily found on the Arduino website.

 This culture of sharing has borne fruit in many derivative boards being
produced by all manner of people. Some are merely minor variations on
the main Arduino Uno, but many others introduce new features or form
factors that the core Arduino team have overlooked.
Arduino Case Study: The
Good Night Lamp
• https://
www.youtube.com/watch?v=FxLsZUTXYEU&t=3s&ab_channel=Good
NightLamp
• https://youtu.be/IVBCZ_QKW6Q
• A simple, consumer device, this lamp would be paired with another
lamp anywhere in the world, allowing it to switch the other lamp on
and off, and vice versa.
• Because light is integrated into our daily routine, seeing when our
loved ones turn, for example, their bedside lamp on or off gives us a
calm and ambient view onto their lives.
Arduino Case Study:
Botanicalls
• https://
www.youtube.com/watch?v=i7T82FZbAhg&feature=emb_logo&ab_chan
nel=Ignite
• https://www.botanicalls.com/
• Botanicalls is a collaboration between technologists and designers that
consists of monitoring kits to place in plant pots.
• The Botanicalls kits then contact the owner if the plant’s soil gets too dry.
• The project write-up humourously refers to this as “an effort to promote
successful interspecies understanding” and as a way of translating
between a plant’s communication protocols (the colour and drooping of
leaves) to human protocols, such as telephone, email, or Twitter.
Arduino Case Study:
BakerTweet
• https://www.youtube.com/watch?v=UKe1RJBX3Uc&ab_channel=SinPreocupaciones
• https://www.engadget.com/2009-04-03-bakertweet-the-arduino-based-pastry-early-warning-system.html
• The BakerTweet device (www.bakertweet.com/) is effectively a physical client for Twitter designed for use in a bakery.
• A baker may want to let customers know that a certain product has just come out of the ovens—fresh bread, hot muffins,
cupcakes laden with icing—yet the environment he would want to tweet from contains hot ovens, flour dust, and sticky
dough and batter, all of which would play havoc with the electronics, keyboard, and screen of a computer, tablet, or phone.
• Staff of design agency Poke in London wanted to know when their local bakery had just produced a fresh batch of their
favourite
• bread and cake, so they designed a proof of concept to make it possible.
• Because BakerTweet communicates using WiFi, bakeries, typically not built to accommodate Ethernet cables, can install it.
BakerTweet exposes the functionality of Twitter in a “bakery-proof” box with more robust electronics than a general-
purpose computer, and a simplified interface that can be used by fingers covered in flour and dough.
• It was designed with an Arduino, an Ethernet Shield, and a WiFi adapter.
• As well as the Arduino simply controlling a third-party service (Twitter), it is also hooked up to a custom service which
allows the baker to configure the messages to be sent.

You might also like