Engineering
Engineering
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
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
IEN.EDU.SA
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:
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.
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
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.
8
Lesson 1
Introduction to 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
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.
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.
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.
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.
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.
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.
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.
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.
■ 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.
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.
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
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.
19
Exercises
1
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.
20
2 Explain your understanding of the term "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
KEY TERMS
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
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.
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.
Switch
A switch (or circuit breaker) must
be used in each circuit to control
whether or not electricity flows
through the circuit.
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::
A lamp behaves
like a resistor.
Electrical
Components
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
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
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Ω
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
S X
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:
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
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
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
6Ω
First we note that resistors R3,R4 and R5 are connected in
series, so: R3,R4,R5= 4 + 8 + 6 = 18Ω
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)
From this,we find the total resistance: The current flowing through the source and R1 is:
38
Exercises
1. will double.
4. will quadruple.
39
3
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.
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
________________________________________________________________________________________
________________________________________________________________________________________
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.
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.
44
Design a Circuit
Let's see how we can use Multisim Live to create our first circuit.
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
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.
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
47
Next you are going to 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:
Node 1
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
50
You can also add probes to see voltage measurements.
> 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
51
5
2 3
52
Your circuit should now look like the image below..
53
Now we are ready to run the simulation and
see the measurements from the probes.
1
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
54
You can save your project to use it again later.
Save project:
> In the Save Circuit window, change the name to Ohm's law. 3
55
To check previous circuits that you have designed, you can go to My Circuits.
Open project:
2 3
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
57
Example 2: Parallel Connection
In a circuit with connections that are in parallel as shown in the example, we observe that:
Example
Example
58
Exercises
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:
Measuring
Value
instrument
Ammeter
Voltmeter
_______________________________________
_______________________________________
_______________________________________
_______________________________________
_______________________________________
_______________________________________
_______________________________________
_______________________________________
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
62
Do the following:
63
Wrap up
KEY TERMS
AC Electron Resistor
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
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
Α⋅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
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
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 OR
An OR gate has two inputs which both generate the
output.
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
Example
A AND B
The lamp will glow only when both the
series connected switches are closed.
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
0 1 1
1 0 1
Input Output
1 1 0
72
Logic Gate NOR
A NOR gate inverts the result produced
by an OR gate. Input Output
0 1 0
1 0 0
Input Output
1 1 0
0 1 0
1 0 0
Input Output
1 1 1
Τable 3.3 shows the logical operations and expressions for each logic gate.
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
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
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
75
Exercises
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
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.
____________________________________________________________________________________________
____________________________________________________________________________________________
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
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.
Karnaugh maps are used to group Boolean expressions instead of going through the
Boolean Algebra calculations for multiple variable inputs.
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.
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:
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
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
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
Let's see where the aces (1) will be placed in the Karnaugh map for the following function:
ΑΒ
C 00 01 11 10
Α⋅B⋅C Α⋅B⋅C
ΑΒ
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
Y=A⋅D+A⋅B⋅C Y=B⋅C⋅D
84
Exercises
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
2 Use the following numbered positions of the output Y to complete the Karnaugh
map below.
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
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.
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
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).
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
91
Logic Gates on Multisim Live
NOT
AND
OR
XOR
NAND
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".
> Drag 2 and drop a Digital Constant into the work space. 3
1 2
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".
> Drag 2 and drop a Digital Constant into the work space. 3
1 2
94
Now, let's add your first logic gate.
> Drag 3 and drop 2-Input AND into the work space. 4
1
2
95
Continue by connecting the AND gate with switches "A" and "B".
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
97
Then you will connect the AND gate with LED1.
Connections:
Add a probe:
2
1
98
Then you will add a ground to your digital circuit.
Add ground:
2
1
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.
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.
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
Example
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?
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
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:
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:
After you have built the circuit, write the truth table and
the Karnaugh map, and see if it can be simplified.
105
Wrap up
KEY TERMS
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
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.
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.
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.
4 2
111
6
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.
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:
Ultrasonic Distance
Slideswitch DC Motor
Sensor
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
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.
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.
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.
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
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
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
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.
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
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.
126
Simulations allow us to experiment with circuit development. In this case, we will edit the power source to test
the circuit.
SMART TIP
You can activate the commands Start Simulation and
Stop Simulation with the S key on your keyboard.
127
4
128
8
129
Exercises
2. You can build and simulate an electrical circuit with Tinkercad Circuits.
4. Resistors, power sources and LEDs are the only components you can
use in Tinkercad Circuits.
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.
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
132
Lesson 2
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.
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.
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:
134
To add a pushbutton to the circuit:
> On the components panel, click Pushbutton. 1
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
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.
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.
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.
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.
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
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.
3
1
143
5
4
7
6
144
8
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.
146
3
5
4
6
7
147
8
148
Now, connect the components of the circuit and start the simulation.
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
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.
153
2
154
6
155
9
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
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
160
4
161
7
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.
163
3
4
164
Exercises
1
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.
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
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
KEY TERMS
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.
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.
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.
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.
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.
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.
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.
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.
Select device
Font size
Python
Serial Monitor documentation
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:
179
Now, you need to open the code editor:
180
Continue by writing the code in the code shown below editor and then start the simulation.
Writing code:
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
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)
def on_forever():
input.light_level() led.plot_bar_graph(input.light_level(), 255)
basic.forever(on_forever)
182
Let's first see an example of how you can use the temperature
sensor with the LED light matrix.
Example
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
184
Exercises
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
3 Match the items in the first row with those in the second.
Simulator
component
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?
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
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
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:
188
Now, you will add a breadboard to the workplane.
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.
3
4 1
190
Continue by connecting each resistor – LED light pair in series 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.
2 2
192
Finally you are going to connect the pins P0, P1 and P2 to each resistor – LED light pair.
Wiring pins:
1 2 3
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)
pins.analog_read_pin(AnalogPin.P0)
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.
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.
196
Add a piezo buzzer to the workplane.
1
2 2 4
3 1
Figure 5.24: Add a piezo buzzer Figure 5.25: Wire the piezo buzzer
197
Add a PIR Sensor to the workplane.
198
Connect the ground end of
the PIR Sensor to the GND pin
of the micro:bit.
Connect PIR:
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
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
1 3
200
Now that you have finished with the connections,
you can add the following code and test it.
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.
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
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
3
5
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.
1 3
207
Now, you will make the connections for the 1.5V battery and the LED.
1
3
208
Write the code to program the microcontroller and start the simulation.
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
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
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.
> Find the LED in the components library Continue by adding a resistor to the workplane.
and drag and drop it into the workplane. 1
2 1
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.
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.
> 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.
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.
> 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
217
Then you will place a battery on the workplane
and use the inspector panel to change it.
Built-in switch
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.
> 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
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.
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 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
221
Finally, write the code below and start the simulation.
Notice how the DC Motor rotates when the voltage applied is adjusted by 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
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.
227
Wrap up
KEY TERMS
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?
230
Did you
Suggested
Unit QR Code complete
duration
the unit?
231