Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views231 pages

Engineering

Uploaded by

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

Engineering

Uploaded by

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

‫قـــــررت وزارة الـــتــعلـيــــم تــدريـــ�س‬

‫المملكة العربية السعودية‬


‫هـــذا الــكــتــاب وطــبــعــه عــلــى نفقـتـها‬

‫‪Engineering‬‬
‫‪Secondary stage - Pathways system‬‬

‫‪Second year‬‬

‫‪The book is distributed freely and cannot be sold.‬‬ ‫‪1444 - 2022 Edition‬‬
Publisher: Tatweer Company for Educational Services

Published under a special agreement between Binary Logic SA and Tatweer Education Services Company
(Contract No. 0003/2022) for use only in the Kingdom of Saudi Arabia

Copyright © 2022 Binary Logic SA

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, electronic, mechanical, photocopying, recording or otherwise, without permission in writing from the
publishers.

Please note: This book contains links to websites that are not maintained by Binary Logic. Although we make every effort
to ensure these links are accurate, up-to-date and appropriate, Binary Logic cannot take responsibility for the content of
any external websites.

Trademark notice: Product or corporate names mentioned herein may be trademarks or registered trademarks and are
used only for identification and explanation without intent to infringe. Binary Logic disclaims any affiliation, sponsorship,
or endorsement by the respective trademark owners. Excel is a registered trademark of Microsoft Corporation. Tinkercad
is a registered trademark of Autodesk Inc. “Python” and the Python logos are registered trademarks of Python Software
Foundation. Jupyter is a registered trademark of Project Jupyter. PyCharm is a trademark of JetBrains s.r.o. MultisimLive
is a trademark of National Instruments Corporation. CupCarbon is a registered trademark of CupCarbon. Arduino is a
registered trademark of Arduino SA. Micro:bit is a registered trademark of Micro:bit Educational Foundation.

The above companies or organizations do not sponsor, authorize, or endorse this book.

The publisher has made every effort to trace all copyright holders, but if they have inadvertently overlooked any they will
be pleased to make the necessary arrangements at the first opportunity.
©Ministry of Education, 2022
King Fahd National Library Cataloging-in-Publication Data
Ministry of Education
Engineering - Secondary Education - Pathways System / Second Year
Riyadh, 2022
227p.; 210*25.5cm
ISBN: 978-603-511-235-2
1- Engineering
2- Curriculum
I-Title
428.241 dc 1443/12721

L.D. no.: 1443/12721


ISBN: 978-603-511-235-2

Enrichment and support materials


on the “iEN Ethraia Platform”

IEN.EDU.SA

Submit your suggestions to


‫اﻟﻜﺘﺎب اﻟﻤﺪرﺳﻲ‬ ‫ﻟﺘﻄﻮﻳﺮ‬
enhance ‫ﺗﻮاﺻﻞ ﺑﻤﻘﺘﺮﺣﺎﺗﻚ‬
the textbook

FB.T4EDU.COM
Introduction:
The progress and development of countries is measured by the ability to invest in education, and the
extent to which their educational system responds to the requirements and changes of the generations.
In the interest of the Ministry of Education sustaining the development of its educational systems, and
in response to the vision of the Kingdom of Saudi Arabia 2030, the Ministry of education has taken
the initiative to adopt the “Secondary Education Pathways” system to bring about an effective and
comprehensive change in high school.
The secondary education pathways system provides a distinguished and modern educational model
for high school in the Kingdom of Saudi Arabia, which efficiently contributes to:

• Strengthening the values of belonging to our homeland “the Kingdom of Saudi Arabia” and loyalty
to its wise leadership “may God protect him” based on a pure belief supported by the tolerant
teachings of Islam.
• Strengthening the values of citizenship by focusing on them in school subjects and activities, in
line with the demands of sustainable development, and the development plans in the Kingdom of
Saudi Arabia that emphasize the consolidation of both values and identity, based on the teachings
of Islam and its moderation.
• Qualifying students in line with future specializations in universities or the required jobs; ensuring
the consistency of education outputs with the labor market requirements.
• Enabling students to pursue education in their preferred path at early stages, according to their
interests and abilities.
• Enabling students to join specific scientific and administrative disciplines related to the labor
market and future jobs.
• Participation of students in an enjoyable and encouraging learning environment in school based
on a constructive philosophy and applied practices within an active learning environment.
• Delivering students through an integrated educational journey from the primary level to the end
of the high school level and facilitating their transition process to post-general education.
• Providing students with technical and personal skills that help them deal with life and respond to
the requirements of their level.
• Expanding opportunities for graduate students through various options in addition to universities,
such as: obtaining professional certificates, joining applied faculties, and earning job diplomas.

The pathways system consists of nine semesters that are taught over three years, including a common
first year in which students receive lessons in various scientific and humanities fields, followed by two
specialized years, in which students study a general path and four specialized paths consistent with their
interests and abilities, which are: the Rightful path, Business Administration path, Computer Science
and Engineering path, Health and Life path, which makes this system the best for students in terms of:

• The existence of new study subjects that match the requirements of the Fourth Industrial Revolution
and development plans, and the Kingdom’s Vision 2030, which aims to develop higher-order
thinking, problem-solving, and research skills.
• Elective field programs that are consistent with the needs of the labor market and students›
interests, as they enable students to join a specific elective field according to a specific job skill.
• Scale as it ensures the achievement of students› efficiency and effectiveness, and helps them
identify their tendencies and interests, and reveal their strengths, which enhances their chances
of success in the future.
• Volunteer work designed specifically for students in line with the philosophy of activities in schools,
and is one of the graduation requirements; which helps to promote human values, and build
society (its development and cohesion).
• Bridging which enables students to move from one path to another according to specific
mechanisms.

4
• Proficiency classes through which skills are developed and the achievement level improved,
by providing enrichment and remedial mastery classes.
• The options of integrated learning and distance learning, which are built in the paths system
based on flexibility, convenience, interaction and effectiveness.
• The graduation project that helps students integrate theoretical experiences with applied
practices.
• Professional and skill certificates granted to students after completing specific tasks, and
certain tests compatible with specialized organizations.
Accordingly, the computer science and engineering path as one of the updated paths at the
secondary level contributes to achieving best practices by investing in human capital, and
transforming the student into a participating and productive individual for science and knowledge,
while providing him with the skills and experience necessary to complete his studies in fields that
meet his interests and abilities, or to join the labor market.
Engineering is one of the main subjects in the Computer Science and Engineering path that
helps students to learn the basics of engineering, by engaging and participating to discover a
wide variety of topics in the field of engineering, starting by providing a historical overview of
engineering and introducing various fields of engineering disciplines that help meet human needs
and improve quality of life. The course focuses on inspiring and empowering students through
an understanding of engineering and its associated career opportunities, as well as creating
positive attitudes toward engineering majors in post-secondary education. The different learning
steps and creative ideas in different engineering fields will also be reviewed by reviewing some
electronic circuits and their basic elements and design criteria, as well as designing and building
a microcontroller using a variety of computer applications to find engineering solutions to life
problems. The theoretical aspect of this subject is integrated with the requirements that students
should know about real problems up to their level of knowledge related to the subject objectives,
in addition to finding engineering solutions under the guidance and supervision of the teacher.
The Engineering book is characterized by integrated, homogeneous and motivative theoretical
and practical content for an interactive learning environment through exercises, activities and
projects that are reflected in concrete life practices. This book also emphasizes important aspects
in engineering education and learning, which are:

• Linking the practical side to different life applications.


• Interest in using engineering in a variety of fields.
• Consistent presentation of theoretical content and its practical applications.
• Diversity of content presentation in attractive and interesting ways.
• Use of computer applications in exercises, activities and projects.

To keep with global developments in this field, the Engineering book provides an integrated set
of diverse educational materials that consider the individual differences between students, in
addition to software, which provides the student with the opportunity to engage in modern
technologies and practice-based communication; This confirms its role in the teaching and
learning process.
As we present this book to our dear students, we hope that it will catch their interest, meet their
requirements, and make their learning of this syllabus more enjoyable and useful.

God grants success


Contents

1. Engineering Fundamentals / 8
Lesson 1 Introduction to Engineering....................... 9
Exercises .................................................. 20
Project ................................................................. 24

2. Electrical Engineering / 26
Lesson 1 The Electrical Circuit ................................ 27
Exercises .................................................. 39
Lesson 2 Circuit Simulation .................................... 43
Exercises .................................................. 59
Project ................................................................. 62

3. Digital Circuits / 66
Lesson 1 Digital Circuits .......................................... 67
Exercises .................................................. 76
Lesson 2 Karnaugh Maps ........................................ 80
Exercises .................................................. 85
Lesson 3 Draw Digital Circuits ................................ 88
Exercises ................................................ 102
Project ............................................................... 105

4. Circuit Simulation with Tinkercad Circuits / 108


Lesson 1 Electronic Circuit Design and
Simulation.............................................. 109
Exercises ................................................ 130
Lesson 2 Troubleshooting and Measurements..... 133
Exercises ................................................ 165
Project ............................................................... 170

5. Simulate a microcontroller-based system / 172


Lesson 1 Programming a Microcontroller ............ 173
Exercises ................................................ 185
Lesson 2 Circuit with Microcontroller .................. 187
Exercises ................................................ 202
Lesson 3 Real Life Applications ............................. 205
Exercises ................................................ 223
Project ............................................................... 227
6
1. Engineering
Fundamentals
In this unit, students acquire basic knowledge about
engineering. More specifically, they will learn the basics of
engineering, its history, its different fields, and its purposes.
Finally, students will learn the importance of engineering,
how engineering can be used to improve quality of life,
and the differences between a computer engineer and a
software engineer.

Learning Objectives
In this unit, you will learn to:
> Define what engineering is.
> Describe the fundamentals of engineering.
> Recall the history of engineering.
> Understand the different fields of engineering.
> Identify career opportunities in engineering.
> Understand future challenges for engineers.
> State the purposes of engineering.
> Understand the improvement in quality of life through engineering.
> Recognize the importance of jobs related to computing.
> Classify the differences between a computer engineer and a
software engineer.

Python programming prerequisite


The Data Science and Engineering curricula in the pathways system require
knowledge of Python programming basics. You can scan the QR code on
the right to access Python introductory content. To find out what topics are
available and for quick access to each unit, you can see pages 230-231.

8
Lesson 1

Introduction to Engineering

The Fundamentals of Engineering


The fundamental principle of engineering is the use of mathematics, science and
creative thinking, in diverse professional settings, to solve complex multidisciplinary Engineering
problems to benefit people and society. The application of
Almost all engineers need to have a good grasp of mathematics and physics. science and math
Depending on the engineering field, they may also need to have more specialized to solve problems.
knowledge of chemistry, biology and medicine, electricity and magnetism, or
computer science and Information Technology.
Apart from technical knowledge, engineers need to have good oral and written
skills. A great amount of their time is spent explaining and promoting their ideas
to their colleagues and superiors. Some of the greatest engineers in history have
also been great communicators with excellent social skills.

The history of Engineering


Engineering, which is the process of using our thinking brain to solve problems in
our environment, has been a part of human life since the invention of agriculture.
Until that time, humans lived in nomadic tribes of hunter-gatherers. Their problems
included inventing new ways to hunt, clothe, and protect themselves from hazardous
environments and violent wildlife. When humans started gathering and growing
crops, many new problems were created. They needed to prepare the soil, provide
water through irrigation, use livestock for more efficient work, harvest the grown
crops and store them in a secure site where they were safe from the weather and
thieves. These new problems created a new dimension in how people think and
interact in their environment.

Figure 1.1: The history of Engineering

9
The Ancient Era
The great turning point was when people started using written language and
arithmetic. Some of the earliest writings that have been found are records and
ledgers of supplies and provisions for towns and cities. People then started
developing mathematics to better describe and process the new information
created. After that, people wanted to visualize the problems they faced and
the solutions they were designing. Hence geometry was born, ushering in a
new golden era of innovation in the Mediterranean and the Middle East. In 300
BC, in the region which is now modern Greece, Euclid wrote his book Elements, Figure 1.2: Archimedes’ water
which is considered one of the most influential scientific textbooks of all time. screw

The Middle Ages - Islamic Golden Age


In the European region, until the fall of the Roman Empire, engineering as a
scientific methodology was further developed, and was used to advance all
aspects of life, from city planning to warfare.
At the start of the medieval period, most of Europe was declining into the
Dark Ages. However, the situation in the Middle East was completely different.
Arab and Muslim scientists and engineers made significant advances in math,
physics, chemistry and biology. As a result, a myriad of new devices and
solutions to the most prominent problems of the time were invented by
pioneering Muslim and Arab engineers. Great feats of architecture and urban
planning were made by pioneering Arab Islamic engineers, which can still be
found and admired to this day. The period between the 8th and 14th centuries
is known as the Islamic Golden Age.
The Arabic mathematician and engineer Ismail al-Jazari (1136-1206), best
known for his mechanical devices, is considered the "father of robotics". He
Figure 1.3: Al-Jazari’s famous designed and built automated machines, clocks, and water-raising machines,
elephant clock in which the camshaft was used for the first time.

The Renaissance - Enlightment Era


While all this was happening in North Africa and the Middle East, engineers in
the Far East and the Chinese kingdoms were also producing inventions which
were slowly brought west along the Silk Road. The most important of these are
often called The Four Great Inventions: the compass, papermaking, printing, and
the invention of gunpowder, which would forever alter history when brought
to the West.
With gunpowder, warfare was completely changed, and the compass and printing
increased the movements of people and ideas across the globe. This ushered Figure 1.4: Da Vinci’s flying
in the Renaissance Age, where engineering and art were brought again to the machine
forefront of human endeavor. The needs of war and trade pushed engineers of
the time to invent new weapons and design better protection for cities, which
led to significant advances in building architecture. One of the most prominent
figures of the time was Leonardo da Vinci. While best known as an artist, he
was a brilliant engineer who designed many inventions and complex machines.

10
He made a prototype for a helicopter, which testing has shown would be capable of
flight if manufactured with modern materials. During the same period, invasions carried
out by the Mongol and Timurid empires blocked the Silk Road, so it could no longer
bring goods and materials from India and China.

The Industrial Era


European engineers had to advance naval travel and navigation to find new routes
to India and China to solve this problem. Great ships designed for long journeys were
built, and expeditionary forces were sent searching for new trade routes. However,
alas, something else happened. In 1492, Christopher Columbus discovered the
American continent and so dawned the Colonial and Imperialist ages. Gold and silver
mined from the American continent, fueled the advance of even more engineering
feats in Europe, which had its engineers create even more efficient weapons, giving
European kingdoms a technological edge over the rest of the world. With this power,
these kingdoms colonized most of the world, and another revolution soon began.
In 1776, James Watt invented the Watt steam engine, a machine which had the
greatest capacity to produce motion through energy. This invention started what
Figure 1.5: A drawing of the
is now called the Industrial Revolution. Factories started being built, which created steam engine by Boulton &
a new set of problems to solve. There were constant innovations in mechanical Watt
engineering, chemical engineering, and biomedical engineering. Goods and medicine
that only 100 years before were only used by royalty were put in the hands of the
common people. Industrialization started a chain reaction of technological and
societal changes occuring faster than ever before.

The Modern Era


The 20th century, although an era of global conflicts, brought advances in manufacturing, chemistry
and most important of all, the advent of computing and nuclear engineering. Although Henry Ford
didn’t invent the automobile, he changed the manufacturing process forever by introducing the moving
assembly line in 1913. The Space Race after World War II brought together scientists and engineers
to build nuclear weapons and rockets to venture out into space. During these years, engineers laid
the foundations for almost all the modern technologies that we use
today. In the 90s, globalization started taking shape, and a new era
of global cooperation between engineers began to reshape almost
all aspects of life. Every decade the quality of our lives in almost
every part of the world has improved exponentially.
We now live in the Information Age. Artificial intelligence is
processing big data to aid engineers in most fields. However, they
will need all the help they can get because, despite all the advances,
the next generations face some of the greatest challenges to date,
namely climate change and the energy crisis brought forth by the
depletion of natural resources. As it has always been throughout
history, these modern problems require innovative solutions. It is a
recurring cycle, with scientists and engineers right at the forefront,
Figure 1.6: Ford Motor Company assembly
helping humanity confront new challenges. line

11
Engineering Fields
Chemical Engineering

1. Biochemical Engineering
Biochemical engineers work in the pharmaceutical, energy, and food and drink industries. They work
to develop new drugs and treatments for pharmaceutical companies, they invent new methods to
produce and preserve food and drinks, and they design new ways for fossil fuels to be refined into
purer, cleaner and more efficient gasoline to help reduce emission of pollutants.

2. Environmental Engineering 3. Nuclear Engineering


Environmental engineering is an extremely Nuclear engineers are tasked with developing
relevant field nowadays, because climate change safe and efficient means of producing electricity
has started taking its toll on the global population through nuclear energy. Now that fossil fuels are
and natural resources are being depleted becoming ever more expensive, nuclear energy
worldwide. can be a clean and powerful alternative. However,
nuclear energy has been catastrophic when used
Environmental engineers specialize in finding
for military purposes.
optimal solutions to problems while minimizing
their negative impact on the environment. Many The new generation of nuclear power plants will be
companies and governments have started new safer, generate less dangerous waste and cannot
projects with sustainable development in mind. be used to produce weapons.
This is where environmental engineers come in.

4. Process Engineering
Process engineers are specialized in designing and
optimizing the processes that take raw materials
and energy and convert them into other materials
and other forms of energy. The transmutation of
materials and energy sources into suitable forms
is one of the most fundamental elements of every
engineering solution.

Figure 1.7: A petrochemical plant in Saudi Arabia

12
Civil Engineering

1. Construction Engineering
Construction engineers have responsibility for managing the construction of a building or a building
complex, which could be anything, from a simple warehouse to an international airport. They coordinate
and manage large teams of other construction engineers, electrical engineers, and materials engineers.
Through well-developed project management skills, they communicate information with clarity to
their superiors and pass down the necessary information to their co-workers.

2. Geotechnical Engineering 3. Municipal Engineering


Geotechnical or geological engineers are Municipal engineers are responsible for urban
responsible for analyzing construction projects and city planning. They analyze the geographic
and ensuring that they are developed safely and locations and the needs of the citizens, companies,
securely. They analyze and prepare the soil and and organizations, and decide where to place
rock surfaces where the main structures will be a city's resources and services. For example,
constructed. One example is deciding where municipal engineers need to consider energy
to place the columns of a bridge so that it is as and water supply and waste disposal, as well as
stable as possible in the event of an earthquake. the distinction between residential, commercial
They work closely with construction engineers to and industrial areas, all the while following
ensure that all operations run according to plan. government policies and standards.

