Nothing Special   »   [go: up one dir, main page]

CPE 412 Ch2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Embedded System

Chapter 2

Relevant Tools, Standards,


and/or Engineering Constraints
Chapter 2

Relevant Tools, Standards, and/or Engineering


Constraints
Introduction

This chapter introduces the reader to the planet of embedded systems. Everything that we
glance around us today is electronic. The days are gone where almost everything was manual.

Now even the food that we eat is cooked with the help of a microchip (oven) and the ease at
which we wash our clothes is thanks to the washing machine. This world of electronic items is
formed from embedded system. during this chapter we'll understand the fundamentals of
embedded system right from its definition.

Specific Objectives

At the end of the lesson, the students should be able to:

 Understand what is an Embedded System and then define it


 Look at embedded systems from a historical point of view
 Classify embedded systems
 Look at certain applications & purposes of embedded systems

Duration

Chapter 2: Relevant Tools, Standards, and/or = 1 hour


Engineering Constraints (45 minutes discussion; 15
minutes assessment)
Lesson Proper

Hardware

- An embedded system uses a hardware platform to perform the operation. The


hardware of the embedded system is assembled with a
microprocessor/microcontroller. It has elements such as input/output interfaces,
memory, user interface, and the display unit.

- Generally, an embedded system comprises of the following

• Power Supply
• Memory
• Processor
• Timers
• Output/Output circuits
• Serial communication ports
• SASC (System application-specific circuits).

Example:

The major components of Arduino UNO board are as follows:

• USB connector
• Power port
• Microcontroller
• Analog input pins
• Digital pins
• Reset switch
• Crystal oscillator
• USB interface chip
• TX RX LEDs

Now let’s take a closer look at each component.


USB connector

This is a printer USB port used to load a program from the Arduino IDE onto the
Arduino board. The board can also be powered through this port.

Power port

The Arduino board can be powered through an AC-to-DC adapter or a battery. The
power source can be connected by plugging in a 2.1mm center-positive plug into the
power jack of the board.

2.1mm center-positive plug

The Arduino UNO board operates at a voltage of 5 volts, but it can withstand a
maximum voltage of 20 volts. If the board is supplied with a higher voltage, there is a
voltage regulator (it sits between the power port and USB connector) that protects the
board from burning out.
Atmega328P microcontroller

It is the most prominent black rectangular chip with 28 pins. Think of it as the brains
of your Arduino. The microcontroller used on the UNO board is Atmega328P by Atmel
(a major microcontroller manufacturer).

Atmega328P has the following components in it:

 Flash memory of 32KB. The program loaded from Arduino IDE is stored here.
 RAM of 2KB. This is a runtime memory.
 CPU: It controls everything that goes on within the device. It fetches the program
instructions from flash memory and runs them with the help of RAM.
 Electrically Erasable Programmable Read Only Memory (EEPROM) of 1KB.
This is a type of nonvolatile memory, and it keeps the data even after device restart and
reset.

Atmega328P is pre-programmed with bootloader. This allows you to directly upload a


new Arduino program into the device, without using any external hardware
programmer, making the Arduino UNO board easy to use.

Analog input pins

The Arduino UNO board has 6 analog input pins, labeled “Analog 0 to 5.” These pins
can read the signal from an analog sensor like a temperature sensor and convert it into
a digital value so that the system understands. These pins just measure voltage and not
the current because they have very high internal resistance. Hence, only a small number
of current flows through these pins.

Although these pins are labeled analog and are analog input by default, these pins can
also be used for digital input or output.

Digital pins

You can find these pins labeled “Digital 0 to 13.” These pins can be used as either input
or output pins. When used as output, these pins act as a power supply source for the
components connected to them. When used as input pins, they read the signals from the
component connected to them.

When digital pins are used as output pins, they supply 40 milliamps of current at 5 volts,
which is more than enough to light an LED.

Some of the digital pins are labeled with tilde (~) symbol next to the pin numbers (pin
numbers 3, 5, 6, 9, 10, and 11). These pins act as normal digital pins but can also be
used for Pulse-Width Modulation (PWM), which simulates analog output like fading
an LED in and out.

Reset switch

When this switch is clicked, it sends a logical pulse to the reset pin of the
Microcontroller, and now runs the program again from the start. This can be very useful
if your code doesn’t repeat, but you want to test it multiple times.
Crystal oscillator

This is a quartz crystal oscillator which ticks 16 million times a second. On each tick,
the microcontroller performs one operation, for example, addition, subtraction, etc.

USB interface chip

Think of this as a signal translator. It converts signals in the USB level to a level that
an Arduino UNO board understands.

TX – RX indicator

TX stands for transmit, and RX for receive. These are indicator LEDs which blink
whenever the UNO board is transmitting or receiving data.
Now that you have explored the Arduino UNO board, you have started your journey
toward building your first IoT prototype. In the next article, we will discuss Arduino
programming and do a few experiments with Arduino and LEDs.