4. Transportation Engineering
Transportation engineers need to make sure
that the inhabitants small towns and major
metropolitan areas are able to get to their
destinations safely and quickly. They are the
people who design road networks, bus routes
and underground metro systems. They are
constantly analyzing traffic flow and trying to
optimize it, because less traffic means fewer
emissions and less money spent on fuel. They
work closely with municipal and geotechnical
engineers to coordinate their projects and
figure out how their solutions fit into the overall
picture.
Figure 1.8: Metro construction in Riyadh

5. Architectural Engineering
Architectural engineers apply engineering
principles and creativity to design buildings that
are resilient, sustainable, safe and functional.
They work alongside architects, who are
responsible mainly for the visual elements of
the construction.
13
Electrical and Computer Engineering

1. Power Engineering
Power engineering is a very specialized field tasked with optimizing how generated power is transmitted and
distributed. Power engineers need to find ways to convert all kinds of energies, whether from renewable sources
or fossil fuels, into electricity that is ready to use through power distribution grids. Engineers are now developing
smart grids, a promising technology that will save energy and money for households and industry.

2. Electronics Engineering 3. Instrumentation Engineering


Electronics engineers research, design, develop, and test Instrumentation engineers have one of the most
electronic components and systems for commercial or important jobs in manufacturing production. They
scientific applications. They create electronic circuits plan, design and monitor the automation systems in
and components for telecommunications, aerospace a manufacturing environment. This career involves
guidance, acoustics, and instruments and controls. working with metering devices, instrumentation systems
and process control software.

4. Telecommunications Engineering
5. Computer Engineering
With the ever-growing adoption of IoT technologies,
telecommunications engineers now at the forefront of Computer engineering combines electrical engineering,
technological progress. Telecommunications engineers electronics and computer science. Computer engineers
design solutions that allow devices and systems to are responsible for a wide range of computer technology
communicate and work together. Nowadays, with the like microchips and servers or even experimental
advent of 5G networks, Edge AI and neuromorphic technologies like quantum computers. They also
chips, telecommunications engineers are faced with work with almost everyindustry, from healthcare to
many challenges and opportunities to change our lives manufacturing and transportation.
in the coming years.

6. Software Engineering
Software engineers provide the solutions to real-world
challenges through software development. Behind the
functionality of every digital device or network, mission
critical software is operating in the background. Today,
software engineering is a crucial field.

Figure 1.9: A telecommunications engineer

14
Mechanical Engineering

1. Mechanical Engineering
Mechanical engineers apply engineering principles and problem-solving techniques from design to manufacturing
for any object. They use the principles of motion, energy, and force to find solutions to a problem, ensuring that
their designs are efficient, reliable and cost-effective.

2. Manufacturing Engineering automotive engineers are working on designing future


transportation methods with sustainable development
Manufacturing engineers focus on the processes that in mind.
create the products in a manufacturing unit. They aim
to optimize cost, quality, and production capacity to
create environmentally sustainable and commercially 6. Acoustical Engineering
competitive products.
Acoustical engineers work in the arts industry, and they
are responsible for handling sound equipment designing
3. Industrial Engineering the most efficients theaters, auditoriums and concert
halls to ensure the clearest possible sound can be heard
Industrial engineers are tasked with designing and by everyone present.
optimizing complex industrial environments while
considering ergonomics guidelines and manufacturing
capacity. They must balance a wide variety of
interconnected social, economic, and manufacturing
variables to achieve optimal results.

4. Materials Engineering
Materials engineering is one of the most important
engineering professions. Materials engineers are
responsible for designing and producing new materials
with properties not normally found in nature. New
materials mean new environments for experiments
and devices that would not have been possible under
normal circumstances. Their research concerns materials
and components like metals, plastics, ceramics, and
nanomaterials.

Figure 1.10: Drone engineer


5. Automotive Engineering
Automotive engineering is the field that specializes in the 7. Aerospace Engineering
design and production of vehicles. Through innovative
research on smart roads and autonomous driving Aerospace engineers are involved in building aircraft for
technologies, automotive engineers develop safer and sky and space missions. It is a profession that is in high
more efficient vehicles. With renewable fuels and the demand nowadays, mainly because aviation companies
rise of smart cities, transportation will be an integral are investing in hypersonic flight and low-consumption
part of city infrastructure modernization. Currently, planes. In recent years, privately funded space missions
and satellite deployments have increased significantly.
15
Engineering Career Opportunities
Engineering provides an array of career opportunities. Engineers that work in the same field and specialty can
have different job roles and daily activities. Below are the most common positions that you can pursue.

■ Research and Development


When working in the research and development (R&D) department, you must take an idea and
figure out how to make it into a tangible product. To accomplish this, you research potential new
materials, improve existing processes, invent new ones, and make sure that the product is built and
sold at competitive prices. Your finished product must be intuitive and appropriate for its purpose.

■ Design
As an engineer, you are tasked with taking the information derived
from the R&D department and designing a product that serves its
function and is financially sustainable, and commercially competitive.
You will produce schematics and prototype models made with
Computer-Aided Design (CAD) and simulation tools.

■ Planning
Planning is the final step before the manufacturing of the product
begins. You will be responsible for defining the materials and
manufacturing equipment required, and you will plan all the steps
needed to build a reliable and cost-effective product.

■ Production
As a production engineer, you utilize the work of your colleagues
in R&D, design and planning, to implement the production stage.
You need to ensure that the correct materials are provided, the
schematics are correct, the appropriate tooling equipment is acquired,
and that the product can be manufactured within the financial and
Figure 1.11: Electronics R&D workbench time constraints.
■ Quality Control ■ Installation
Quality control or quality assurance is a critical In cases where the equipment or the system is
part of a product or system lifecycle. At every very complex, as an installation engineer your
stage of product development, several tests work will be focused on its proper installation
are run. As a quality control engineer, you will and setup. Machinery needs to be carefully
inspect materials, check that dimensions and integrated into an industrial or construction
measurements are precise, and perform stress environment.You will manage this process and
tests to record the product's behavior under test and maintain the product's installation.
unfavorable or extreme conditions. Furthermore,
monitoring helps you analyze usage data and
predict faults even after the product is sold.
Quality control is a costly and time-consuming
process, but it is financially beneficial because
it saves the organization money and time spent
on repairs.
16
■ Marketing and Sales ■ Customer Service and Support
Whether the organization has an internal marketing During the use of a product or system, damage
department or marketing is outsourced, communication and malfunctions may occur. Many products
with the engineering department is paramount for an are complex machines that need to undergo
effective marketing and sales campaign. You will be maintenance operations at specific time
tasked with explaining the product's qualities and the intervals. Customers will need support to
competitive advantages for potential customers to the diagnose and fix issues. As an engineer who
marketing professionals. has an in-depth knowledge of the product
or system, you will need to plan appropriate
maintenance procedures and work with the
technicians involved in this process.
Future Challenges
The main challenges that engineers will face in the coming
years are multidisciplinary problems requiring innovative
thinking and cooperation, as shown in Table 1.1.

Figure 1.12: An electrical engineer working on


renewable energy
Table 1.1: Future challenges
Climate change has Rising temperatures and sea levels are endangering coastal cities and
started affecting the threatening transportation networks. Engineers will need to work on solutions
Earth in the recent that halt the rate at which these problems are advancing and provide
decades. society with the necessary tools to adapt to changing conditions.
The use of renewable energy resources has proven to be effective, and some
countries have achieved the target of covering energy consumption through
Natural resources are
renewable energy sources. Engineers need to invent energy-efficient systems
not infinite.
and extend renewable energy infrastructures. The solutions to these problems
also reduce emissions which may slow down climate change.

Modern globalized
Suitable medical units must be deployed rapidly, and laboratory devices must
society is vulnerable
support innovative vaccine development. In both hospital and laboratory,
to pandemics that may
engineers will have to create solutions.
affect all aspects of life.
Modern IT applications are interconnected and form systems that exchange
Securing cyberspace and
critical and confidential data. Computer, network and software engineers need
protecting privacy.
to ensure that these systems are secure and not vulnerable to cybercriminals.
The global population is increasing at a steady rate, which creates a need
Food shortages occur to provide huge amounts of food at affordable costs. Chemical engineers
due to overpopulation. need to contribute to improving food production and processing and ensure
adequate food supply to all people.
While average life expectancy is rising, treatments for many illnesses and
diseases are becoming more expensive, which may cause a divide in access
Healthcare needs to be
to healthcare treatments. Engineers are tasked with inventing and developing
accessible to everyone.
medical equipment and treatments to provide accessible healthcare to people
of all socioeconomic statuses.

17
The Importance of Engineering

Purpose of Engineering
We live in challenging times, where environmental and societal changes are taking place faster than
ever before. Engineering professions cover a wide spectrum of specialties, and engineers need to work
together to find optimal solutions to complex problems. Throughout history, the greatest problems and
challenges have led to advances in science and technology, and it was engineering that provided the
solutions. Becoming an engineer is one of the best ways to positively impact communities, countries,
and the whole of global society.

Improving Quality of Life with Engineering


People's life has improved since we first started A person living 100 years ago could never imagine
using engineering to solve small and large the average person's quality of life today. Modern
problems. However, the rate of progress has transportation has allowed the movement of
varied accross the ages. people all around the world. A trip that used to
take weeks or months is now completed in hours.
The advent of the Internet in the last 30 years,
global cooperation among scientists and engineers People can now live in countries with harsh winters
and widespread knowledge have enabled the or hot summers, with unfavorable conditions
rapid creation of even more inventions. mitigated by temperature controlling devices.
People can communicate with one another from
anywhere in the world through chat or video calls.
Many work remotely through advanced video
conferencing applications, bringing an evolution
to the work environment.
Hunger, one of humanity's most prominent
problems, has been almost eradicated, with
biotechnologies bringing an abundance of food.
Modern-day medical devices and telemedicine
save lives. With the latest and upcoming advances
in technology, our quality of life will only improve
from now on.

Figure 1.13: Electric minibus

18
The Importance of Jobs Related to Computing
Technological advances in computing have created numerous jobs in engineering roles related to
computers and computer networks. As computers are literally everywhere in our lives, the importance
of these roles is significant. Some of the most common computer-related engineering jobs are:
> Telecommunications engineer
> Software engineer
> IoT engineer
> Cybersecurity engineer
> Systems architect
> Database administrator
> Systems engineer
> Technical support engineer
Some of these roles refer to hardware and some to software, but all of them require the skills and
mindset of an engineer.

Computer Engineer versus Software Engineer


There is an assumption that computer and software engineers do the same thing. Their studies may have
a common basis in the key concepts of Computer Science, but their roles are different in practice.

Computer engineer
Computer engineers
are mainly focused on
designing hardware
and planning computer
infrastructure and
communication
processes.

Software engineer
Software engineers
are tasked with the
development and
implementation of
software applications
and platforms.

Figure 1.14: Software engineer

19
Exercises
1

Read the sentences and tick True or False. True False

1. Engineering is the application of science to solve problems.

2. The basic principle of engineering is the use of mathematics, science, and


creative thinking to solve complex multidisciplinary problems.

3. Engineering has been a part of human life since agriculture was invented.

4. The four great inventions are: the compass, papermaking, printing, and
the computer.

5. The next generations face some of the most significant challenges, namely
climate change, the energy crisis, and vulnerability to pandemics.

6. Materials engineering is a field of mechanical engineering.

7. Power engineering is a field of electrical engineering.

8. An engineer in a design position has to produce schematics and prototype


models made with Computer-Aided Design (CAD) and simulation tools.

9. Quality control is a time-consuming and costly process, but it is financially


beneficial because it saves money and time spent on repairs.

10. Database administration is a computer-related engineering profession.

20
2 Explain your understanding of the term "Engineering".
____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

3 Describe and compare the fields of electrical engineering.


____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

21
4 Create a table with the main challenges that engineers will face in the coming
years.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

5 What influence do you think the Islamic Golden Age had on the evolution of
engineering? Search the Internet for information on the invention of horizontal
plane windmills associated with this period.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

6 From what you have learned, name three occupations that are in danger of
disappearing in the next few years, and three professions that you think are
more important than those.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

22
7 Which future challenge do you think is most urgent and which engineering
profession do you think can overcome it? Research online and find universities
that offer this engineering field specialization and related information for
graduate and postgraduate studies.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

8 Describe the role of the Kingdom of Saudi Arabia's Vision 2030 in solving global
challenges? How do you think Saudi engineers can help make things better for
society?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

23
Project

1
Let us say you need to decide on an engineering field
specialization that you have learnt about. Do some
research and look for information that describes the
history of that specialty and why it is still useful to
us today.

2
More specifically, you have to answer questions like:
- What event or recent innovation prompted you to
choose this engineering field?
- How can this engineering field evolve?

3
Using Microsoft PowerPoint, create a presentation
using the information you found to introduce the
engineering field that you have chosen.

24
Wrap up

Now you have learned:


> What is engineering?
> What are the fundamentals, history and different fields of
engineering?
> What are the opportunities, purposes and challenges of
engineering?
> The improvement of life and the importance of jobs related
to computers.
> What are the differences between a computer engineer and
a software engineer?

KEY TERMS

Acoustical Engineering Electrical Engineering Municipal Engineering


Aerospace Engineering Electronics Engineering Nuclear Engineering
Architectural Engineering Environmental Engineering Power Engineering
Automotive Engineering Geotechnical Engineering Process Engineering
Biochemical Engineering Industrial Engineering Software Engineering
Chemical Engineering Instrumentation Engineering Telecommunications Engineering
Civil Engineering Manufacturing Engineering Transportation Engineering
Computer Engineering Materials Engineering
Construction Engineering Mechanical Engineering

25
2. Electrical
Engineering
In this unit, we will learn the basics of electrical
circuits. We will also learn about the different types
of electrical circuits. Finally, we will use a simulation
program to understand how circuits operate.

Learning Objectives
In this unit, you will learn to:
> Describe the basic properties of electrical
circuits and electrical quantities.
> Distinguish between DC and AC electric currents.
> Understand how Ohm's law is applied to
electrical circuits.
> Demonstrate how to connect resistors in an
electric circuit.
> Design electrical circuits.
> Simulate electrical circuits using Multisim Live.

Tools
> Multisim Live

26
Lesson 1

The Electrical Circuit

The basics of Electricity


In this lesson, we will examine some basic concepts that
are used in the design of electrical circuits. We will also
demonstrate the means by which we study their functions.

Current
The electric current in metallic conductors
consists of electrons (e⁻), which are very small
particles that carry the elementary negative (-)
electric charge and the current moves at very
high speeds.

Amperes
To quantify the motion of electrons, André-Marie Ampère
created the concept of how many electrons pass through
a point in the circuit in one unit of time. He called this
electric current, or intensity of current (I), which is
measured in amperes (A).

1 coulomb
1A =
1 second

Volt
In order for an electric current to move in a circuit, we must create a
potential difference, also called a voltage (V). This shows us how much 1 joule
1V =
energy is used in moving one coulomb of electric charge inside the circuit. 1 coulomb

SMART TIP
The volt is the unit of electric voltage. 1 volt is denoted as 1V and
is the measure of the potential difference when an electric current
of 1 ampere (A) flows through an element of 1 ohm (Ω) resistance.

27
Table 2.1: Electrical quantities table
Electrical quantity Unit of measurement The components of an
Electrical Energy Joule (J) electrical circuit are built from
materials that facilitate the
Electric charge Coulomb (C) movement of electrons, which
means electrical current can
Electric Current Ampere (A) flow through them. These
Voltage Volt (V) materials are called conductors.
For example, metals are
Resistance Ohm (Ω) conductors.

Electric power Watt (W)

Core Hardware Components of an Electrical Circuit


Power Source
We create a voltage between two points on the electrical circuit with a power
source. The source works to transfer electrons from one point in the circuit to
another. Two poles are created, one with an electron deficit (+) and the other
with a surplus (-).
The balance in the quantities of electrons needs to be restored. To achieve The power source can be
this, electrons are drawn from the negative pole (-) to the positive pole (+). a battery or a generator.
This movement generates electricity.

Alternating Current (AC) and Direct Current (DC)


The source is constructed so that the electric current either moves with
in constant direction from the negative to the positive pole (DC) or in an
alternating direction back and forth between the poles (AC).
DC usually flows at low voltages and the electrons move from (-) to (+), but
we consider conventional motion to be from (+) to (-).
The electricity supply network of a city uses AC voltage for lights and home
appliances. Electronic devices like computers and smartphones require low
DC voltage. A DC power supply converts the AC voltage to a lower DC voltage.

Power supply

28
Resistor
As mentioned before, electrical current is the
movement of electrons through an electrical wire.
Resistors (R), as their name suggests, resist this
movement. They do not stop it, they merely slow the
movement down. The faster the electrons move, the
greater the electrical energy of the system.
The energy carried by the electrons is converted into
heat by resistors.

Resistance, measured in ohms, is


defined in terms of the ratio of voltage
to current. If a current of 1A flows
Figure 2.1: Photo of resistors
through a resistor when a voltage of 1V
is applied to it, its resistance is 1 ohm.
Ιf we have two or
1V more resistors then
1 ohm = we give them names,
1A such as R1, R2, R3…

Switch
A switch (or circuit breaker) must
be used in each circuit to control
whether or not electricity flows
through the circuit.

This is a circuit breaker.

Figure 2.2: Different types of switches and circuit breakers

INFORMATION
Resistance is denoted by the Greek letter omega in capitals: Ω (ohm).

29
Instruments for Measuring Electrical Quantities
Various instruments have been invented for
measuring the different electrical quantities. These
include::

The voltmeter, which is connected in parallel with a


conductor and measures the voltage across its ends.

The ammeter, which is connected in series with the


conductor and measures the intensity of the current Figure 2.3: Multimeter
flowing through the conductor.

The ohmmeter, which measures the resistance of a


conductor.
A multimeter is a tool that can
measure the values of current,
voltage, and resistance across
The multimeter, which is an instrument that can various parts of an electrical circuit.
measure voltage, current and resistance. It is mainly used for troubleshooting.

A lamp behaves
like a resistor.

Electrical Circuit Components


Before creating our first electrical circuit, let's look at the basic components we will need:

Electrical
Components

Source Switch Resistor

Circuit
Symbols

30
What the Colors on a Resistor Mean
Fixed resistors use standard color-coding rules to visually represent the
basic properties of a resistor. The number of colored bands on a resistor
show whether it is a standard or high precision resistor.
4 bands means a standard-precision resistor, whereas 5 bands means a
high-precision resistor and 6 bands is essentially a 5 band resistor but
with an extra ring that denotes the temperature coefficient.
How to decode bands on a standard-precision resistor:
> The 1st, 2nd, 3rd and 4rd bands denote the resistor’s value.
> The 5th band denotes the resistor’s tolerance with a standard
measurement error of within 5% to 10% of the real tolerance value
of the resistor.
Let's take a look at resistor color codes:

TEMPERATURE
COLOR 1st DIGIT 2ndDIGIT 3rd DIGIT MULTIPLIER TOLERANCE COEFFICIENT
BLACK 0 0 0 11 Ω
Ω 250 ppm/K
250 ppm/K

BROWN 1 1 1 10 Ω ± 1% 100 ppm/K


RED 22 2 2 100 Ω ± 2% 50 ppm/K
ORANGE 3 3 3 1 kΩ 15 ppm/K
YELLOW 4 4 44 10 kΩ 25 ppm/K
GREEN 5 5 5 100 kΩ 0.5% ± 20 ppm/K
BLUE 6 6 6 1 MΩ 0.25% ± 10 ppm/K
VIOLET 7 77 7 0.1% ± 5 ppm/K
GREY 8 8 8 1 ppm/K
WHITE 9 9 9
GOLD 0.1 Ω 5% ±
SILVER 0.01 Ω 10% ±
Figure 2.4: Resistor color coding

INFORMATION
Not all resistors exert the same amount of resistance on the flow of electrons. The main rule
is that the greater the resistance, the more the intensity of the electrical current is diminished.

31
4-BAND 5-BAND 6-BAND

1 2 x105 ±5% 1 0 0 x102 ±1% 2 7 4 x100 ±2% 250

= 1,200 kΩ ± 5 % = 10,000 Ω ± 1 % = 274 Ω ± 2%, 250 ppm/K

Figure 2.5: Examples of resistor calculation using color codes

Resistor Connections in Electrical Circuits


In an electrical circuit the resistors are connected as follows:

Resistor connections Description Total resistance

In series Resistors R1 and R2 have one common end,


R1 R2 the same current I flows through them and
have voltages V1 and V2 across their ends. RT = R1 + R2
1kΩ 1kΩ Where V1 + V2 = VT.

In parallel
R1 Resistors R1 and R2 have two common ends,
have the same voltage V across their ends
1kΩ and 2 different currents flow through them, 1 1 1
I1 and I2.
= +
R2 RT R1 R2
Where I1 + I2 = IT.
1kΩ

Table 2.2: Prefixes of Units of Measurement

Name nano micro milli kilo mega giga Total resistance


is the resistance
generated by all the
Symbol n μ m k M G resistors in a circuit.

Factor 10-9 10-6 10-3 103 106 109

32
Open switch Light bulb off
Electrical Circuit Connections
All components of a circuit offer some Example
resistance to current depending on their use.
In the following circuit we have: S X
• A lamp denoted by X, operating normally at
12V voltage.
• A switch denoted by S. 12V
• A 12V power source. V
12V

Closed switch Light bulb on


Figure 2.6: Schematic symbols for electrical circuits

S X

Each device offers some resistance. For


12 V
example, the wire in a light bulb resists
electron flow. The result of this is the V
conversion of electricity into heat and 12 V
light.
The internal resistance of switches and
power sources is negligible, so they
aren't counted in the total resistance of
the circuit.

The 12V label on a light bulb is the value


of the voltage that must be applied to its
ends for it to function properly.

The light emitted and the intensity of the


electric current flowing through the lamp
are in relation to the rated voltage of the
connected battery. Low voltage results in light
that is dimmed or even barely visible. Very
high voltage may damage the lamp.

INFORMATION
Generally, DC sources are much safer than AC sources.

33
Ohm's Law
In electrical circuits, it is important to know the
relationship between the electric current flowing
through a resistor and the voltage across its ends.
The German physicist Georg Simon Ohm first
explored this relationship in 1827.
He defined that a conductor which has a constant
resistance R and a voltage V at its ends, allows
an electric current of intensity I to flow through
the conductor. He observed that the current I
is proportional to the potential difference V. In
mathematical notation this relation is written as:

This law can also be applied to a circuit with more


V than one. Essentially, we view the complete electrical
I= circuit as one resistor itself, by determining the total
R resistance of the entire circuit.
When studying electrical circuits and calculating the
values of V, I and R for each component of the circuit,
we continuously apply Ohm's law.

Series and Parallel Circuit Connections


Series and Parallel connections of resistors are shown below:

What is a Series Connection? What is a Parallel Connection?


All components in a series circuit are Components in a parallel circuit are connected
connected end to end, forming a single so that there are two or more possible paths
path for current to flow along. for the current, forming two sets of electrically
common points..

34
Series Connections
Let's start with the series circuit. Example
You have the following values: R1 R2
> R1 = 30kΩ
> R2 = 60kΩ 30kΩ 60kΩ
> Voltage V = 9V supplied by the battery.

V
9V

The sum of the voltages, V1 and V2,


across each resistor, is equal to the
voltage across the ends of the source.

We will first calculate the total resistance R of the circuit: RT = R1 + R2 = 90kΩ

Next we will calculate the current I flowing through V 9


I= = = 0.1mA
the circuit: RT 90kΩ

Finally, we will calculate the voltages V at the ends of each resistor:


V1 = I × R1 ⇒ 0.1mA × 30kΩ = (0.1 × 10⁻³) × (30 × 10³) = 3V
V2 = I × R2 ⇒ 0.1mA × 60kΩ = (0.1 × 10⁻³) × (60 × 10³) = 6V

In a wire or cable, the resistance R depends on:


> the length: Longer wire means greater resistance.
> the thickness: Thicker wire means lesser resistance.
> the material that the cable is made from. For example, copper wires have lower resistance.

SMART TIP
The lower the resistance of a conductor, the higher the
intensity of the current flowing through it , for a given voltage.

35
Parallel Connections R1
Now we will see a circuit whose resistors Example
Node
are connected in parallel. 3kΩ
I1
> R1 = 3kΩ (I1 + I2) = IT
> R2 = 6kΩ
> V = 9V IT I2
R2

V1 6kΩ
9V

The sum of the two currents is equal to the current


flowing through the source, in this case the battery.

We will first calculate 1 1 1 R × R2 18kΩ


the total resistance of = + ⇒ RT = 1 ⇒ RT = = 2kΩ
the circuit: RT R1 R2 (R1 + R2) 9kΩ

Next we will calculate the V1 9V 9


flow of current of R1: Ι1 = ⇒ I1 = = = 3 × 10-3 = 3mA
R1 3kΩ 3 × 103

Next we will calculate the V2 9V 9


flow of current of R2: Ι2 = ⇒ I2 = = = 1.5 × 10-3 = 1.5mA
R2 6kΩ 6 × 103

Next we will calculate the


flow of current in the circuit: ΙT = I1 + I2 ⇒ IT = 3mA + 1.5mA = 4.5mA

We can find the same result V 9V 9


for IT by applying Ohm's law:
ΙT = ⇒I= = = 4.5 × 10-3 = 4.5mA
RT 2kΩ 2 × 103

Node
I1
A node is a point in a circuit where Ohm's law cannot be applied
2 or more conductors meet. I2 IT to devices in which the ohmic
A circuit loop is a part of the circuit resistance does not remain
that starts at one point and ends at constant. Examples include
the same point following the path Node diodes, transistors, etc.
of current flow.
36
Ohm's Law: Example Problem
In this example, we want to find the potential difference, or voltage, between points A and B.

You can find the total resistance of the circuit between points A and B:

R1 R3

11Ω 4Ω

A
V R2 R4
B 18Ω 8Ω

R5


First we note that resistors R3,R4 and R5 are connected in
series, so: R3,R4,R5= 4 + 8 + 6 = 18Ω

We can now consider an equivalent circuit:


R3 + R4 + R5
R1

11Ω

V R2 R3,4,5
18Ω 18Ω

37
In the equivalent circuit, we observe that R3,4,5 and R2 are connected in parallel.

R1
11Ω Resistors in parallel

V R2 R3,4,5
18Ω 18Ω

R3,4,5 × R2
Therefore: R2⫽R3,4,5 = = 9Ω
(R3,4,5 + R2)

We can calculate the voltage between points A and


B, if the current flowing through R2 is I2=1A.
So we consider the following equivalent circuit:
So the voltage across the ends of R2 will be:
R2⫽R3,4,5 V2 = I2 × R2 = 1 × 18 = 18V
R1
Since the resistor R3,4,5 is connected in parallel , with
11Ω R2,3,4,5
V R2 and therefore has a voltage of V3,4,5 = 18V.

V3,4,5 18
So I3,4,5 = = = 1A
R3,4,5 18

From this,we find the total resistance: The current flowing through the source and R1 is:

RT = R1 + R2,3,4,5= 11 + 9 = 20Ω IT = I2 + I3,4,5 = 1 + 1 = 2A

Thus, the voltage across A and B is:


VAB = IT × RΤ = 2 × 20 = 40V
A V RT
40V 20Ω
B

Voltage between the points AB

38
Exercises

1 Tick the correct sentences below.

A resistor is connected to the poles of a generator that has negligible


internal resistance. If we connect another identical resistor in series True False
with the first resistor, then the intensity of the current:

1. will double.

2. will remain constant.

3. will drop to half.

4. will quadruple.

2 Tick the correct sentences below.

When two resistors, R1 and R2, with different resistances are


True False
connected in parallel:

1. They display the same voltage at their ends.

2. A current of equal intensity flows through each.

3. Their equivalent resistance is RT from the equation RT = R1 + R2.

4. Currents of different intensities flow through each.

39
3

Read the sentences and tick True or False. True False

1. An ammeter measures voltage.

2. A voltmeter is connected across a branch in the circuit.

3. The energy that the electric current transmits to a resistor, is completely


converted into thermal energy.

4. Resistors connected in series have the same current flowing through


them.

5. RT = R1 + R2 + R3 +… + Rn holds true for resistors connected in series.

6. Resistors that are connected in parallel display the same voltage at


their ends.

7. A voltmeter measures the intensity of current.

8. For resistors that are connected in parallel, the total resistance of the
circuit is RT = R1 + R2 + R3 +… + Rn.

4 Match the items in the first column with those in the second.

Quantities Units

Resistance V

Voltage W

Electrical energy J

Power Ω

40
5 On a piece of paper, draw a circuit consisting of two identical light bulbs X1 and X2,
the source V and the switch S in series. Closing the switch, electrical current begins
flowing through the circuit. Determine whether the two light bulbs X1 and X2 will
emit the same amount of light? Justify your answer.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

6 Three resistors R1 = 20Ω, R2 = 5Ω and R3 = 4Ω, are connected in parallel to a voltage


V = 20V. The resistor R2 is connected to an ammeter in series which shows the current
I2 that flows through R2. The source is connected to a switch S and a second ammeter
in series, which shows the intensity of the current I, which flows through the source.
The resistances of the power source and the ammeters are considered negligible.
1. Draw the circuit diagram.

2. Find the total resistance RT.


________________________________________________________________________________________

________________________________________________________________________________________

3. Find the ammeter readings when switch S is closed.


________________________________________________________________________________________

________________________________________________________________________________________

41
7 In the circuit diagram, the source has voltage V. The power source and the two
measurement instruments, the ammeter (A) and voltmeter (V), have negligible
internal resistances.
The resistors have values R1 = 100Ω, R2 = 50Ω, R3 = 50Ω, and the ammeter displays
a reading of 0.8A. Calculate the following:
1. The total resistance of the circuit.
2. The intensity of the current flowing through each resistor.
3. The voltmeter reading.

R1
A

V V R2 R3

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

42
Lesson 2

Circuit Simulation

Electronic circuits are hardware projects which exist in the physical domain,
but this also means that malfunctions may occur that are not related to the
design of the circuit but are caused by faulty conductors, power sources, etc.
This means that you cannot focus on the circuit design alone. For this reason, circuit
simulation software can be very helpful and is used by professionals.
These programs allow an engineer to design any circuit freely without a restriction
on materials, components and in a controlled environment. When the desired circuit
design has been achieved, the engineer then proceeds to build it in the physical
domain.
In this lesson, you will use Multisim Live to design and simulate electrical circuits.

What is Multisim Live?


Multisim live allows you to simulate electrical circuits and schematics built on the
SPICE simulation architecture. Multisim Live allows you to simulate electronic circuits
on any device which has access to a web browser.

Figure 2.7: Multisim live circuit simulator

43
Create an Account
Go to https://www.multisim.com to access Multisim Live.
The first thing you need to do is to create an account so you can save your
projects.
This is simple, click on sign up and fill in the necessary fields.
After you have created your account, go back to https://www.multisim.com.

When you are logged into an


account, the name you have Click to create
chosen will be displayed here. a new circuit.

When you login to your account, you have access


to previous circuits that you have designed,
favorite projects shared by other people and
community groups which you have joined.

Figure 2.8: Create an account

You can access these options without being


logged into an account. From here you can find
circuits designed by others and community
groups to join.

44
Design a Circuit
Let's see how we can use Multisim Live to create our first circuit.

Click the CREATE CIRCUIT


button.

File navigation Schematic default Configuration


menu simulation mode pane

Stop the This option allows you to view


simulation the Schematic and the Grapher
simultaneously on one screen.

Run the The Grapher is a multi-purpose display Undo, redo,


simulation tool that allows you to view, adjust, zoom in,
save, and export graphs and charts. zoom out

The schematic is where you put


components and wire them together,
and also add simulation probes.

Figure 2.9: Multisim Live user interface


The Components toolbar is located
work
on the left side of the screen and
space
provides access to all components.

45
Let's have a look at the When you add a component to the
components toolbar work space, you have access to the
and more specifically, following properties:
at the categories we
will use in this lesson to
design circuits. Flip/Mirror Delete

Analysis and
annotation

Sources

Passive Rotate Duplicate Toggle

Indicators How to change labels/values of components:

Switches

Change value of
a component
INFORMATION
Change ID of
To change the label on a a component
component, you can click on
the label you want to change
and then click again to open the
ID window.
To change the value on a
component, you can click on
the value you want to change to
open the corresponding value
window.

Figure 2.10: Multisim Live toolbox

46
Now you will design your first circuit in Multisim Live. First you are going to connect a resistor of 1kΩ.

Connect a resistor:
1
> Go to https://www.multisim.com/ and
click CREATE CIRCUIT. 1
> On the Components toolbar click the
Passive tab. 2
> Drag 3 and drop a Resistor into the
work space. 4

Figure 2.11: Connect a resistor

47
Next you are going to connect the source.

Connect the source:

> On the Components toolbar click the Sources tab. 1

> Drag 2 and drop DC Voltage (VCC) into the work


space. 3

Figure 2.12: Connect the source

48
Now that you have placed the resistor and source in your
work space, you need to connect them using a wire.

Connections:

> Click on the Source positive upper node 1

and then on the Resistor left node. 2


> Click on Resistor right node 3 and then on A branch of the circuit is a section of a
Source negative lower node. 4 loop in which there is no node present.

Node 1

You can click on a


wire and move it to
stretch it or shrink
3
it to get the best
result.

Figure 2.13: Connections

49
The design part is almost finished, the last thing
we need to do is to add probes so you can see the
measurements on the circuit.
When we connect a Current probe
Add a Current probe: with its arrow pointing from the
negative end (-) to the positive end
> On the Components toolbar click the (+) of the power source, then the
Analysis and annotation tab. 1 value of the current will be negative.
> Drag 2 and drop Current probe in series
with the Resistor. 3

When you see the current values in the


ammeters are negative, this means that they
are connected opposite to the current flow.
We can change the current flow by selecting
Figure 2.14: Add a Current probe the current probe, going to the configuration
pane, and clicking "Flip current measurement".

50
You can also add probes to see voltage measurements.

Add a Voltage probe:

> On the Components toolbar, click the Analysis and annotation tab. 1

> Drag 2 and drop a Voltage probe on the left side of the Resistor. 3

> Click to add a reference probe, 4 and drop it on the right side of the
Resistor. 5

continues on the next page

51
5

Figure 2.15: Add a Voltage probe

It's important to name the Name the components and detectors:


components and detectors > Click on Source V1 to select it. 1
you have in your circuit.
> Click again on Source V1 to open the ID: box. 2

> Change name to V. 3

2 3

This probe is used like


1 a voltmeter in parallel.

52
Your circuit should now look like the image below..

Figure 2.16: Name the components and detectors

Avoid placing your circuit in an environment


where there are liquids, humidity, or dust in
proximity. These environmental factors can
cause short-circuits which can lead to accidents.

Figure 2.17: Example of actual circuit connections

53
Now we are ready to run the simulation and
see the measurements from the probes.
1
Run simulation:

> Click on Run simulation and run the 2


simulation for a short time. 1
> Click to stop/reset simulation. 2

In the design of simple DC circuits,


grounding is not required, so we can
ignore this message.

Figure 2.18: Run simulation

Now that we have designed the circuit with specific the values for the source and the resistor, we
can check with Ohm's law:

Resulting to
5V 5
5mA = ⇒ 5 × 10-3 = 3
1kΩ 10

The simulation follows Ohm's law verified by the


values displayed by the measurement instruments.

54
You can save your project to use it again later.

Save project:

> Click on the File navigation menu. 1

> Click on Save. 2

> In the Save Circuit window, change the name to Ohm's law. 3

> Click OK. 4

Figure 2.19: Save project

55
To check previous circuits that you have designed, you can go to My Circuits.

Open project:

> Click on the File navigation menu. 1

> Click on Go to. 2 After you have saved your


> Click on My Circuits. 3 project, the name changes here.

Click New file to


start a new project

2 3

The projects that you have


saved are all located here.

Figure 2.20: Open project

56
Example 1: Series Connection
In a circuit with connections that are all in series as shown in the example, we observe that:

Example

Example

VT = V1 + V2 Resulting in The values displayed by the measurement instruments


verify the result. We also note that our ammeters
5V = 1V + 4V display the same current intensity:
I = 1mA