Software

Software components constitute programs such as compilers, integrated development


environments (IDE), assemblers, simulators, etc., which are used to create codes that
“instruct” the hardware to do the assigned job in an efficient manner.

Notable computer languages that are used for programming in embedded systems are
embedded C, embedded C++, embedded JAVA, and assembly. Here embedded C and
others contain a specific library for a microcontroller to work. (Like the specific header
files such as math.h, conio.h). Mostly, for simple applications, an assembly is used,
which produces more efficient, compact codes.

Example:

Arduino IDE

- Arduino IDE is an open-source software that is mainly used for writing and
compiling the code into the Arduino Module.

- It is easily available for operating systems like MAC, Windows, Linux and runs on
the Java Platform

- A range of Arduino modules available including Arduino Uno, Arduino Mega,


Arduino Leonardo, Arduino Micro and many more. Each of them contains a
microcontroller on the board that is actually programmed and accepts the
information in the form of code.

- The main code, also known as a sketch, created on the IDE platform will ultimately
generate a Hex File which is then transferred and uploaded in the controller on the
board.

- The IDE environment mainly contains two basic parts: Editor and Compiler where
former is used for writing the required code and later is used for compiling and
uploading the code into the given Arduino Module. This environment supports both
C and C++ languages.

The IDE environment is mainly distributed into three sections

 Menu Bar
 Text Editor
 Output Pane
The ARDUINO IDE appear like an image below:

A bar will appear at the top, it is called Menu bar.

The menu bar has five different options:

1. File- You can open a new window for writing the code or open an existing one. The
file option has 12 different subdivisions:

 NEW - used to open new text editor window to write your code.
 OPEN - used for opening existing written code.
 OPEN RECENT - used for opening recently closed written code.
 SKETCHBOOK - stores the list of codes you have written for your project.
 EXAMPLES - shows the examples which is already stored in the IDE.
 CLOSE - used for closing the main screen window of recent tab.
 SAVE - used to save the recent program.
 SAVE AS - used to save the recent program in your desired folder.
 PAGE SETUP - used for modifying the page with portrait and landscape
options.
 PRINT - used for printing your program.
 PREFERENCES - it is page with number of preferences you may want to setup
for your text editor page.
 QUIT - it will quit the whole software at once.

2. Edit– Used for copying and pasting the code with further modification for font.

3. Sketch– For compiling and programming.

4. Tools– Mainly used for testing projects. The Programmer section in this panel is used
for burning a bootloader to the new microcontroller.

5. Help– In case you are feeling skeptical about software, complete help is available from
getting started to troubleshooting.
To change the font settings of your text editor, you have to do the following steps:

• Go to file
• Click on preferences
• Click on Editor-font-size and set your desired value

There are six buttons available under menu bar, all of them have different functions

1. The VERIFY button (tick mark) is used to check the code.

2. The UPLOAD button (right arrow) is used to upload and transfer the code into the
Arduino board.

3. The NEW option (dotted sheet) is used to create new file.

4. The OPEN option (upward arrow) is used to open an existing Arduino file.

5. The SAVE option (downward arrow) is used to save the current code.

6. The button appearing on the top right corner is a Serial Monitor - A separate pop-up
window that acts as an independent terminal and plays a vital role for sending and
receiving the Serial Data. You can also go to the Tools panel and select Serial Monitor,
or pressing Ctrl+Shift+M all at once will open it instantly. The Serial Monitor will
actually help to debug the written Sketches where you can get a hold of how your
program is operating. Your Arduino Module should be connected to your computer by
USB cable in order to activate the Serial Monitor. You need to select the baud rate of
the Arduino Board you are using right now. For my Arduino Uno Baud Rate is 9600,
as you write the following code and click the Serial Monitor, the output will show as
the image below.
SELECTING THE BOARD:

In order to upload the sketch, you need to select the relevant board you are using and
the ports for that operating system. For selecting board, you have to click on tools on
the menu then click on the BOARD option and the a drop list contain different name s
of Arduino board will appear.

Just go to the "Board" section and select the board you aim to work on. Similarly,
COM1, COM2, COM4, COM5, COM7 or higher are reserved for the serial and USB
board. You can look for the USB serial device in the ports section of the Windows
Device Manager. Following figure shows the COM29 that I have used for my project,
indicating the Arduino Uno with COM29 port at the right bottom corner of the screen.
References/Additional Resources/Readings

A tour of the Arduino Uno Board. HackerEarth Blog. (2021, September 13). Retrieved
October 14, 2021, from https://www.hackerearth.com/blog/developers/a-tour-of-the-
arduino-uno-board/.

ARDUINO IDE. (n.d.). Ardacademy57.


https://ardacademy57.000webhostapp.com/introduction%20to%20IDE3.html

You might also like