57
Example 2: Parallel Connection
In a circuit with connections that are in parallel as shown in the example, we observe that:

Example

Example

VT = V1 = V2 = 18V IT = I1 + I2 = I3 ⇒ 9mA = 3mA + 6mA = 9mA

58
Exercises

1 Design the circuit below:

1. Run the simulation and after you close the switch S, write down what you observe.

____________________________________________________________________________________________

____________________________________________________________________________________________

2. Connect an ammeter to the circuit and write down the value it displays.

____________________________________________________________________________________________

____________________________________________________________________________________________

3. Change the voltage value of the source to 5V and then to 1V, what do you notice in
each case?

____________________________________________________________________________________________

____________________________________________________________________________________________

4. Change the value of the voltage of the source to 15V, and then to 20V, what do you
notice in each case?

____________________________________________________________________________________________

____________________________________________________________________________________________

59
2 Design the following circuit:

Observe and write down the values


on the instruments in the table below.

Measuring
Value
instrument

Ammeter

Voltmeter

What do you notice about the voltage


across R2?
Explain your answer.

_______________________________________

_______________________________________

_______________________________________

_______________________________________

_______________________________________

_______________________________________

_______________________________________

_______________________________________

60
3 Design the following circuit:
Set lamps X1 and X2 to have 10V normal operating voltage.

Run the simulation and write down what you notice about the two light bulbs. Explain
your observation.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

Now close the switch S. What do you notice about the light bulbs and the ammeter?
Explain your observation.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

61
Project

Design the following circuit:

Connect 2 lamps X1 and X2 to this circuit, each of which operates normally


at a voltage of 12V and is damaged at a voltage greater than 15V.

Connect 1 resistor in series with X1, with resistance R = 10Ω.

Connect 3 switches S1, S2, S3.These show very little resistance in


the circuit, of the order of 10-7Ω when closed, according to the
program, can therefore be considered negligible.

Connect 3 ammeters, to measure the current in


each branch of the circuit.

62
Do the following:

Open switch S3. What do you notice?


Explain what you see.
With S3 closed, and S2 open, close S1.
What do you notice?
Explain what you observe.
With S3 and S1 closed, close S2.
What do you notice?
Explain what you observe.

Find the relationship of the current intensities IΤ , I1 and I2


from the readings of the ammeters.
Find the resistance R1 from the voltage V1 and the
current I1, and the resistance R2 from the voltage V2
and the current I2, where R1 is the resistance of lamp
X1 and R2 is the resistance of lamp X2.

After stopping the simulation, change the


source voltage from 10V to 20V and
close switches S1 and S2.
Then close S3 and write down what you
notice about the bulbs X1 and X2. Also,
write what you notice about the values
of current intensities IΤ , I1 and I2.

With S3 and S1 open, close S2 and write down


what you notice about the bulbs X1 and X2.
Explain your observations.

63
Wrap up

Now you have learned :


> to distinguish between direct (DC) and alternating (AC)
electrical currents.
> to read and draw simple circuits and how they work.
> to apply Ohm's law.
> to use Multisim Live to design and simulate electical circuits.
> to use probes to measure voltage and current in simulations.

KEY TERMS

AC Electron Resistor

Ammeter Joule Source

Ampere Multimeter Volt

Coulomb Node Voltage

Current Ohm Voltmeter

DC Ohmmeter Watt

64
65
3. Digital Circuits
In this unit, you will learn about Boolean
Algebra. You will also learn how to use
Karnaugh maps. Finally, you will use
Multisim Live to draw digital circuits.

Learning Objectives
In this unit, you will learn to:
> Understand the basics of the digital circuit.
> Define the rules of Boolean Algebra.
> Apply Boolean Algebra to simplify functions.
> Differentiate among logic gates.
> Create logic functions by combining logic gates.
> Apply Karnaugh maps to simplify logical designs.
> Recognize the core hardware components of a
digital circuit.
> Define what integrated circuits (IC) are.
> Simulate designed digital circuits with Multisim
Live.

Tools
> Multisim Live

66
Lesson 1

Digital Circuits

Basics of the Digital Circuit


Digital circuits are used to implement Boolean logic and
operations on a system. The main difference between digital Table 3.1: States of digital
and electrical circuits is that electrical circuits operate with circuits
continuous signals, created by the electrical current flowing
State Binary numbers
through the circuit,while digital signals are "discrete," and
take as input sequences of 0's and 1's.Digital circuits are TRUE 1
used in Integrated circuits and microcontrollers to store
FALSE 0
information and perform logical functions in conjunction
with an electrical circuit.
The 2 main types of digital circuits are the following:

Combinational Circuits
Combinational circuits take input values and produce output
Table 3.2: Common
voltage levels
results based on the logical function that is implemented.
Logic level Binary number Volts
The following are types of combinational circuit:
> Multiplexers: Take multiple inputs from a digital source 5 Volt 1 5
and output a single result value. logic 0 0
> Demultiplexers: Take a single input value and output
multiple result values. 3.3 Volt 1 3.3
> Encoders: Convert a signal input into a coded binary result. logic 0 0
> Decoders: Reconstruct the original signal from produced
by an encoder.

Sequential Circuits
Sequential circuits take as inputs the outputs that were
produced by previous iterations of the circuit. Examples of
sequential circuits are the following:
> Flip-flops: They are used for storing digital signal sequences.
> Counters: They are used to time, track, coordinate and
orchestrate other components of a digital circuit.

INFORMATION
Analog signals can be found everywhere in nature, but digital signals are man-
made. The main difference is that analog signals are inputs that have variations
in the frequency and amplitude of the waves. In digital signals, there is only
an on/off state represented by ones and zeroes, also called binary code.

67
Boolean Algebra
Boolean Algebra is defined according to a set of two elements: {0, 1}
It defines operations AND (+) and OR (⋅), which obey the following rules: The results (Y) of operations (+)
and (⋅) belong to the set {0, 1}.
If A, B belong to the set {0, 1}, then:
Α+Β=Β+Α=Y
Α⋅Β=Β⋅Α=Y

Properties of the operation Properties of the operation The distributive law of


AND in Boolean Algebra. OR in Boolean Algebra. Boolean Algebra.

Α⋅1=A Α+1=1 A ⋅ (B + C) = A ⋅ B + A ⋅ C
Α⋅0=0 Α+0=Α A + B ⋅ C = (A + B) ⋅ (A + C)
Α⋅Α=A Α+Α=Α A=A
Α⋅Α=0 Α+Α=1

Example If A = 0 then A = 1. While if A = 1 then A = 0.

The rules mentioned apply


Operation Expression Logic gates may have more
exactly the same to the logic
than two inputs, but they will
of the operations: AND A⋅B always have one output.
OR A+B

DeMorgan’s Theory
To get the complement of a complex representation, it
is enough to change each element with its complement
and each operation from AND to OR and OR to AND.

Theorem

(A ⋅ B ⋅ C) = A + B + C
(A + B + C) = A ⋅ B ⋅ C

68
Example

Let's see an example of a method using a truth table and


Boolean Algebra to prove the following relation: The two columns are identical.
This means that equality applies.
Y = (A + B) ⋅ (A + C) = (A + B ⋅ C)
We create a truth table where rows represent variables
of the functions and columns represent terms of the
equation.

A B C (A + B) (A + C) (B ⋅ C) (A + B) ⋅ (A + C) (A + B ⋅ C)

0 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0

0 1 0 1 0 0 0 0

0 1 1 1 1 1 1 1

1 0 0 1 1 0 1 1

1 0 1 1 1 0 1 1

1 1 0 1 1 0 1 1

1 1 1 1 1 1 1 1

Now let's prove the function using the rules of Boolean Algebra that we have learned.

Y = (A + B) ⋅ (A + C) = (A + B ⋅ C)

Y = (A + B) ⋅ (A + C) = A ⋅ A + A ⋅ C + B ⋅ A + B ⋅ C
(1 + C + B) = 1
=A+A⋅C+B⋅A+B⋅C
= A ⋅ (1 + C + B) + B ⋅ C
=A⋅1+B⋅C
= (A + B ⋅ C) A⋅1=A

69
Logic Gates
Logic gates are small electronic components that take a set of Boolean input values and
output Boolean values that are determined by the ruleset of the gate. They apply Boolean
operations to produce their result values. Each logic gate has a unique result set. Logic gates
are combined to design more complex functions and integrated components. In this section
we will analyze each type of logic gate.

Logic Gate NOT


A NOT gate accepts one input value and produces one
output value. The NOT operator inverts the input.
Y=A

Input A Output NOT A


0 1 Input Output
1 0

Logic Gate AND


An AND gate uses two input values, which both
determine the output.

Input A Input B Output A AND B Y=A⋅B


0 0 0
0 1 0
Input Output
1 0 0
1 1 1

Logic Gate OR
An OR gate has two inputs which both generate the
output.

Input A Input B Output A OR B Y=A+B


0 0 0
0 1 1
Input Output
1 0 1
1 1 1

70
Logic Gate XOR
An XOR, or exclusive OR, gate produces 0 if both inputs
are the same, and 1 if they are different.

Y=A⊕B
Input A Input B Output A XOR B
0 0 0
0 1 1 Input Output
1 0 1
1 1 0

Let's see examples with lamp circuits.

Example

A AND B
The lamp will glow only when both the
series connected switches are closed.

Input A Input B Lamp A AND B A B


OFF OFF OFF Y
OFF ON OFF
ON OFF OFF
ON ON ON

Example

A OR B
The lamp will glow when either of the parallel
connected switches is closed.
A
Input A Input B Lamp A OR B
OFF OFF OFF Y
B
OFF ON ON
ON OFF ON
ON ON ON

71
Example

A XOR B
The lamp will glow when both of its two
input terminals are at different logic levels
with respect to each other.
1 0
Input A Input B Lamp A XOR B
Β
OFF OFF OFF Y
A 0 1
OFF ON ON
ON OFF ON
ON ON OFF

Y=A
If the outputs of the logic gates OR, AND and XOR are connected
with an input of a logic gate NOT, then new gates will be created. Input Output

Logic Gate NAND


A NAND gate inverts the result produced
by an AND gate. Input Output

Input A Input B Output NOT (A AND B)

0 0 1 AND NOT = NAND Y=A⋅B

0 1 1

1 0 1
Input Output
1 1 0

In most logic systems, NAND and NOR functions actually


require fewer transistors than AND and OR gates.

72
Logic Gate NOR
A NOR gate inverts the result produced
by an OR gate. Input Output

Input A Input B Output NOT (A OR B)

0 0 1 OR NOT = NOR Y=A+B

0 1 0

1 0 0
Input Output
1 1 0

Logic Gate XNOR


An XNOR gate produces the inverse results of
an XOR gate. This gate produces 0 if both inputs Input Output
are different and 1 if they are the same.

Input A Input B Output NOT (A OR B)


XOR NOT = XNOR Y=A⊕B
0 0 1

0 1 0

1 0 0
Input Output
1 1 1

Τable 3.3 shows the logical operations and expressions for each logic gate.

Table 3.3: Logical operations and expressions

Operation NOT AND OR XOR NAND NOR XNOR

Expression A A⋅B A+B A⊕B A⋅B A+B A⊕B

73
When drawing a logic circuit for a function, it is important to start from the
outputs and continue to the inputs. Let's look at the following example:

Example

Create the following function circuit: Y=A⋅B+A⋅C

OR
A⋅B
1 You must first create the logic gate A⋅B+A⋅C
OR at the output.
A⋅C

A
AND1
A⋅B

B OR
2 Then you must create the logic
gates AND1 and AND2. A⋅B+A⋅C

A
AND2

A⋅C
C

3 Finally you must create the logic gates


NOT1 and NOT2 for A and C.

A A AND1
A⋅B

B OR
NOT1
B A A
A⋅B+A⋅C

A AND2
NOT2
C C C
A⋅C
C

74
Now we will look at how the function Y = (A + B) ⋅ (A + C) is designed with
logic gates and how we can simplify it to Y = (A + B ⋅ C) to save gates.

Example
Circuit 1

OR1
A
A+B

AND
B
Y = (A + B) ⋅ (A + C)

OR2

C
A+C

A
Circuit 2

OR
A
B
Y = (A + B ⋅ C)

AND

C
B⋅C

Observing the two circuits, we observe that INFORMATION


in circuit 2 we have the same result as circuit
1 but with one gate less. In the process of designing
electronic devices that use many
logic gates, by simplifying the
circuit we can save materials.

75
Exercises

1 What is the main difference between digital and electrical circuits?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 Which logic gate outputs 1 only when it has different inputs


(e.g. A = 0 and B = 1).

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

3 Match the items in the first column with those in the second.
Operation Expression

NOT A⋅B

AND A+B

OR A⋅B

XOR A⊕B

NAND A+B

NOR A⊕B

XNOR A

76
4 Identify the names of these logic gates and complete the truth table, then write the
Boolean expression for each of these logic gates and the Boolean Algebra relationship
between the entries (A,B) and the output (Y).

A B Output

0 0

0 1
Y=

1 0

1 1

A B Output

0 0

0 1
Y=

1 0

1 1

A B Output

0 0

0 1
Y=

1 0

1 1

77
5 Convert the function Y = A ⋅ (B + C) to a sum of least terms and draw a truth table.

6 Use Boolean Algebra to convert the function Y = A ⋅ [B + C ⋅ (D + E)] its simplest


form.

____________________________________________________________________________________________

____________________________________________________________________________________________

7 Use the function Y = A ⋅ B + A ⋅ B to draw the circuit from the output to the inputs.

OR

Y=A⋅B+A⋅B

78
8 Write the Boolean expression for each logic gate represented by the logic diagram
below, using symbols.

XOR

OR
B
AND

NOT
C

What is the output if A, B and C are all True (1)?

XOR

OR
B
AND

NOT
C

79
Lesson 2

Karnaugh Maps
Karnaugh Maps
Karnaugh maps were introduced by Maurice Karnaugh in 1953 at Bell Labs and are
used to simplify the design ofdigital circuits.
Karnaugh maps are used to clearly depict the output results of a complex digital circuit.
They are especially helpful when we have a circuit with more than 2 inputs. If we were
to use a truth table for this task, it would use a lot of space and it would be difficult
to read. Karnaugh maps depict the same information in a more compact format.
The following is a depiction of a truth table and a Karnaugh map.

For a function with two inputs, we can see how to place the corresponding results of
function Y in positions 1, 2, 3 and 4 of the Karnaugh map.

Input A Input B Output Y


A A
0 0
B 1 2
0 1
1 0 B 3 4
1 1

Karnaugh maps are used to group Boolean expressions instead of going through the
Boolean Algebra calculations for multiple variable inputs.

Let's see an example of the function Y = A ⋅ B + A ⋅ B + A ⋅ B to see


how we create a Karnaugh map.

Example
A⋅B
A
B 0 1 When placing the
In a Karnaugh map, the variables A and B in
variables are replaced by 1 and 0 0 1 the Karnaugh map, it
is your choice which
their complement by 0. will be horizontal and
1 1 1 which will be vertical.
A⋅B A⋅B

80
Then with the help of the Karnaugh map, we can simplify the function
Y = A ⋅ B + A ⋅ B + A ⋅ B using fewer terms.

Example Terms of the


A Function
0 1
B The terms of the
0 0 1 function are referred
A to as minterms.
That is, a term A ⋅ B
1 1 1 Y=A+B is called minterm,
while a term A + B is
Β
called maxterm.

The aces you Here we are deleting terms that contain a term
merge must and its complement in a loop. In the vertical loop,
always be an we notice that the term B changes and is therefore
even number. eliminated, and the result becomes only the term A.

The procedure for simplification of the above Boolean function has been
completed. We could summarize the process in the following steps:

1 Find the minimum terms of the function.

Function: A ⋅ B + A ⋅ B + A ⋅ B A 0 1
B
0 1 Α⋅B

2 Find the aces (1) and place them in the Karnaugh map. 1 1 1 Α⋅B

Α⋅B

3 Create loops around adjacent aces (1) in an even number


of squares (2, 4 or 8). A 0 1
B
0 0 1

4 We simplify the minimum terms that result by deleting


terms that contain a term and its complement in a loop. 1 1 1

Deleted terms: A ⋅ B, A ⋅ B
A A

B
5 The remaining terms, one from each loop, are linked by
the operation OR (+) in the final form of the function.
B
0

1
1

1
Final form of the function: Y=A+B

81
Let's see how the Y function can be implemented with far fewer logic gates after its simplification.

Y=A⋅B+A⋅B+A⋅B

AND1
A Β
A⋅B
NOT1
A
OR1
A⋅B+A⋅B
AND2
OR2
NOT2
A⋅B
Β

AND3 Y=A⋅B+A⋅B+A⋅B

A⋅B

A 0 1 A Β
B
0 0 1

1 1 1
OR

Y=A+B

INFORMATION

It is not usual to use the Karnaugh map for 2 inputs because


the simplification can be achieved very easily with Boolean
Algebra, but for 3 or more inputs it can be extremely helpful.

82
It is not necessary to use a Karnaugh map for two-input logic gate functions, as they are
usually simplified using Boolean Algebra. However, in cases when we have functions that
have logic gates with more than two inputs, the Karnaugh map helps to simplify the circuit.
Let's look at an example of a Karnaugh map with 3 inputs (A, B, and C).

Example
ΑΒ
In the horizontal row, we place in pairs the 0 and 1 for the C 00 01 11 10
variables A and B so that in successive squares the value
of only one variable changes. 0

Choose 2 inputs in the row and 1 input in the column 1

Let's see where the aces (1) will be placed in the Karnaugh map for the following function:

ΑΒ
C 00 01 11 10

The term A ⋅ C lacks the variable Β. So according to 0 1 1


Boolean Αlgebra, the term A ⋅ C = Α ⋅ B ⋅ C + Α ⋅ B ⋅ C.
1 1
B+Β=1

Α⋅B⋅C Α⋅B⋅C

ΑΒ
C 00 01 11 10

The term B ⋅ C lacks the variable A. So according to 0 0 0 1 1


Boolean Αlgebra, the term B ⋅ C = Α ⋅ B ⋅ C + Α ⋅ B ⋅ C.
1 0 1 1 0
Α+Α=1
The new minimum
terms may lead you Α⋅B⋅C Α⋅B⋅C
to cells that already
have an ace.
ΑΒ
C 00 01 11 10

0 1

Y=B⋅C+A⋅C 1 1

B⋅C A⋅C

83
Now let's look at an example with 4 variables (A, B, C and D).
We will simplify the function using a Karnaugh map:

Example
ΑΒ
CD 00 01 11 10
Y=A⋅B⋅C⋅D+A⋅B⋅C⋅D+A⋅B⋅C⋅D+A⋅B⋅C⋅D
00 0 0 0 1

01 0 0 0 1
After simplifying the function, using the
Karnaugh map, we get the following function:
11 0 0 0 1

Y=A⋅B 10 0 0 0 1

Aces that appear at the edges of the map are considered adjacent
to those at the opposite edge.
Let's see some examples :

Example Example

Y=A⋅B⋅C⋅D+A⋅B⋅C⋅D+A⋅B⋅C⋅D+A⋅B⋅C⋅D+A⋅B⋅C⋅D Y=A⋅B⋅C⋅D+A⋅B⋅C⋅D

ΑΒ ΑΒ
CD 00 01 11 10 CD 00 01 11 10

00 0 0 1 1 00 0 0 0 0

A⋅B⋅C
01 0 0 0 1 01 1 0 0 1

11 0 0 0 0 11 0 0 0 0
A⋅D
10 0 0 1 1 10 0 0 0 0

After simplifying the function using After simplifying the function


the Karnaugh map, we obtain the using the Karnaugh map, we
following result: obtain the following result:

Y=A⋅D+A⋅B⋅C Y=B⋅C⋅D

84
Exercises

1 Why do you use the Karnaugh map in digital circuits?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 Use the following numbered positions of the output Y to complete the Karnaugh
map below.

Input A Input B Input C Output Y


0 0 0 1
ΑΒ
0 0 1 2 C 00 01 11 10
0 1 0 3
0 1
0 1 1 4
1 0 0 5
1
1 0 1 6
1 1 0 7
1 1 1 8

3 Using the given function, circle the errors in the Karnaugh map.
ΑΒ
C 00 01 11 10

Y=A⋅B⋅C+A⋅B⋅C+A⋅B⋅C 0 1 0 0 0

1 0 1 0 1

85
4 Use the Karnaugh map to find the minimum function from three inputs.

ΑΒ
C 00 01 11 10

0 0 0 1 1
Y=
1 1 0 1 1

5 Use the Karnaugh map to find the minimum function from four inputs.

ΑΒ
CD 00 01 11 10

00 0 0 1 0
Y=
01 1 0 0 1

11 1 0 0 1

10 0 0 1 0

6 When we have each of the binary numbers (000), (100), (110) and (111) as inputs
(A, B and C) in a circuit, then (1) appears at the output.
Place the aces on the Karnaugh map and find the simplified function.

ΑΒ
C 00 01 11 10

0
Y=

86
After you have found the simplified function, draw the corresponding digital circuit.

87
Lesson 3

Drawing Digital Circuits

Core Hardware Components


of a Digital Circuit
Digital circuits are built with the following core
components:
> Conducting wires or traces, which connect all the
components in a circuit. Current direction is guided
with the use of diodes.
> Transistors that switch digital signals between the
Boolean values 0 & 1.
> Logic gates, which are special arrangements of
transistors that implement Boolean logic in the
circuit. These are combined to create components
that implement more complex logic. The 2 main
types are:
• Adders, which implement the basic numerical
operations of addition, subtraction, multiplication,
and division.
• Flip-flops, the fundamental components of computer
memory, which store inputs and outputs.

Diodes
Diodes are semiconductor components
that conduct and direct electrical current
in a single direction. They consist of two
terminals, an anode and a cathode, and
have negligible resistance in one direction,
and high resistance in the opposite
direction. They therefore direct the current
flowing through them in one direction.

Terminals of Diodes
Cathodes are electrodes that divert current
away from the component that they inhibit.
Anodes draw current towards the same
component.
The polarity of these two electrodes allows
them to divert and control the flow of
electrical current at a point in a circuit.
Figure 3.1: Electronic components

88
Some of the most common use of diodes include:
> Converting Alternating Current into Direct Current
in a rectifier.
> Building simple logic gates (AND, NOT, OR).
> Recovering and decoding radio signals through
demodulation in radio receiving devices.
> The production of LED lights (Light Emitting Diodes).
These diodes emit light when an electric current
flows through them.

Figure 3.2: DC voltage graph


The basic diode types are:

Signal diodes Power diodes LEDs Schottky diodes Zener diodes Photodiodes

Transistors
Transistors are one of the most important inventions
of modern technology. They are semiconductors
that can switch and amplify signal inputs.
They were invented in order to replace vacuum
tubes because they had two significant advantages.
They are very small in size relative to vacuum tubes,
which means that they can be embedded in digital
and integrated circuits.
They also consume much less power, which makes
them a more cost effective and energy efficient
alternative to vacuum tubes. Transistors are the
Vacuum tubes basic building blocks of complex logic gates.

Transistors

Figure 3.3: Vacuum tube and transistor size comparison

89
Integrated Circuit (IC)
If you open an electronic or digital device, you will
see small components with a series of pins, called
chips or microchips. A microchip is a flat piece of
semiconductor material, usually silicon, that integrates
transistors, resistors and capacitors. Logic gates are
comprised of resistors and transistors, or diodes. By
joining a variety of logic gates, the circuit can perform
simple or complex operations. All this digital circuitry
is called an integrated circuit (IC).

Figure 3.5: VLSI packaging

The integrated circuit is the building block of all modern


electronic and digital devices. The integrated circuit is
orders of magnitude smaller, faster, and less expensive
than a circuit constructed of discrete electronic
components. But, the high initial costs of design and
preparation require high production volumes to keep
the cost per chip low.
Figure 3.4: Typical IC packaging

Based on their design and thevnumber of


transistors per chip, integrated circuits are Table 3.4: Integrated Circuit
categorized as: Scale of
Number of Transistors
> Small Scale Integration (SSI): Tens to hundreds Integration
of transistors
SSI 2 ≈ 100
> Medium Scale Integration (MSI): Hundreds
to thousands of transistors MSI 100 ≈ 2.000
> Large Scale Integration (LSI): Thousands to
several hundred thousand transistors LSI 2.000 - 100.000
> Very Large-Scale Integration (VLSI): Up to two VLSI 100.000 - 2.000.000
millions transistors
> Ultra-Large-Scale Integration (ULSI): Millions ULSI > 2.000.000
and billions of transistors

An integrated circuit can also be classified as being digital, analog


or a combination of both. Its primary objective is to embed as many
logic gates as possible as well as other digital circuitry on a single
semiconductor chip. A computer’s CPU is a type of integrated circuit
and a modern CPU may embed hundreds of billions of transistors.

90
If we could open a simple IC such as 74LS08, we would
see that its circuitry implements four AND logic gates
as shown in the illustration below.
The actual implementation is done through
transistors, diodes and resistors, but the chip's
functionality resembles that of the illustration. The
schematic shows the actual circuit of just one AND
gate.

VCC A4 B4 Q4 A3 B3 Q3
14 13 12 11 10 9 8

1 2 3 4 5 6 7
A1 B1 Q1 A2 B2 Q2 GND
Figure 3.6: The logic gates of 74LS08 IC
Copyright © 1988, Texas Instruments Incorporated

Figure 3.7: Schematic diagram of one AND gate in 74LS08

Similarly, a CPU consists of billions of logic gates to perform arithmetic and


logic operations and to temporarily store data for processing.

Figure 3.8: Magnified images of a typical CPU

91
Logic Gates on Multisim Live

Operation Logic gate

NOT

AND

OR

XOR

NAND

All the logic gates NOR


are located inside
the Digital tab on the XNOR
components toolbar.

The Digital Constant


can switch between 0
and 1.

Figure 3.9: Multisim Live circuit simulator

92
Drawing Digital Circuits
Let's go to www.multisim.com to log in to your account and create a new file.
You will create the digital circuit of an AND logic gate.
First you will add a switch and name it "A".

Add Digital Constant A:

> On the Components toolbar, click the Digital tab. 1

> Drag 2 and drop a Digital Constant into the work space. 3

> Change the name of the Digital Constant to "A". 4

The Digital Constant


produces a strong
digital 1 (high) or 0
(low) state
4

1 2

Figure 3.10: Add Digital Constant A

SMART TIP
A digital constant works like a switch and you can change its
state from 1 (high) to 0 (low) just by clicking the toggle button or
by clicking directly on the switch when the simulation is running.

93
Then you will add a second switch and name it "B".

Add Digital Constant B:

> On the Components toolbar, click the Digital tab. 1

> Drag 2 and drop a Digital Constant into the work space. 3

> Change the name of the Digital Constant to"B". 4

Don't forget, you


can always use the
duplicate button
to add more of the
same components.

1 2

Figure 3.11: Add Digital Constant B

94
Now, let's add your first logic gate.

Add logic gate AND:

> On the Components toolbar, click the Digital tab. 1

> Click on the AND folder. 2

> Drag 3 and drop 2-Input AND into the work space. 4

> Change the name of the 2-input AND to "AND". 5

1
2

Figure 3.12: Add logic gate AND

95
Continue by connecting the AND gate with switches "A" and "B".

Connections:

> Click on the Digital Constant A 1 and then


on the upper input of the 2-input AND. 2
> Click on the Digital Constant B 3 and then
on the lower input of the 2-input AND. 4

Figure 3.13: Connections

96
Now we will add an LED so you can see when the result
is 1 (high state) or 0 (low state). LED
A light-emitting
Add LED: diode (LED) is a
semiconductor
> On the Components toolbar, click the Diodes tab. 1
device that emits
> Drag 2 and drop an LED into the work space. 3 light when an
electric current
> Click the Rotation button 4 to rotate the LED into flows through it.
this position. 5

States of an LED
4
(0) LOW (1) HIGH

Figure 3.14: Add LED

97
Then you will connect the AND gate with LED1.

Connections:

> Click on the output of 1 2


the 2-input AND 1
and then on the input
of LED1. 2

Figure 3.15: Connections

Now, let's add a digital probe.

Add a probe:

> On the Components toolbar, click


the Analysis and annotation tab. 1
> Drag 2 and drop a Digital probe in
series with LED1. 3
Digital probes can be
added to a digital circuit
to show us if the value is
0 (low) or 1 (high) at the
specific point where the
probe is located.

2
1

Figure 3.16: Add a probe

98
Then you will add a ground to your digital circuit.

Add ground:

> On the Components toolbar, click the Schematic connectors tab. 1

> Drag 2 and drop Ground into the work space. 3

2
1

Figure 3.17: Add ground

Finally, you need to connect LED1 with the Ground.


Ground

Connections: Grounding in
integrated circuits is a
> Click on the output of LED1 1 and then on the Ground. 2 reference point (0) for
measuring voltages.
It also serves as a
fail-safe mechanism in
the event that a fault
or damage occurs in
1 the circuit.

Figure 3.18: Connections

99
Let's take a look at how the digital circuit works in simulation mode.
> In the first example, both inputs "A" and "B" are (0) Low and the output is also (0) Low.
> In the second example, input "A" is (1) High, input "B" is (0) Low and the output is (0) Low.
> In the third example, both inputs "A" and "B" are (1) High and the output is (1) High.

Example
Don't forget, to run the
simulation, you need to
press the play button.

In simulation mode, when the input is in state (1) High


and current passes through the cable, its color changes
from blue to light blue.

Digital probes show The LED state is (1) High,


(1) High state. so it emits red light.

INFORMATION
When you use digital probes, d Lo = (0) Low and d Hi = (1) High.

100
Half Adder
A half adder is a digital circuit that performs addition of numbers. A half
adder adds two single-digit binary numbers and the result is a two-digit If we combine two half
output denoting the sum and the carry. It has two inputs, called A and B, adders together with
the use of an OR gate,
and two outputs S (sum) and C (carry). The most common circuit uses one the result is a full adder.
XOR and one AND logic gate.

A B S C
A S
0 0 0 0
Half adder 0 1 1 0
1 0 1 0
B C
1 1 0 1

1 bit half adder Carry (C) Sum (S)

Example

Schematic of a half adder

INFORMATION
Half adders and full adders are both digital circuits that are used to implement combinational
logic. They are both used to sum calculations. The main difference is that full adders use the carry
from a previous calculation as a third input in a 2-bit calculation, whereas half adders ignore
any previous values for a carry bit. Full adders are made of 2 half adders and an OR logic gate.

101
Exercises

1 Which are the two types of gates you can make when you combine logic gates?
How you can use each one?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 What is the function of diodes and what are their two terminals?
____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

3 What are the advantages of using transistors?


____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

102
4 What is an integrated circuit (IC)?
____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

5 Open Multisim Live and draw the basic circuit of an OR logic gate. The components
that you will need are shown below:

6 Use Multisim Live to draw the digital circuit that corresponds to the following function.

Y = (A + B) ⋅ (A ⋅ C)

103
7 Create the following digital circuit in Multisim Live:

In which states is the probe (output) (0) Low and in which states is it (1) High?
Run the simulation and fill in the table below:

Input A Ιnput B Ιnput C Output Y

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

104
Project

A COUT
In this project, you can see how
a full adder is simplified into B Full adder
two half adders.
CIN S

CIN A S SUM

Half adder

A A S B COUT C

Half adder
COUT
B B COUT

Do the following:

Use Multisim Live to design a full adder and connect


all the logic gates in the correct manner.

After you have built the circuit, write the truth table and
the Karnaugh map, and see if it can be simplified.

105
Wrap up

Now you have learned how to:


> use the rules of Boolean Algebra.
> use Boolean Algebra to simplify functions.
> combine logic gates.
> use Karnaugh maps to simplify functions.
> use Multisim Live to design and simulate
digital circuits.

KEY TERMS

Boolean Algebra Encoder LED

Decoder Flip-Flop Logic Gate

Demultiplexer Integrated Circuit Multiplexer

Diodes Karnaugh Map Transistor

106
107
4. Circuit Simulation
with Tinkercad
Circuits
In this unit, students will learn how to use an application to
simulate electronic circuits. More specifically, students will
learn how to create, edit, and simulate electronic circuits in
Tinkercad Circuits. Students will also learn how to use the
application to make measurements and to troubleshoot
circuits.

Learning Objectives
In this unit you will learn to:
> Design an electronic circuit with Tinkercad Circuits.
> Apply best selection practices while connecting
electronics components.
> Simulate an electronic circuit.
> Design experiments in electric circuits.
> Measure current on an electronic circuit using
various techniques.
> Troubleshoot an electronic circuit.

Tools
> Autodesk Tinkercad Circuits

108
Lesson 1

Electronic Circuit Design


and Simulation

What Tinkercad Circuits is


Tinkercad Circuits is a free web-based application, created by Autodesk for education, that lets
you create digital and analog prototypes of electronic circuits. Simple circuits with LEDs, buzzers,
switches and even sensors can be easily created and tested on this platform. A microcontroller, the
most basic type of programmable computer, may be included in the design of these prototypes
to control electronic components such as LEDs and motors. Tinkercad Circuits is part of a group
of tools that includes utilities for 3D design and modeling. Coding can be used in your 3D designs
and microcontroller circuits.

Figure 4.1: Autodesk Tinkercad Circuits

Tinkercad Circuit is a prototyping tool, it allows users to design and build an early model
of a product in order to test and evaluate it. A prototype can serve as a proof of concept,
showing that the system or device can be built and will perform as expected. Despite its
simplicity, Tinkercad Circuits has strong simulation capabilities. This means that there is no
need to buy physical components such as sensors, Arduino boards or motors in order to test
if a prototype will work, and no physical components are damaged if the circuit is faulty.

109
You can access Tinkercad Circuits from https://www.tinkercad.com, and you can create a personal
account to save and share your circuits with others. There is also a gallery of public designs for the
three categories of projects: Designs, Circuits and Codeblocks.
You can reuse and expand any public circuit with the Copy and Tinker button.

Figure 4.2: Tinkercad Circuits Copy and Tinker feature

Electrical and electronic circuits are the cornerstone of each and every device, and everyone working
in the field of electronics must understand their design and implementation. In this unit, you will learn
the basics of building an electronic circuit with Tinkercad Circuits. You will explore the interactive circuit
editor and simulate your prototypes in a safe environment.

Figure 4.3: Tinkercad Circuits Gallery

110
Before you start designing your electronic circuit in Tinkercad Circuits, you should get a rough idea of what your circuit
should look like by creating a hand-drawn sketch. When you are satisfied with your drawing, go to the Tinkercad
website. In this lesson, we will create a circuit and use the Start Simulation button to turn an LED ON or OFF.

To create an electronic circuit:


> Open a web browser and go to https://www.tinkercad.com. 1

> Click on JOIN NOW. 2


> Create an account, 3 and Sign in. 4
> On the Tinkercad home page, click Circuits. 5
> Click Create new Circuit. 6
> A circuit project is created and opened. 7

4 2

111
6

This option lets us create Try using


a virtual circuit, program existing
it, and test it in real time. circuits.

Figure 4.4: Create a circuit in Tinkercad Circuits

112
The Main Window of Tinkercad Circuits

Switch between
Go to Tinkercad's Circuit View, Schematic
dashboard. View and Component List.

Set the
Type your
name of
code.
the design.

Edit the components


using the main toolbar.
Center and
zoom the
design to fill
Start the
the window.
simulation.

Place all the Find the components


components for your design in the
of the circuit in components library.
the workplane.

Figure 4.5: Tinkercad Circuits main window

Views
The Circuit View is the first view, and it's opened by default. The Schematic view
contains an auto-generated schematic diagram of the design, and the Component
List lets you export a BOM (Bill Of Materials) that lists all the components that
have been added to the circuit.

SMART TIP
Tinkercad Circuits has an automatic saving system.
The system will update the save file every few minutes.

113
Core Components and Wiring
Electronic components such as LEDs, buttons, resistors, power sources can be used. These are the
components available in the Basic option:

Resistor 1.5V Battery NPN Transistor (BJT)

LED Breadboard Small LED RGB

Pushbutton micro:bit Diode

Potentiometer Arduino Uno R3 Photoresistor

Capacitor Vibration Motor Soil Moisture Sensor

Ultrasonic Distance
Slideswitch DC Motor
Sensor

9V Battery Micro Servo PIR Sensor

Coin Cell 3V Battery Hobby Gearmotor Piezo

Figure 4.6: Tinkercad Circuits core components


Temperature Sensor
[TMP36]

Multimeter

114
A breadboard is typically used to connect components. A breadboard is a piece of plastic with numerous
holes. These holes are used to keep various components in place.

To add a component
to the design:
> Click the base
component you want
to add to the design,
for example, the
Breadboard Small. 1
1
> The component is
temporarily linked to the
mouse pointer.
> Click in the workplane to
place the component. 2

The inspector panel lets


you edit the properties of a
component.

Click on the
"Zoom to fit"
button so the
breadboard is
centered and fills 2
the workplane.

Click on the
Delete button, to
delete a selected
component.

Click here to hide the


components panel
button.
Figure 4.7: Add a component to the design

115
The Breadboard
In the main area of the breadboard, there is a grid of thirty by ten holes. The columns are labeled 1
through 30, and the rows are labeled a through j. A piece of plastic separates rows a through e from
rows f through j.

Figure 4.8: Breadboard


selection
A metal connection under the plastic that
connects all holes in the same column electrically.

At the edge of the breadboard are two rows with the same number of columns. There are negative and
positive symbols on these rows. These represent connections to the battery (main power source). To draw
electric current, the components in the middle of the breadboard tap into these rows.

(-) Row

(+) Row

Column

116
Closed Circuit with an LED
We will design a simple closed circuit with light. A Light Emitting Diode, or LED, will provide the light.
Current can only flow in one direction through an LED. This is different from a regular light bulb, where
current can flow in either direction. An LED has two connections, one for the cathode "negative" and
one for the anode "positive". The lead of the anode is usually longer than the lead of the cathode. In
Tinkercad Circuits, a bent lead identifies the LED anode. The positive voltage must connect there.

To place a component onto the breadboard:


> Click the component, for example the LED. 1 This undoes the
> Click to place the LED onto the breadboard last action done
so that each wire of the LED is in a hole. 2 to the design.

The straight wire on the


LED icon indicates the
negative (Cathode) side
of the LED. - +

Pan the view around a


design by clicking and
dragging the empty
space around it.
Figure 4.9: Place a component onto the breadboard

117
To add a power source to the circuit:
> On the components panel, click on a power
source, for example the 1.5V Battery. 1
> Click and place the battery along the left
side of the breadboard. 2

Figure 4.10: Add a power source to the circuit

SMART TIP
You can zoom in or out of a design by using the
mouse wheel or the key combination Ctrl + +
to zoom in and Ctrl + - to zoom out.

118
In electronic circuits, it is easier if the terminals are placed directly opposite the connectors.

To rotate a component:
> Click on the component to The Mirror button flips the
select it and make a blue selected component. This
frame appear around it, for allows you to quickly design
example the 1.5V Battery. 1 components with symmetry.
> Click the Rotate button
on the main toolbar three
times, as it rotates in small
increments of approximately
30 degrees each time,
to rotate the battery 90
degrees clockwise so that 2
the terminals face the
breadboard. 2

Figure 4.11: Rotate a component

119
The battery must supply voltage to the LED of the circuit. Lead wires or Jumper wires are used to connect
components that are not in the same row. These are plastic-covered wires with exposed ends that can be used
to connect components. That is one of the reasons they are referred to as Jumper wires.

To wire a component:
> Click on the negative
terminal of the
component, for example
that of the battery. 1
> Click on the first hole in
the negative column to 1
make the connection. 2
> Repeat the process with
the positive terminal,
placing the jumper wire
on the positive hole on The label describes
the breadboard. 3 the component
element selected.

120
3

Figure 4.12: Wire a component

121
When many wires jump from one location
To edit a wire:
to another, circuits can quickly become
complicated. It is usually a good idea to > Click on the positive terminal. 1
color code the wires. In electronics, certain > In the main toolbar, click Wire color. 2
colors are commonly used. In DC circuits, red > Click on the color Red. 3
is typically used for positive connections and
black for negative connections. Green is also > Repeat the process for the negative terminal
used occasionally for ground. and change the Wire color to Black. 4

122
One of the advantages of using a breadboard is that the components can be easily moved to make new connections
or to make room for other components.

Figure 4.13: Edit a wire


In this case, for
example, we drag and
drop the LED to row f.

SMART TIP
When a wire is selected, you can change its color by typing any number
on your keyboard. Typing 0 will, for example, result in a black wire.

123
The circuit is still open. To complete the circuit, two wires are required. One wire is for the positive terminal and
one for the negative. The positive terminal must be connected to the anode of the LED.

To close a circuit:
> Click on Column 4 Row j to begin a jumper wire. 1
> Connect the other end of the wire to the positive column. 2
> Connect another wire from Column 3 Row j, to the negative
terminal column. 3
> Change the color of the wires to match the polarities. 4

SMART TIP
The type of a selected wire can be changed to normal, alligator
or hookup using the Wire type tool in the main toolbar.

124
3

Figure 4.14: Close a circuit

125
Nothing happens in the circuit editor until the simulation is executed. Simulation in Tinkercad Circuits simplifies the
learning process. It is free, works on any computer with an Internet connection, and is suitable for any class size.

To run a simulation:
> In the Circuit View, click on Start Simulation. 1
LEDs have a voltage
> The LED on the breadboard will change to a lighter limit. If the voltage
color to simulate that the LED has turned ON. 2 is too high, the LED
will burn out and
stop working. In this
case, a simulator is
extremely helpful.
We don't want
the LED to burn
1 out in a real-world
application.

The Stop Simulation


button stops the
simulation so that the
circuit can be edited.

The LED does not seem


particularly bright. This is
not due to the program 2
but the voltage supplied
to the LED. This battery
supplies a low voltage.
Figure 4.15: Run a simulation

126
Simulations allow us to experiment with circuit development. In this case, we will edit the power source to test
the circuit.

To edit and test a circuit:


> Click the battery once to select it. 1
> Go to the inspector panel and click Count. 2
> Click 2 batteries. 3
> Click Start Simulation. 4
> The star over the LED indicates that the LED blew out. 5
> Click Stop Simulation, 6 and change the number of batteries to
1 battery. 7
> Click Start Simulation again, 8 to verify that the circuit is
functioning normally.

SMART TIP
You can activate the commands Start Simulation and
Stop Simulation with the S key on your keyboard.

127
4

Later, we will add a


resistor in series to
limit the current.

128
8

Figure 4.16: Edit and test a circuit

129
Exercises

Read the sentences and tick True or False. True False

1. Tinkercad Circuits is a web-based simulator.

2. You can build and simulate an electrical circuit with Tinkercad Circuits.

3. Tinkercad Circuits is used by engineers to build advanced computer


designs.

4. Resistors, power sources and LEDs are the only components you can
use in Tinkercad Circuits.

5. The Component List displays all the components of the designed


circuit.

6. It is better to use the same color for all wire connections.

7. Power rails are columns along the left and right sides of the breadboard
marked with [+] and [-] labels.

8. The black wire (Ground Wire) carries the return current back to the
energy supply.

9. The red wire (Live Wire) carries the current from the power source.

130
2 Briefly explain what prototyping is.
____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

3 Design the following circuit using Tinkercad Circuits. Run the simulation. Note if it
works correctly and if not, what corrections need to be made. Fix the circuit in the
application. Which basic principle does the circuit describe?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

131
4 Search the Internet for applications similar to Tinkercad Circuits. Compare them and
write down your conclusions.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

5 What are the advantages of Tinkercad Circuits? Justify your answer.


____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

6 What limitations do you observe when using Tinkercad Circuits?


____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

132
Lesson 2

Troubleshooting and Measurements

To begin, we will build a circuit that includes a power source, an LED, and a pushbutton. Let us examine how the
pushbutton works.

The Pushbutton
The pushbutton serves as a temporary
connection. It has a large circle in the
center that closes the circuit. There are four
connectors on the pushbutton. Each corner
of the button has a connector.

Looking at the underside, we can see that


the left and right connectors are actually two
wires. There is one wire on each side of the
button.

Looking at the pushbutton from the front,


we can see that it hovers over the two wires
with a spring.
The spring is not visible in the illustration.
Electric current cannot flow through the
circuit when the pushbutton is above the
wires. In the illustration, the electric current
is represented by the red dashed arrow
pointing up.

The circuit closes when the pushbutton is


pressed, and current flows from one side of
the pushbutton to the other.

Figure 4.17: Pushbutton states

133
Looking from the side, when we connect a circuit to the ends
of one wire on one side of the switch, that wire inside the
switch allows current to flow even when the button is not
pressed.

When connecting components, we must ensure that they


are connected to opposing sides of the switch. As shown in
the illustration on the right, a connection can be made at
diagonally opposite ends.

A connection can also be made at neighboring opposite ends,


as shown in the image on the right.

Figure 4.18: Pushbutton connections

It is critical to connect the correct ends of the pushbutton to ensure that the circuit works properly.

A pushbutton on a circuit
is typically used to open
and close the circuit. We
will use the same circuit
as in the previous lesson,
but this time we will add
a pushbutton. This is the
previous lesson's circuit:

Figure 4.19: Circuit with battery and LED

134
To add a pushbutton to the circuit:
> On the components panel, click Pushbutton. 1

> Click and place the pushbutton on the


breadboard so that one end is in Row f, and
the other end is in Row e. 2

Figure 4.20: Add a pushbutton to the circuit

The diagonal terminals in this switch represent the switch's opposite ends. This indicates that current will flow
from e5 to f3. The pushbutton will be included in the closed circuit. Placing the pushbutton on f3, one end of the
connector forms part of our closed circuit. Keep in mind that everything in a numbered column is linked. This
means that the pushbutton is wired to one end of the LED and the jumper wire running from j3 is wired to the
negative rail. We must move the jumper wire from the positive terminal to the opposite side of the pushbutton.
This will complete the circuit.

135
To delete a wire using the keyboard:
> Click on the positive terminal jump wire to select it. 1

> Press Delete or Backspace and the wire will be deleted. 2

Figure 4.21: Delete a wire using the keyboard

136
The positive connection has to be made on the other side of the button. Both sides of the breadboard have positive
and negative rails. We will connect the positive end of our battery to the other side of the breadboard.

To detach and move a wire:


> Click on the positive
terminal wire to select it. 1
> Move the mouse pointer
to the end of the wire
that is connected to the 1
breadboard and when a
white dot appears, click on
it to detach the wire. 2
> Click and drag to place
the end of the wire on
the other side of the
breadboard and connect it
to the positive rail. 3

137
3

Next we have to connect the anode on the LED with the positive connection of the electric
current flow, so that the LED turns ON.

Figure 4.22: Detach and move a wire

138
Troubleshooting
Circuit simulation is a technique where we simulate the behavior of an electronic circuit or a whole system
with the assistance of a software application. New designs can be tested, evaluated and diagnosed without
physically constructing the circuit. Through simulation, we can also troubleshoot and gather data before
building a real prototype with electronic components. This allows the engineer to determine the correctness
and efficiency of a design beforehand. The engineer may also explore alternative designs without using any
physical components, at no cost and much faster than with a real prototype. There is an infinite quantity of
simulated components available to build and test alternative designs.
Like other electronic circuits, LED circuits are very sensitive to current. An LED burns out if more current
flows than its rated current, for example 20mA. An appropriate resistor must be used to protect the LEDs,
or the whole circuit, from burning out. Tinkercad Circuits shows you if more than the rated current flows
through the circuit elements when you run the simulation. The program alerts you by showing a red star
on top of the component that has a problem.

Hover over the red star for an explanation of the problem.

Figure 4.23: Simulation with


a current issue

139
Now let's go back to the electronic circuit that we have constructed with a battery, an LED and a pushbutton. We
want to test if the circuit works properly. When we simulate the circuit and press the pushbutton, we observe
that the LED does not light up.

Figure 4.24: Circuit with a component connected inaccurately

The circuit is not working properly. We have to connect the anode on the LED to the positive connection of
the electric current flow. We cannot move components while the simulation is running.

140
To modify and test the
operation of a circuit:
> Click Stop Simulation. 1
> Move the LED to Column 2. 2 1
> Click once on the jumper
wire and move one end so it
connects to the cathode of
the LED. 3
> Click Start Simulation. 4
> Press the pushbutton. 5
> Check that the LED remains
lit while the pushbutton is
pressed. 6
> Release the pushbutton and
the LED will turn OFF. 7
2

141
6

Figure 4.25: Modify and test the operation of a circuit

142
Circuits with Resistors
In this part of the lesson, we will create two identical circuits in the same workspace of Tinkercad Circuits:
one without the breadboard and one with the breadboard. We will use these circuits later in the lesson
to gain a better understanding of current, resistance and voltage. In both cases, we will build a simple LED
circuit with a battery, an LED and a resistor. First we will design an LED circuit without the breadboard. We
have to go to the Tinkercad dashboard by clicking on the Tinkercad logo, and create a new circuit.

Create a new circuit:


> From the components panel, click on Resistor, 1 and The circuit has a 3V battery,
place it on the workplane. 2 and an LED with a forward
> From the inspector panel of the resistor set the voltage (voltage drop) of
approximately 2.06V. The LED's
Resistance to 47Ω. 3 ideal forward current is 20mA.
> Click on the LED, 4 and place it on the workplane. 5 To calculate the resistor value
in Ohms, we use the formula
> Click on the 1.5V Battery, 6 and place it on the R = (Vsource - Vdrop) / Iforward
workplane. 7 which tell us that the
> From the inspector panel, of the 1.5V Battery, set resistance has to be 47Ω.
the Count to 2 batteries to supply the circuit
with 3V. 8
> Wire up the circuit, 9 and start the simulation.

3
1

143
5
4

7
6

144
8

Figure 4.26: Create a new


circuit

145
To continue, we will design an LED circuit on a breadboard. Go to the Tinkercad dashboard by clicking on the
Tinkercad logo, and create a new circuit.

Create a new circuit:


> From the components panel, click on Breadboard Small, 1 place it on the workplane
and rotate it. 2
> Click on Resistor, 3 place it on the breadboard and rotate it. 4
> From the inspector panel of the resistor set the Resistance to 47Ω. 5
> Click on the LED, 6 place it on the breadboard and rotate it. 7
> Click on the 1.5V Battery, 8 place it on the workplane, rotate it and from the inspector
panel of the 1.5V Battery, set the Count to 2 batteries to supply the circuit with 3V. 9

From the screen to the lab.


After simulating the circuit and
testing that everything works as
expected, you can implement
the circuit with real components.
A practical circuit can be
implemented on a breadboard
to make a prototype for display.
The main advantage of the
breadboard circuit is that you
can easily make modifications,
and no soldering is required.
However, breadboard
connections can become loose
very easily, and it is very hard to
identify loose connections in a
complex circuit.

146
3
5
4

6
7

147
8

148
Now, connect the components of the circuit and start the simulation.

Figure 4.27: Create a new circuit

149
Using a Multimeter
Now that we have a working circuit, we can take some measurements with the virtual multimeter of Tinkercad
Circuits. Note that the multimeter has three modes. By default, it functions as a voltmeter in voltage mode,
which allows us to read the voltages across different components in our circuit. We can easily change the
mode of the multimeter by clicking on it to open the inspector panel and selecting a different mode. In
current mode it functions as an ammeter, allowing us to read the current flowing through certain points
in our circuit. In resistance mode it functions as an ohmmeter, allowing us to read the resistance between
certain points in our circuit.

To read voltages:
> From the components panel, click on the 1.5V
Battery, 1 and place it on the workplane. 2
Use the Notes tool from the main
> From the inspector panel of the 1.5V Battery set the toolbar to add annotations to a
Count to 2 batteries to supply the circuit with 3V. 3 design. The same icon appears
in the design and you can drag
> From the components panel, click on the and drop it onto a component
Multimeter, 4 and place it on the workplane. 5 you want to annotate. When you
> Wire up the circuit. 6 click on the design element, the
annotation is anchored and you
> Click Start Simulation. 7 are prompted to type your note.

1
1

150
3

151
7

Figure 4.28: Read voltages

152
We will now read the voltages across various points in our circuit. Let's start by measuring the voltage between
the two sides of the resistor.

Voltage measurement across the ends of a resistor:


> From the components panel, place a 1.5V Battery on the workplane. 1
> From the inspector panel of the 1.5V Battery, set the Count to 2
batteries to supply the circuit with 3V. 2
> From the components panel, place a Multimeter on the workplane 3
and rotate it. 4
> From the components panel, place a Resistor on the workplane. 5
> From the inspector panel of the resistor, set the Resistance to 47Ω. 6
> From the components panel, place an LED on the workplane. 7
> Wire up the circuit. 8
> Click Start Simulation. 9

153
2

154
6

155
9

Figure 4.29: Voltage measurement across the ends of a resistor

156
Voltage measurement across the anode and cathode of an LED:
> Select the wiring of the multimeter by using Shift and click, 1 and
click Delete. 2
> Click on the Multimeter to select it, 3 and click Rotate six times. 4
> Move the Multimeter by dragging and dropping. 5
> Wire the Multimeter across the anode and the cathode of the LED. 6

> Click Start Simulation. 7

2
1

157
4

158
7

Figure 4.30: Voltage measurement across the anode and cathode of an LED

159
Voltage measurement across the two terminals of a battery:
> Select the wiring of the multimeter by using Shift and click, 1
and click Delete. 2
> Click on the Multimeter to select it, 3 and click Rotate three
times. 4
> Move the Multimeter by dragging and dropping. 5
> Wire the Multimeter across the two terminals of the Battery. 6

> Click Start Simulation. 7

160
4

161
7

Figure 4.31: Voltage measurement across the two terminals of a battery

162
Finally, we will use the multimeter as an ammeter to measure the total current of the circuit (I). Note that voltmeters
and ohmmeters are connected in parallel with the component being measured. Ammeters, on the other hand,
must be connected in series.

To measure the current:


> Select the wiring of the multimeter and the wire from the cathode of the LED to the
negative pole of the battery by using Shift and click, 1 and click Delete. 2
> Click on the Multimeter, 3 and from the inspector panel change its Mode to Amperage. 4

> Wire the multimeter to measure the total current. 5


> Click Start Simulation. 6

163
3
4

Figure 4.32: Measure the current

164
Exercises
1

Read the sentences and tick True or False. True False

1. Pushbuttons are ordinarily used in calculators, kitchen appliances,


magnetic locks, etc.

2. Using circuit simulation, we can test the functionality of a circuit


without actually building the circuit.

3. In Tinkercad Circuits, you can modify a circuit without stopping the


simulation.

4. After simulating a circuit, you can create it on a printed circuit board.

5. Resistors are used in heaters, toasters, kettles, electric stoves, and


many more heating appliances.

6. Multimeters cannot be used to measure electrical quantities such as


frequency, charge, etc.

7. Voltmeters and ohmmeters are connected in series with the


component being measured.

8. Annotation is like sticky notes for your circuit.

9. The Tinkercad Circuits multimeter has the option of measuring current


in Volts.

10. The main benefit of using a real breadboard is that if the components
are placed incorrectly then they can simply be moved to another
location on the breadboard.

165
2 Tinkercad Circuits has different options for the wires you can use to connect the
components of your circuit. One of them is the wire below that is common for
prototyping:

What is the name of this wire type? Can you identify components that can be
connected with this type of wire? What are the benefits of using it?

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

166
3 This circuit has a problem. Diagnose the problem and apply a fix. Justify the change
you made to the circuit.

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________

4 Explain the meaning of the green markings on the breadboard below.

__________________________________________________________

__________________________________________________________

__________________________________________________________

__________________________________________________________

__________________________________________________________

__________________________________________________________

__________________________________________________________

167
5 Design the circuit of Exercise 3 in Tinkercad Circuits using different types of batteries.
Tinkercad Circuits mainly provides 3 types of batteries: 9V, 3V and 1.5V. Connect
your circuit up as shown and note your observations after you simulate it.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

168
6 Build a circuit with four AA 1.5V batteries, an LED and a 500Ω resistor. Run the
simulation and observe the amount of light emitted. Can you predict what will
happen if you gradually reduce the number of batteries? Run the simulation with
fewer batteries and assess your prediction. Explain what is happening and why.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

7 Build and simulate the following circuits with Tinkercad Circuits. Test the electronic
circuits and fix any issues you may observe.

169
Project

In this project, you will learn how your circuit behaves under new conditions
such as different battery type or resistance value.

1
You have learned that the two fundamental types of circuits are series and parallel circuits. Let
us implement the following parallel circuit.
You will need:
1 x Amperage Multimeter
4 x 120Ω Resistors
4 x Red LEDs
1 x Coin Cell 3V Battery

2
Color the wires appropriately to distinguish negative from positive.

3
Build the circuit by adding one resistor and one LED at a time. Start with this circuit:

4
Run the simulation and measure the current using the
multimeter. Write down the measurement.
Add another resistor and another LED and note down
the new current measurement. Repeat for the
remaining resistors and LEDs.
Observe the pattern in your measurements. Explain
what is happening.
Add resistors and LEDs, change the battery type or
the resistance value of each resistor. How does your
circuit behave under the new conditions?

170
Wrap up

Now you have learned:


> how to design electronic circuits in Autodesk Tinkercad Circuits.
> how to add, edit and wire electronic components.
> how to simulate electronic circuits and take measurements.
> how to test and troubleshoot electronic circuits.

KEY TERMS

Ammeter LED Resistor

Breadboard Multimeter Schematic View

Circuit Ohmmeter Voltmeter

Circuit View Power Source Workplane

Component List Prototyping

Current Pushbutton

171
5. Simulating a
microcontroller-
based system
In this unit, students will learn about microcontrollers and other electronic
components. More specifically, students will learn how to program a micro:bit
microcontroller with Python in Tinkercad Circuits to create simple and complex
circuits with various sensors and actuators.

Learning Objectives
In this unit, you will learn to:
> Design circuits using a microcontroller.
> Recognize external components used in microcontroller circuits.
> Describe how different components affect circuit logic.
> Program a micro:bit microcontroller with Python.
> Use the micro:bit temperature and light sensors.
> Design microcontroller circuits for real-life scenarios.
> Demonstrate how a potentiometer regulates voltage in
an electronic circuit.
> Describe the use of a transistor.
> Use a transistor as an amplifier in an electronic circuit.
> Use a DC motor as an actuator for movement.

Tools
> Autodesk Tinkercad Circuits

172
Lesson 1

Programming a Microcontroller

Microcontrollers
In the modern world, computers are a common part of many people's
lives. Most of us are familiar with computers that use a mouse and
keyboard for user input and a monitor for output, however, another
type of computer, the microcontroller, usually operates without
human interaction. A typical computer could be used to run multiple
programs simultaneously, such as playing video games and getting
email, but the microcontroller can only run one program at a time.
Essentially, a microcontroller is a specialized computer with mostly
nonhuman input and output devices for interaction with the outside
world. Other names for this type of computer are single-board
microcontrollers or embedded systems. In all cases, it integrates a
processor, memory and some kind of input and output.

Rather than having a mouse, keyboard, and monitor as


peripherals, the microcontroller uses devices called
sensors as inputs and actuators as outputs. A sensor
examines the environment and senses specific stimuli,
such as touch, sound, temperature,humidity and light
almost in the same way as human senses detect stimuli
from the surrounding world. These sensors respond to
stimuli by generating a change in voltage or a digital signal.
Our body works in a similar way, with our human sense
organs that transmit signals to our brain through the
nervous system.
Figure 5.1: Microcontroller board

The Microcontroller is almost like a tiny computer


brain. But this tiny brain gets stimuli from its sensors
as input to a program running in a continuous loop.
The program can react and change outputs
accordingly. For example, if the temperature is
Fire Sensor Alarm extreme in a building, a microcontroller that checks
Figure 5.2: Fire alarm system for fire conditions can trigger an alarm.

INFORMATION
The job of a microcontroller might be to run the air-conditioning
system in a building, monitor and control the operation of an
engine in a car, or run machinery on an automated assembly line.

173
Although microcontrollers can mimic some human functions, do
not mistake their operation with true intelligence. We might call
a device “smart” or “intelligent,” but all of them operate in a
predefined way, following a very specific procedure based on
their programming. It does not matter how elaborate the device
or how good the program is that runs on the machine. Computers
and microcontrollers as hardware cannot truly be considered
intelligent.

The Raspberry Pi is considered by


some to be a microcontroller, like
the Arduino. In reality, the
Raspberry Pi is a tiny computer
that can connect directly to a
monitor and input devices such
as a keyboard and mouse. At the
same time, a full operating
system can be loaded via a
MicroSD memory card.
Micro:bit Arduino UNO
Figure 5.3: Popular microcontrollers

There are various microcontrollers around us, such as in autonomous IoT devices or
inside other electronic equipment and machinery. The most popular microcontrollers
for prototyping are the Arduino and micro:bit boards. Both can be simulated in Tinkercad
Circuits, but there are some important differences.
An Arduino microcontroller, such as Arduino Uno R3, is more powerful in terms of
programming, but the micro:bit board has an integrated display and sensors for
temperature, light, motion, sound and orientation.

Microcontrollers

Advantages Disadvantages
• They consume small amounts • In general, they cannot
of electricity and do not handle multitask operations.
produce much heat. • New programs need to be
• Because of their size they can inserted manually.
be placed in smaller circuits. • They have limited processing
• They are adept at single task power.
operations. • They generally have no
• They exist with a wide range operating system.
of memory, from 4-bit to 128-
bit microprocessors.

174
External Components for Microcontroller Circuits
DC motor
Direct Current (DC) motors are electronically controlled devices that generate
rotary movement from electrical power. They include a shaft that rotates so that
wheels and gears can be attached to them to provide a wide range of motion.
DC motors are produced in a wide variety of forms, and they operate in a range
from 1.5V to 24V and up to 8000 RPM (Rotations Per Minute). They can be used
used for applications that require high RPM.

DC motor Simulator component Schematic symbol


Figure 5.4: DC motor

Piezo buzzer
Piezoelectric buzzers are small devices that can generate sound signals. They
contain small crystals like quartz and topaz that exhibit the piezoelectric effect.
When electrical currents pass through these crystals, they expand and contract
repeatedly causing them to vibrate. These rapid vibrations are the source of the
sounds generated by these buzzers.

Piezo buzzer Simulator component Schematic symbol


Figure 5.5: Piezo buzzer

PIR sensors
Passive Infrared (PIR) sensors are electronic sensors that can detect objects in
a specific Field Of View (FOV). They work by measuring the infrared radiation
signals that are present in the FOV that they examine. When an object passes
through the FOV, the distribution of those signals changes and the sensor detects
that an object is present. They are used for monitoring applications such as
security alarms and room lighting controls.

PIR sensor Simulator component Schematic symbol


Figure 5.6: PIR sensor

175
Potentiometer (Variable Resistor)
Potentiometers are small devices that are used to manually adjust the voltage
that is applied to a specific part of a circuit. They utilize Ohm's law which we
learned about in a previous lesson. Ohm's law states that V = I × R. For constant
current, if you want to change the voltage, you need to adjust the resistance.
Potentiometers allow you to modulate the voltage to the desired value by
manually adjusting the resistance.

Potentiometer Simulator component Schematic symbol

Figure 5.7: Potentiometer

Servomotors
Servomotors are a special type of motor with two defining features. They operate
within a limited range of motion, and they provide position feedback so that
their controller is informed of the exact angle that the servomotor has turned.
Servomotors are used for actions that require high-precision motion like robotic
applications and manufacturing operations.

Servomotor Simulator component Schematic symbol

Figure 5.8: Servomotor

176
Micro:bit
The Micro:bit microcontroller in Tinkercad Circuits environment
With Tinkercad Circuits, you can simulate microcontroller circuits using a simple block-
based programming language or the Python programming language.
In this unit, you will utilize the micro:bit as a microcontroller in an environment that
allows for experimentation. In microcontroller projects there are two parts to every
project. The first is the circuit itself, which includes the sensors, the actuators and the
wiring that connects all components. The second is the code used to program the
microcontroller. This code manages the inputs from the sensors and sends instructions
to the actuators. In the Tinkercad simulator, Python for micro:bit is utilized.

Name of the
component "micro:bit"
Default
Name "1"

Default
Color "Red"

USB Micro:bit in
connection the workplane

25 LED lights

Button A
Button B

Edge connector
for accessories
Figure 5.9: Micro:bit
in Tinkercad Circuits

177
Python Programming
You have learned how to write code in Python in previous books/courses in this series.
The code used here will be similar. Let's see how Python is implemented for micro:bit
in the Tinkercad Circuits code editor.

Default Download Code editor


python code code

Select device

Font size

Python
Serial Monitor documentation

Figure 5.10: Tinkercad Circuits code editor

Let's take a look at some commands that we are going to use:

To pause after an action is completed, use Display a custom shape through


the following method which takes an the LED light matrix:
argument in milliseconds:
basic.show_leds("""
basic.pause(1000) Pause for 1 second.
..#..
.###.
The following code will begin when you press
the Start Simulation button and stop when #####
you press the End Simulation button. .....
.....
def on_forever():
""")
# Your circuit logic here
basic.forever(on_forever)
The LED lights matrix will
turn on at the locations
The code that will replace the where the '#' symbols are.
comment will run without stopping.

178
LED light matrix
Let's see how you can use the things that you have learned.
You will create a program to show two icons, '0' then '1' ,alternating
every second on the LED light matrix and repeating forever.
First you need to find micro:bit in the components library and
drag it to the workplane.

Add micro:bit:

> Find micro:bit in the components library 1 and drag


and drop it into the workplane. 2
> Click on the drop down menu 3 and choose Green. 4

Figure 5.11: Add micro:bit

179
Now, you need to open the code editor:

Open the code editor:

> Click on Blocks drop down menu. 1

> Select Text from the drop down menu. 2

> Click Continue 3 to open text editor. 4

If you haven't chosen a


microcontroller yet, the
code tab will show you the
message "No programmable
components in this circuit".

Figure 5.12: Open the code editor

180
Continue by writing the code in the code shown below editor and then start the simulation.

Writing code:

> Write the code in the text editor. 1

> Click Start Simulation button. 2

When you have


finished writing the
1 code, click on the Start
Simulation button to
begin the simulation.

Figure 5.13: Writing code

When the simulation is running on the LED light matrix,


you can see the following results:

181
micro:bit Sensors
Light sensitivity sensor
When you start the simulation, a window appears
in the workplane. This window lets you adjust the
properties of the simulation environment that
affect the micro:bit's sensors, more specifically,
the compass, the light sensitivity sensor, the
temperature sensor and the accelerometer.

Temperature sensor

Motion actions

Figure 5.14: Micro:bit sensor adjustments

Temperature indicators
In the plot_bar_graph() method, the second
To get inputs from integrated micro:bit argument is the maximum value that is represented
sensors, e.g. temperature and light level, by the plot. For example, in the Tinkercad simulator
you need the following methods: the maximum light level and temperature values
are 255 and 50 respectively.

def on_forever():
input.temperature() led.plot_bar_graph(input.temperature(), 50)
basic.forever(on_forever)

Input the current value of


the temperature sensor Temperature sensor maximum value 50 °C

def on_forever():
input.light_level() led.plot_bar_graph(input.light_level(), 255)
basic.forever(on_forever)

Input the current value of


the light sensitivity sensor Light sensitivity sensor maximum value 255

182
Let's first see an example of how you can use the temperature
sensor with the LED light matrix.

Example

Temperature at 21 °C Temperature at 40 °C Temperature at 50 °C

183
Now, let's see another example but this time you are going to use the light
sensitivity sensor with the LED light matrix.

Example

Light level at 34 Light level at 128 Light level at 255

184
Exercises

1 How do you use a microcontroller?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 What are the advantages of using microcontrollers?


____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

3 Match the items in the first row with those in the second.

Simulator
component

Name PIR sensor Servomotor Piezo buzzer Potentiometer DC motor

185
4 Create a program to show the three letters, " K ", " S "and " A " alternating every
second on the LED light matrix and repeated forever.

Change the program to make each letter flash twice quickly before it shows the next
letter. Add a pause with a blank matrix at the end of the loop.

5 Why do we use the value 50 as a maximum value for temperature when we use
led.plot_bar_graph?
What will happen if we use another value?

Run the simulator and explain what you observe.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

6 Create a program on the micro:bit that displays an UP arrow when the temperature
is above 21 degrees and a DOWN arrow when the temperature is lower than 21
degrees.
What else do you need to check?
Fix your program so it works properly in all temperature conditions.

186
Lesson 2

Circuit with Microcontroller


Building a Simple Traffic Light System
Microcontrollers like micro:bit can also be connected to a breadboard. This can
make it easier to design more complex circuits by allowing more components to
be interconnected.
We will begin this lesson by building a simple traffic light system with 3 LEDs and
3 resistors connected to a breadboard.
Each LED will emit light briefly for 300 millisecondsbefore the microcontroller
switches to the next LED. The LEDs are connected to the pins P0, P1 and P2 of
the micro:bit.
• P0 --> Red LED
• P1 --> Yellow LED
• P2 --> Green LED
The micro:bit will send a digital signal of 1 to each pin for 300 milliseconds. This
will allow electrical current to flow through the wires and the LEDs to emit light.
The circuit and the code are illustrated below.

Components that you will use in this project

INFORMATION
A resistor is used to limit the current through the LED
and to prevent excess current that can burn out the LED.

187
Let's start by adding the micro:bit to the workplane.

Add micro:bit:

> Find the micro:bit in the components library 1 and


drag and drop it into the workplane. 2
> Click on the drop down menu 3 and choose Green. 4

Figure 5.15: Add micro:bit

188
Now, you will add a breadboard to the workplane.

Add breadboard:

> Find the breadboard in the components library 1

and drag and drop it into the workplane. 2


> Click on the rotation button three times. 3

Figure 5.16: Add breadboard

189
Next, you will add three LEDs to the workplane and change
their colors to red, yellow and green. You will also add
three resistors of 1kΩ each to the workplane.

Add LEDs and resistors:

> Find the LED in the components library 1 and drag


and drop three of them into the workplane. 2
> Change the colors of the second LED from red to
yellow and the third LED from red to green. 3
> Find the resistor in the components library 4 and
drag and drop three of them into the workplane. 5 Don't forget, in Tinkercad when you
6 place a resistor in the workplane,
> Rotate the LEDs and resistors to be horizontal.
the default value is 1kΩ.

3
4 1

Figure 5.17: Add LEDs and resistors

190
Continue by connecting each resistor – LED light pair in series on the breadboard.

Connecting components on the breadboard:

> Drag 1 and connect the three LEDs and


resistors to the breadboard so that each wire
of the LEDs and resistors is in a hole. 2

Figure 5.18: Connecting components on the breadboard

191
Now you are going to use wires to connect the cathode
of each LED light to the ground pin of the micro:bit.

Wiring cathodes to the ground pin:

> Connect the micro:bit ground pin to the 3


negative column of the breadboard. 1
> Connect the three LED cathodes to the
negative column of the breadboard. 2
> Change all the wires to black to indicate
the negative connections. 3

2 2

Figure 5.19: Wiring cathodes to the ground pin

192
Finally you are going to connect the pins P0, P1 and P2 to each resistor – LED light pair.

Wiring pins:

> Connect micro:bit P0 to hole a2 of the breadboard. 1

> Connect micro:bit P1 to hole a5 of the breadboard. 2

> Connect micro:bit P2 to hole a8 of the breadboard. 3


Τo have a clear circuit with
well-organized wires, when
you have one point of a wire
attached to a component, you
can click on a point in the
workplane to bend the wire
there. Another way to bend a
wire is by double clicking the
wire at a specific point.

1 2 3

Figure 5.20: Wiring pins

193
Now that you have finished preparing the components you
are ready to start coding. Let's take a look at some of the
commands for micro:bit pins that you can use in Python:

To set which pin the micro:bit (P0, P1, or P2) sends pitch signals from:

pins.analog_set_pitch_pin(AnalogPin.P0)

To read a value from analog pin P0 use the following command:

pins.analog_read_pin(AnalogPin.P0)

To write a value to a pin, use the following commands. Here we write


the value from the analog pin P0 to the analog pin P2.

p0_value = pins.analog_read_pin(AnalogPin.P0)
pins.analog_write_pin(AnalogPin.P2, p0_value)

Analog pin values can be any number, while digital pin values must be
0 or 1.

pins.digital_write_pin(AnalogPin.P1, 0)
pins.digital_write_pin(AnalogPin.P1, 1)

194
Write the following code and start the simulation.

Figure 5.21: Test code

You will observe the three LED lights flashing alternately every 300 ms.

pins.digital_write_pin(DigitalPin.P0, 0)

pins.digital_write_pin(DigitalPin.P0, 1)

pins.digital_write_pin(DigitalPin.P1, 0)

pins.digital_write_pin(DigitalPin.P1, 1)

pins.digital_write_pin(DigitalPin.P2, 0)

pins.digital_write_pin(DigitalPin.P2, 1)

195
Building a Detection Alarm System
We will now build a circuit that uses a PIR sensor and a
piezo buzzer to create an alarm system. We will program
the analog pin P2 of the micro:bit to emit analog pitch
signals. The negative end of a piezo buzzer will be
connected to the micro:bit ground, and its positive end
will be connected to the analog pin P2 in order to receive
Figure 5.22: PIR sensor and a piezo buzzer
the pitch signals.
The PIR sensor will detect if an object has entered its FOV. Add micro:bit:
If there is an object present, it will send a digital signal of
1 to the micro:bit pin P0. The micro:bit will then display > Find micro:bit in the components
an exclamation mark and emit a pitch sound twice with library 1 and drag and drop it
an interval of 100 milliseconds. into the workplane. 2
The PIR sensor is connected to 3 wires, one for the ground, > Click on the drop down menu 3

one for the power, via the 3V pin of the micro:bit, and one and choose Green. 4
for the digital signal it sends to pin P0.
Let's create the circuit and write the code for our project.

Figure 5.23: Add the micro:bit

196
Add a piezo buzzer to the workplane.

Add piezo buzzer:

> Find the piezo buzzer in the components library 1


Connect the positive end of the piezo buzzer
and drag and drop into the workplane. 2 to pin P2 of the micro:bit.
> Rotate the piezo buzzer so the pins point This will be the analog pin that will send a
towards the micro:bit. 3 pitch signal to the piezo buzzer.

Wire the piezo buzzer:

> Connect the positive pin of the


piezo buzzer 1 to pin 2 of the
micro:bit. 2
> Connect the negative pin of the
piezo buzzer 3 to the ground
pin of the micro:bit. 4

1
2 2 4

3 1

Change wire to black


to indicate that it is
connected to ground.
3

Figure 5.24: Add a piezo buzzer Figure 5.25: Wire the piezo buzzer

197
Add a PIR Sensor to the workplane.

Add PIR Sensor:

> Find the PIR Sensor in the components library 1 and


drag and drop it into the workplane. 2
> Rotate the PIR Sensor so the pins point towards the
micro:bit. 3

Signal Power Ground

Figure 5.26: PIR Sensor

Figure 5.27: Add PIR Sensor


3

198
Connect the ground end of
the PIR Sensor to the GND pin
of the micro:bit.

Connect PIR:

> Connect the PIR


Sensor Ground pin 1
to the GND pin of the
micro:bit. 2 2
1

The default color of a


new wire is the color
that you used for your
previous wire.

Figure 5.28: Connect the Ground pin of the PIR Sensor

Connect the Power pin of the


PIR Sensor to the 3V power
source of the micro:bit.

Connect PIR:
2
> Connect the PIR
Sensor Power pin 1

to the 3V power
source of the
micro:bit. 2
> Change the color of
1 3
the wire to red. 3

Figure 5.29: Connect the Power pin of the PIR sensor

199
Connect the Signal pin of the PIR Sensor to pin P0 of the micro:bit. This
will be the digital pin that will send a signal of 1 when there is an object
detected in the PIR Sensor's FOV.

Connect PIR:

> Connect the PIR Sensor Signal pin 1 to pin 0 of the micro:bit. 2

> Change the color of the wire to green. 3

1 3

Figure 5.30: Connect the Signal pin of the PIR sensor

200
Now that you have finished with the connections,
you can add the following code and test it.

Figure 5.31: Test code

When you use the piezo buzzer in Piezo buzzer produces Display an
a project, make sure that the
a sound two times at a exclamation mark
volume on your computer is high
enough for you to hear the sound frequency of 500 hertz, when the PIR
that the piezo buzzer produces. every 100 milliseconds Sensor detects an
(0.1 seconds). object.

No object has entered the PIR Sensor FOV. An object has entered the PIR Sensor FOV.

Piezo buzzer doesn't Piezo buzzer


produce a sound. produces a sound.

Figure 5.32: No object in PIR sensor FOV Figure 5.33: Object in PIR sensor FOV

201
Exercises

1 Which component will you use to easily connect more electronic components?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 Can you identify the problem with 3 Why do we use the resistors in the
these connections? What do you following electronic circuit?
need to do to correct it?

__________________________________________ __________________________________________

__________________________________________ __________________________________________

__________________________________________ __________________________________________

__________________________________________ __________________________________________

202
4 In the traffic light circuit in the lesson we do not use the 3V pin of the micro:bit
board. How do we power each LED?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

5 What is the main difference between a distance sensor and a PIR sensor? Search on
the Internet for applications of each electronic component.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

6 How many electronic components can you connect to the ground pin of the micro:bit
board?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

7 In all micro:bit projects, you define a function named on_forever. Explain how you
use it and why it is required.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

203
8 Examine the following circuit and its code carefully and find the problem.
What do you need to do to fix it?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

204
Lesson 3

Real Life Applications


There are two different types of potentiometers, the rotary potentiometer
and the linear potentiometer.
The rotary potentiometer is the one we have looked at and is the component
available in Tinkercad Circuits.
The linear potentiometer works with a sliding contact that can be moved
along a path connected through the resistor.

How a Potentiometer Varies the Voltage


A potentiometer is a type of passive electronic device. Potentiometers
operate by moving a sliding contact across a uniform resistance. The
input voltage is applied across the entire length of the resistor in a
potentiometer, and the output voltage is the voltage drop between
the fixed and sliding contacts, which changes with the position of the
sliding contact.
The first project you will create in this lesson uses a potentiometer
to regulate voltage. For this project you will use a micro:bit and the
following components:
Figure 5.34: Linear potentiometer
• 1 Potentiometer
• 1 LED
• 1 1.5V Battery

Components that you will use in this project

205
Let's go and find the components that you will need
for this project. Place a micro:bit, an LED light, a 1.5V
battery and a potentiometer in the workplane.

Add components:

> Find the micro:bit in the components library, drag and drop it
into the workplane and change its color to green. 1
> Find a 1.5 V Battery in the components library and drag and
drop it into the workplane. 2
> Find the LED in the components library, drag and drop it into Wiper
the workplane and rotate it so the pins point at the micro:bit. 3

> Find a Potentiometer in the components library, 4 drag Terminal 1 Terminal 2


and drop it into the workplane and rotate it so the pins point
towards the micro:bit. 5 Figure 5.35: The terminals on a
potentiometer

3
5

Figure 5.36: Add components

206
Next, you will connect the pins of the potentiometer with the pins of
the micro:bit. More specifically, you are going to connect:
> the potentiometer Terminal 2 to the micro:bit GND.
> the potentiometer Wiper to the P0 pin of the micro:bit.
> the potentiometer Terminal 1 to the 3V power source of the micro:bit.

Connect the potentiometer to the micro:bit:

> Connect the Potentiometer Terminal 2 to the micro:bit


GND and change its color to black. 1
> Connect the Potentiometer Wiper to the micro:bit P0
pin and change its color to green. 2
> Connect the Potentiometer Terminal 1 to the micro:bit
3V power source and change its color to red. 3

Don't forget to bend the


wires to have a neat
circuit that is easy to read.

1 3

Figure 5.37: Connect the potentiometer to the micro:bit

207
Now, you will make the connections for the 1.5V battery and the LED.

1.5V battery and LED connections:

> Connect the 1.5V Battery negative pin to the


micro:bit GND and change its color to black. 1
> Connect the 1.5V Battery positive pin to the cathode
of the LED light and change its color to red. 2
> Connect the anode of the LED light to the micro:bit
P2 pin and change its color to green. 3

1
3

Figure 5.38: 1.5V Battery and LED connections

208
Write the code to program the microcontroller and start the simulation.

Figure 5.39: Test code

Notice how the LED changes its brightness according to the voltage applied by the potentiometer.

High resistance LED brightness low Low resistance LED brightness high

209
A Basic Transistor Circuit
Transistors are required for digital circuits to function. Transistors are electronic
components that are used in circuits to amplify or switch electrical signals or power,
making them useful in a wide range of electronic devices.
The NPN transistor has three terminals, Collector, Base and Emitter. In Tinkercad
Circuits the base is called "Terminal 1". A large current can flow from Collector to
Emitter, with a small current entering the Base. In this case, it acts like a current
controlled switch. NPN circuits are used in digital logic circuits as extremely fast
switches.
In a later project you will design a circuit that combines a transistor, a potentiometer
and a DC motor, but first you will implement a simple circuit to illustrate the basic
connections of the NPN transistor. For this project you will use the following
components:
• 1 BJT-NPN Type Transistor
• 1 Pushbutton
• 1 LED
• 1 1.5V Battery
• 2 Resistors

Components that you will use in this project

210
First, you will add a 1.5V Battery and a Pushbutton to the workplane and
connect the positive pin of the 1.5V Battery with Terminal 1b of the Pushbutton.

Add and connect the 1.5V Battery and Pushbutton: Terminal 1b Terminal 2b
> Find the 1.5V Battery in the components library
and drag and drop it into the workplane. 1
> Find the Pushbutton in the components library 2

and drag and drop it into the workplane. 3


> Connect the positive pin to Terminal 1b of the
Pushbutton and change its color to red. 4 Terminal 1a Terminal 2a

Figure 5.40: Pushbutton terminals

4 3

Figure 5.41: Add and connect the 1.5V Battery and Pushbutton

211
Then, you will add an LED to the workplane
and connect its anode to Terminal 2b of the
Pushbutton.

Add the LED and make the connections:

> Find the LED in the components library Continue by adding a resistor to the workplane.
and drag and drop it into the workplane. 1

Add the first resistor and make the connections:


> Connect the anode of the LED to Terminal
2b of the Pushbutton. 2 > Find the Resistor in the components library, drag
and drop it into the workplane and rotate it so the
pins point horizontally. 1
> Connect the cathode of the LED to one leg of the
Resistor and change its color to green. 2
2
1

2 1

Figure 5.42: Add the LED and make the connections

The resistors are used to


reduce the current flowing
through the circuit.

Figure 5.43: Add the first resistor and make the connections

212
Now, you will add the transistor to the workplane and
connect it with the second leg of the resistor.

Add the transistor and make the connections:

> Find the NPN Transistor in the components


library 1 and drag and drop it into the
workplane. 2
> Connect the Collector of the NPN Transistor
to the second leg of the Resistor. 3
Collector Terminal 1 Emitter

Figure 5.44: Transistor terminals

Figure 5.45: Add the transistor and make the connections

213
Next, add the second resistor and connect Terminal 1 of the transistor to the
positive pin of the battery via the second resistor.
Finally, connect the emitter of the transistor to the negative pin of the battery.

Add the second resistor and make the connections:

> Find the Resistor in the components library and drag and drop it into the
workplane. 1
> Connect Terminal 1 of the NPN Transistor to the second leg of the Resistor
and change its color to red. 2
> Connect the positive pin of the 1.5V Battery to the first leg of the Resistor. 3

> Connect the negative pin of the 1.5V Battery to the emitter of the NPN
Transistor and change its color to black. 4

3 1 2

Figure 5.46: Add the second resistor and make the connections

214
Start the simulation and when you press the Pushbutton, the LED will light up.

Figure 5.47: Start the simulation

Pushbutton LED off Pushbutton LED on


not pressed pressed

Figure 5.48: LED states

215
Build a DC Motor – Resistor Circuit
In this project, we will combine elements of the previous projects to connect a
potentiometer to a DC motor through a transistor and a resistor. We will also need a
battery to supply power to the DC motor. We can use the micro:bit code from our
earlier project because, as before, all we need to do is to write the input from the
potentiometer at analog pin P0 to analog pin P2.
You can experiment with making changes to the circuit, for example changing the
value of the resistor or switching the 2 AAA batteries connected to the circuit. Notice
also how different resistor values affect the RPMs generated by the DC motor. This
is the same circuit, but only the resistance values have changed from 100 kΩ to 200
kΩ.
For this project you will use a micro:bit and the following components:
• 1 Potentiometer
• 1 BJT-NPN Type Transistor
• 1 Resistor
• 2 1.5V Batteries
• 1 DC Motor
You can use a transistor in
a circuit that controls
components like motors
that require a higher
Components that you will use in this project voltage to operate.

216
Let's start by adding the components to the workplane.
Take a potentiometer from the components library and place it on the workplane.
Remember, that a potentiometer has three ends, Terminal 1, the Wiper and Terminal
2, which need to be connected to the micro:bit.

Add the potentiometer and make the connections:

> Find the micro:bit in the components library, drag and drop it
into the workplane and change its color to green. 1
> Find the Potentiometer in the components library, 2 drag
and drop it into the workplane and rotate it so the pins point
towards the micro:bit. 3
> Connect the Potentiometer Terminal 2 to the micro:bit GND
and change its color to black. 4
> Connect the Potentiometer Wiper to the micro:bit P0 pin and
change its color to green. 5
> Connect the Potentiometer Terminal 1 to the micro:bit 3V
power source and change its color to red. 6

1
2

5
6 4

Figure 5.49: Add the potentiometer and make the connections

217
Then you will place a battery on the workplane
and use the inspector panel to change it.

Create a two battery case:

> Find the 1.5V Battery in the


components library and drag and
drop it into the workplane. 1
> Use the Inspector panel. 2

> Change Count to 2 batteries. 3

> Change Type to AAA. 4

> Change Built-in Switch to yes. 5

Built-in switch

Figure 5.50: Create a two battery case

218
Place an NPN Transistor into the workplane.
The transistor will be used to transfer the amount of voltage that is applied by the
potentiometer and regulate it using the resistor.
The transistor has three ends. The collector will be connected to a battery power source,
Terminal 1 will be connected via the resistor to the micro:bit pin P2, which will take as
input the voltage applied by the potentiometer to the pin P0, and the emitter will
transfer the voltage to the DC motor.

Add the transistor and the resistor:

> Find the NPN Transistor in the components library, drag and drop it into the
workplane and rotate it so the pins point towards the micro:bit. 1
> Find the Resistor in the components library and drag and drop it into the
workpane to connect one leg of the resistor to Terminal 1 of the transistor. 2

> Connect the open end of the resistor to pin P2 of the micro:bit and change the
wire color to green. 3

2
1

Figure 5.51: Add the transistor and the resistor

219
Now, you will add a DC motor to the workplane and connect
Terminal 2 to the transistor emitter and Terminal 1 to the
micro:bit GND.

Add the DC motor and make the connections:

> Find the DC Motor in the components library, 1 drag


and drop it into the workplane and rotate it so the pins
point towards the transistor. 2
> Connect Terminal 1 of the DC Motor to the micro:bit
GND and change the wire color to black. 3
> Connect Terminal 2 of the DC Motor to the Emitter of Terminal 1 Terminal 2
the transistor and change the wire color to green. 4
Figure 5.52: The terminals of a DC motor

Figure 5.53: Add the DC motor and make the connections

220
Next, you will add the battery to the workplane, connect its negative pin to the
micro:bit ground and its the positive pin to the transistor collector pin.

Connect the battery:

> Connect the negative pin of the Battery case to micro:bit GND and
change the wire color to black. 1
> Connect the positive pin of the Battery case to the Collector pin of
the transistor and change the wire color to red. 2

Figure 5.54: Connect the battery

221
Finally, write the code below and start the simulation.

Figure 5.55: Test code

Notice how the DC Motor rotates when the voltage applied is adjusted by the potentiometer.

Figure 5.56: Adjusting voltage with the potentiometer

222
Exercises

1 What is a linear potentiometer? What is the main difference between a linear and
a rotary potentiometer?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

2 Find the most common example of a device with linear potentiometers. Why do you
think we use this type of potentiometer for this device?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

223
3 Examine the following circuit and its code carefully and find the problem.
What do you need to do to fix it?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

224
4 In the previous circuit, why do we use the functions pins.analog_write_pin
and pins.analog_read_pin instead of pins.digital_write_pin and
pins.digital_read_pin?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

5 How are NPN transistors used in an electronic circuit? Describe how the NPN transistor
works.

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

225
6 In the last project of the lesson, change the resistor value to 100kΩ and then to
200kΩ. How does this change affect the DC Motor?

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

____________________________________________________________________________________________

226
Project

Microcontrollers are used to implement autonomous electronic


systems. An example is a fire alarm system that detects a fire
and emits an alarm signal for evacuation.

Design and implement an electronic circuit with a microcontroller


such as micro:bit, that can be used as a fire alarm system. Write the
code required for the microcontroller to activate the alarm under
specific conditions such as a temperature increase.

In addition to indicating with an alarm sound, indicate


the danger of fire with a visual signal. Use appropriate
symbols or text for hearing impaired people.

Extend your design to check for unsual light intensity levels in the environment. High
temperatures and extreme brightness are indicators of a fire inside a building.

Simulate and troubleshoot your circuit design with Tinkercad


Circuits. Are you using the minimum electronic components
required? It is important to design electronic circuits with
the minimum number of components for simplicity, cost
efficiency and low power consumption.

227
Wrap up

Now you have learned:


> about external components used in a microcontroller circuit.
> how different components affect circuit logic.
> to program the micro:bit microcontroller with Python.
> to use temperature and light sensors in micro:bit.
> to design microcontroller circuits to implement in real-life scenarios.
> how a potentiometer regulates voltage in an electronic circuit.
> to implement circuits with transistors.
> how to use a transistor to amplify voltage in an electronic circuit.
> how to use a DC motor as an actuator for movement.

KEY TERMS

DC motor Microcontroller Potentiometer

FOV (Field Of View) Piezo buzzer Servomotor

LED matrix PIR sensor

228
229
Python programming prerequisite
Programming is one of the most important skills that should be acquired by students enrolled in Computer Science
and Engineering pathway, as it is a requirement for a number of curricula in this pathway, including the Engineering
and Data Science curricula. To facilitate the student’s acquisition of Python programming basics, the following
content is designed to be accessible by scanning the QR code for each topic. The student is advised to make a
time plan to complete the reading of these units with the help of the suggested durations in the table below. The
student can also put a tick mark (✓) to mark the completion of each unit.

Did you
Suggested
Unit QR Code complete
duration
the unit?

1. Introduction to Python One day

2. Input-Output and Mathematical


One day
Operations

3. Conditional Statements Two days

230
Did you
Suggested
Unit QR Code complete
duration
the unit?

4. Loops and Functions Two days

5. Lists, Tuples and Python Libraries One week

6. Dictionary, Nested Lists and Data


One week
Files

7. Advanced Data Structures and


Two weeks
Recursion

8. Introduction to Object Oriented


Two weeks
Programming

231

You might also like