The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by feigenbaumel, 2022-09-02 10:24:31

Priinciples of Engineering 2022

Textbook for 9th grade STEM class

Principles of Engineering

Lab: Section 1 - Debugging

1. What is the difference between a structural error and a syntax error?

________________________________________________________________________

2. Below is a Blink code designed to blink an LED plugged into pin 13. There are multiple
errors in the code. Find the errors and correct them.

/* A Blink code with 5 errors */
/ the setup function runs once when you press reset or
//power the board

void setup(
{

// initialize digital pin 13 as an output.
pinMode(thirteen, OUTPUT);
}

void loop() // the loop function runs repeatedly forever

{

digitalwrite(13, on) // puts 5v out of the pin
Delay(1000); // wait for a second

digitalWrite(13, LOW); // turn the pin off

} delay(100O); // wait for a second

3. Below is a Blink code designed to make a light in pin 13 blink on and off for 1 second,

followed by a light in pin 12 on and off for two seconds. Find the errors and correct them.

void setup(
{

pinMode(13, INPUT);
}
Void setup()
{

PinMode(12, OUTPUT);
}

void loop(13)
{

digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
void loop();
{
digitalWrite(12, HIGH)
delay(2);
digitalWrite(12, 13, LOW);
delay(2000);
}

CIJE | Unit 8: Arduino Coding Tools 101

Principles of Engineering

Section 2: Global Variables - A Better Way

If we were to change our LED in the previous examples from pin 13 to pin 11, it would take a lot
of work to change all the 13's to 11's. There is a way to cut down all of this work—to introduce
variables to represent the pin numbers.
Variables are an essential part of computer programming. You will never advance beyond the
most rudimentary programs without variables. To introduce variables, we will go back to the
basic Blink program where the code has been modified to use a variable.

Before we go into the details of how we use the variable, let's keep in mind the final result. In
previous sections, we put 13 directly into the digitalWrite() command. Here we have replaced 13
with a variable called ledPin. Everywhere the program sees ledPin, it will replace ledPin with the
number 13.
To see why this is useful, let's switch an external LED from pin 13 to pin 9. Before we used a
variable, we would have to change 13 to 9 in three separate places (in pinMode() and the two
digitalWrite() commands). If we use a variable all we have to do is change the first line after the
comments to: int ledPin = 9;
It isn't hard to see that using variables becomes even more important as we write more complex
code. In modern software, it is not unusual to have hundreds of thousands to millions of lines of
code. Imagine if we had to scroll through every line of code just to change a number!
Now, let's go back and look more in detail at how we use variables. The most obvious first
question is what is a variable? For our purposes, we can think of a variable as a container. We
give our container a name, the variable name. Inside the container, we will put a value. Just like

102 Unit 8: Arduino Coding Tools | CIJE

Principles of Engineering

any container in our daily life has properties (e.g. it is made out of plastic, etc.), so too do variable
containers. Right now, the only properties we are concerned with are the size and type of the
variable container.
Any time we want to use a variable, the first thing we must do is declare the variable. In the
modified blink code, we declare the variable ledPin with the following line of code,

int ledPin = 13; //declares a variable named ledPin and sets it to 13

We place variables that we are going to use in the global variables section. Remember that this
is one of the three main sections in an Arduino program and is located above the setup() function.
We will learn later that there are other places we can declare variables, but if we declare our
variables in the global variables section, we are guaranteed they will work throughout the life of
our program.

Parts of a Variable Declaration

Let's look at the three separate parts of the variable declaration,

The first thing you must specify in a declaration is the data type or type for short. This tells the
computer what kind of thing you are going to put inside your container. Here we want a container
for an integer, so we use the int keyword. Remember that an integer is a whole number which
includes (0,1,2,3,...) and their negatives (-1,-2,-3,...).
Of course, there are other data types. For instance, a variable containing a decimal number like
3.14 would not be an int . However, for the next several sections we only need to use int . We
will introduce other useful data types later on. For now, all the variables that you will declare will
be int’s.

After the data type, we have to give our integer container a name. Just like a parent with three
children gives each child a different name, we too must give our variables unique names so that
the computer can know which variable we want to use. When we declare a variable, there are
limitations on what we can use for a name. These fall under two categories, requirements and
conventions. Requirements must be followed or the program will not compile. Conventions are
rules of courtesy and regularity that programmers follow in order to make their code more
readable by others. Let's use a real-world example. In the USA, it is a requirement that a car is
driven on the right-hand side of the road. The entire highway system would break down if
people randomly drove on whatever side they chose to. It is a convention that a car on the
highway should not drive slowly in the outside (left-most) lane. It is an expectation that the
outside lane is for faster moving traffic. The highway system doesn't break down if this rule isn't
followed, but it does make the system less efficient.

CIJE | Unit 8: Arduino Coding Tools 103

Principles of Engineering

The REQUIREMENTS for naming a variable are:

1. It must NOT contain any symbols or punctuation(!,#, ?, /, \, [ ,@, etc.). The
underscore ( _ ) is an exception.

2. It must NOT begin with a number.
3. Alphanumeric characters, including capital letters, are OK.

Some CONVENTIONS for naming a variable are:

1. The first letter of a variable should NOT be capitalized. Objects that begin with
capital letters are reserved for another type of programming structure.

2. It should NOT begin with an underscore or double underscore. This again is
reserved for a special situation in programming.

3. To improve readability, a variable with multiple words should either have the
beginning of the words capitalized (other than the first word - see Convention
1) OR have the words separated by an underscore. Here are some examples:

ledPin or led_pin
motorPin1 or motor_pin_1
timeLeftToFinish or time_left_to_finish

4. Most importantly, a variable name should clearly identify what it is for. In the
Blink program, for example, we could have declared the variable as,

int digitalPin13 = 13;

This is a perfectly legal variable name, but it doesn't help to identify what it
does, and therefore makes the code harder to read.

These conventions are widely used, but are by no means universal. Different fields will typically
have unique conventions and often the conventions that you use in your code will often be set
by the company or client that you are working for.

Finally, we put a value in the container. The equal sign (=) is called the assignment operator. It
puts a value in a container, that is, it assigns the value to the container. You will save yourself
many headaches while learning programming if you read the above line in your head as,

"13 is assigned to ledPin " NOT "ledPin is equal to 13".
This distinction will become clearer when we talk about how to make the computer choose
between options (e.g., do I turn left or right?).

104 Unit 8: Arduino Coding Tools | CIJE

Principles of Engineering

One final note: we do not have to assign a value to the variable when we declare it. However,
unless there is a good reason not to (and sometimes there is), all variables should be initialized,
i.e., have a value assigned to them, even if it is zero.
The following drawing summarizes how a variable declaration works,

Using Variables
We only declare a variable once!
Once you have declared a variable, you can now use it by simply writing the name of the variable.
Everywhere the computer sees the name of the variable, it will replace the name with the
contents of the variable.
Let's look again at the modified Blink program above. After we declared the variable ledPin and
assigned the integer 13 to it, we can write the command to turn on the LED using the variable
name.
What we wrote:

digitalWrite(ledPin,HIGH);

What the computer sees:

digitalWrite(13,HIGH);

If we changed the declaration of ledPin to:

int ledPin = 9;

Then the computer would see:

digitalWrite(9,HIGH);

Important:
Always keep in mind that spelling and capitalization matter. We declared our variable as
ledPin. If we wrote ledpin or ledPIn, the computer would have no idea what we were
talking about. This is a very common error.
Watch out especially for subtle mistakes like typing the letter I in place of the number
one (1) as many fonts don't distinguish them visually, including the Arduino default font.
The same goes for the letter O and the number zero.

CIJE | Unit 8: Arduino Coding Tools 105

Principles of Engineering

Lab: Section 2 - Global Variables

1. Circle the variable names that satisfy the requirements for naming. If it does satisfy the
requirements, put an additional box around it if it meets the conventions laid out above:
NOTE: see page 98 for a list of variable naming requirements

a. #hashTag h. LEDPIN
b. #hashtag i. LEDPin
c. h@sh_Tag j. lED_Pin
d. hashTag k. lED Pin
e. hash Tag l. 1Ledpin
f. 1HashTAG m. Ledpin1
g. hashTAG1 n. ledPin[1]

Use the following code to answer questions 2 - 5: int seven = 8;
2. Which digital pins should LED's be plugged into int eight = 9;
void setup()
to have the code turn them on? ___ & ___ {
3. Which of the following pins will NOT turn on an
pinMode(seven, OUTPUT);
LED? 7, 8, or 9? _____ pinMode(9, OUTPUT);
4. Instead of using the numerical number "9", you {
void loop()
can also write the word: "__________" {
digitalWrite(8, HIGH);
digitalWrite(eight, HIGH);
}

5. Why are the selected variable names poor choices? ______________________________

Alter the code to make it clearer.

6. Which two numbers are most often confused as letters in Arduino coding? ____ & ____

7. Correct the following code so that it will compile without any errors:

int 1hello = 1;
int hello2 = two;
void setup();
{

pinmode(!hello, OUTPUT);
pinMode(hello_two, OUTPUT);
{
void loop()
{
digitalWrite(Hello2, HIGH);
digitalWrite(Hello_one, HIGH);
}

106 Unit 8: Arduino Coding Tools | CIJE

Unit 9:
Advanced
Circuits

Principles of Engineering

Preface

In previous sections, atoms and the attraction between electrons and protons were covered,
in addition to how this force can be used in electronic devices and how it can be measured. In
this section, the breadboard will be used to develop circuits. The process of analyzing circuits
will also be closely studied as well as the utilization of equations and calculations in circuit
designs.

Unit Sections

➢ 1 - Breadboards
➢ 2 - Parallel and Series Circuit
➢ Worksheet: Series Circuits
➢ Lab: Advanced Circuits and the Potentiometer

Learning Objectives

After this unit students should be able to:
➢ Interpret and gather information from a breadboard
➢ Wire a breadboard with a simple circuit
➢ Build a series circuit and measure its behavior
➢ Identify the voltage drops across each component in a series circuit
➢ Be able to analyze and evaluate a series circuit in its completeness for each
component’s voltage, current and resistance

Safety Note

In this unit, you will conduct an experiment using a power source connected to an electrical
outlet. You should not tamper with the electrical outlets directly. Only the teacher should
connect and disconnect the devices to the outlets. In addition, make sure the power source
electrical cables are in good condition and are not frayed or exposed. Be sure to keep liquids
away from the devices.

108 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

Section 1 Breadboards

➢ Introduction

Breadboards are simple devices that allow us to connect wires without the use of alligator clips.
They allow us to connect multiple wires in a single point, or node, facilitating parallel and more
complex circuits. In a breadboard, any wires placed in a horizontal row in the center are
connected, and any wires placed in the same vertical row along the edges are connected.
Nothing is connected over the center ridge.

➢ How it works

Suppose we want to build the following circuit, to connect an LED, resistor and wires together

This is what the circuit would look like in real life

And this is what’s going on inside the breadboard

Note this circuit would
not illuminate the LED
as the current will flow
right past it as opposed
to through it

CIJE | Unit 9: Advanced Circuits 109

Principles of Engineering
➢ Breadboard Circuits

The two images below show two identical circuits constructed differently using a breadboard.
Both are correct.

➢ Examples

Below is an example of a complete circuit of a battery pack, resistor and LED, built using a
breadboard:

Note that the acceptable practice
is to place the + voltage into the
red vertical bar, and the – ground
into the blue vertical bar.
110 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

Below are additional examples of how a breadboard can be used to make a simple circuit

1 Components can be placed directly into the power bus bar,
helping to eliminate an extra jumper wire

2 While using multiple jumper wires is not an error, it can lead
to confusing and make it hard to troubleshoot projects

3 Short jumper wires can be custom cut from wire rolls to help
keep breadboards neat and orderly

4 The resistor for an LED can be on either the power or the
ground side of the LED

The rows being used to hold components do not need to be

5 the same rows being used in the power bus bar. They are

unrelated

6 The resistor for an LED can be anywhere along the circuit and
does not have to be directly connected to the LED

7 Rows on the left and right sides of the
board are not connected

CIJE | Unit 9: Advanced Circuits 111

Principles of Engineering

➢ Common Breadboard Errors A component with both legs in the same
row will cause a “local” short-circuit, with
1 electrons bypassing the component for
the path of least resistance

The longer leg of an LED must be on the

2 power side of the circuit, and not the

ground side

A circuit with no resistance is referred to

3 as a short circuit. The subsequent over

current will burn out an LED

A jumper wire across the legs of a

4 component will cause the electrons to
bypass it by giving them a path of least

resistance

A component with both legs in the same

5 row will cause a “local” short-circuit, with
electrons bypassing the component for

the path of least resistance

112 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

Section 2 Parallel and Series Circuit

A parallel circuit has two or more paths for current to flow through and is shown in the diagram
below on the right. Voltage is the same across each component of the parallel circuit. The sum of
the currents through each path is equal to the total current that flows from the source.

Series Parallel

In this course the series circuit will be the
circuit that is focused on. A series circuit is
when two components or electronic devices
are connected in series, it means that the
electrons that flow through one component
must also flow through the other using one
pathway. The diagram to the left shows a
series circuit on the left.

Series Parallel

The diagram below shows an example of a Now consider the example circuit below.
simple series circuit. The current flows from Current that comes from the positive terminal
the positive terminal of the battery through of the battery has two options, it can either
the red wire, to the anode, through the LED, flow up to the top circuit and through the
out the cathode, into the resistor, through yellow wire or down to the bottom circuit and
the resistor to the black wire, and back to the go through the blue wire. Hence the battery is
negative terminal of the battery. This is the not in series with the LEDs in the circuit as there
only pathway possible for the electrons as are two pathways.
there is no place in the circuit that is it
possible for electrons to deviate from the This is clear from the schematic shown on the
path. Looking at the schematic below, this right. Current from the positive terminal of the
becomes clear. The three components in battery has a choice to go through D1 or D2.
this circuit are all in series because current Clearly D1 is still in
series with R1 since
that flows any current that flow
through one through D1 has no
must flow choice but to flow
through the through R1. Likewise,
others. D2 is in series with R2.

CIJE | Unit 9: Advanced Circuits 113

Principles of Engineering

Potentiometers

A potentiometer is a variable resistor, meaning it can change resistance as a knob or switch is
moved. It can act as any resistance value from zero up
until its rated maximum. A potentiometer come with 3
pins attached to it. The outer two pins always have the
same resistance between them, the maximum resistance
of the potentiometer. For example, for a 10kΩ
potentiometer, pins 'A' and 'B' will always have a
resistance of 10kΩ between them, regardless of the
position of the potentiometer's knob.

As the knob on the potentiometer is rotated, this causes the
'wiper' to rotate within the device and 'wipe' across the
'resistive material'. The farther away the 'wiper' is from pin
'A', the greater the resistance becomes between points 'A'
and 'W'.

The middle and either outer pin act as a variable resistor when the knob is turned. They can
be used in place of a standard fixed resistor.

A→B 10kΩ Always
A→W Variable 0Ω-10kΩ
W→B Variable 0Ω-10kΩ
A→ W + W → B
10kΩ Always

Light Emitting Diodes (LED’s) and the Series Circuit

Ohm’s law states that the voltage across a resistor is proportional the current that flows through
it. The equation to support this is:

V=I*R

Where V represents the voltage across a resistor, I represents the current through the resistor,
and R represents the value of the resistance. This relationship is true for resistors but cannot
necessarily be applied to other devices. To decide if a component is a resistor it is important to
evaluate if it follows Ohm’s law.

An example of a component that is not a resistor is an LED. The relationship between voltage
and current is very complicated. The current through an LED is essentially zero unless the voltage
is at a certain threshold level, and the voltage cannot exceed that level. Above the threshold
level the current is unrestricted, and if it’s not limited it will destroy the device (i.e. - burn out the
LED).

Even more interesting is the threshold voltage is different for different color LEDs, and will also
vary slightly with temperature.

114 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

Worksheet: Breadboards, Series and Parallel

1. Complete the following two circuits by drawing wires onto the breadboards so that all the
LED’s will illuminate.

2. Complete the following two circuits by drawing wires onto the breadboard. The circuit
on the left should be wired in series, while the circuit on the right should be wired in
parallel.

Describe what the wiring error is for each of the following circuits:

3

4

5

CIJE | Unit 9: Advanced Circuits 115

Principles of Engineering

Lab: Advanced Circuits (Breadboard, Series, Parallel)

Series Circuit
1. Measure the resistance of three resistors (these resistors will be used throughout the lab):
R1____________ R2____________ R3____________

2. Build the circuit shown in the diagram on the right. BEFORE attaching the battery, measure
the total resistance of the circuit:
a. Using the multimeter: ____________
b. Using the formula to the right: ____________

3. Are the Measured (from ‘a’ above) and Theoretical (from ‘b’ above) resistances equal? Why
or why not?
_________________________________________________________________________

4. Attach the battery and multimeter and measure the current of the circuit: ______ Do your
results concur with Ohm’s Law (V = I*R)? _________ Are they required to? ____________

5. Measure the voltage across each resistor: V1: ________ V2: ________ V3: ________
6. Does the sum of the voltage across the three resistors equal the total voltage? _________
Parallel Circuit

7. Build the circuit shown in the diagram on the right. BEFORE attaching the battery, measure
the total resistance of the circuit:
a. using a multimeter: __________
b. using the formula to the right: ____________

116 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

8. Are the Measured (from ‘a’ above) and Theoretical (from ‘b’ above) resistances equal? Why
or why not?
___________________________________________________________________________

9. Attach the battery and measure the total current of the circuit: _______________________
10. Do your results concur with Ohm’s Law (V = I * R)? _________________________________
Measuring Current in Parallel Circuits

Parallel Circuit with Amp-meter Amp-meter reading total current Amp-meter only reading current
not connected for entire circuit. Note how the for center resistor. Note how the
current from all 3 resistors must go other 2 resistors have a path to
through the meter to return to ground, while the center resistor
must go through the meter to gnd.
ground.

11. Complete the following table for the three resistors in the parallel circuit:

Resistance Voltage Current V = IR ?
across each R across each R

R1 Y / N

R2 Y / N

R3 Y / N

Total Circuit Y/N

Discussion
14. If the three resistors from each lab were replaced with three light bulbs, which circuit,
parallel or series, would cause the lights to shine brighter? Why? (Hint: Current)

________________________________________________________________________

________________________________________________________________________
15. What would happen if the lights in your house were wired in series and a bulb blew out?

________________________________________________________________________

16. What would happen if they were wired in parallel? ______________________________

CIJE | Unit 9: Advanced Circuits 117

Principles of Engineering

17. What type of circuit is the wiring in your house most likely constructed of and why?

________________________________________________________________________

18. Indicate for each of the two diagrams below, if they contain series, parallel or both types

of circuits: ____________________
____________________

19. For the two circuits in the previous question, in which circuit would turning the
potentiometer (a variable resistor) have a greater effect on the brightness of the light and
why?

________________________________________________________________________
20. Build the voltage

divider (2 resistors in
series) shown at right.
Complete the following
table.

Turn the potentiometer
to a random setting for
each of the four
readings.

Resistance of Resistance of Voltage drop Voltage drop Total
potentiometer resistor across across resistor Voltage

With battery detached With battery detached potentiometer With battery attached Vpot. + Vresisit.

1 With battery attached

2

3

4

21. What is the correlation between the voltage drop across the potentiometer, the
voltage drop across the resistor and the total voltage supplied by the battery pack?

______________________________________________________________________

118 Unit 9: Advanced Circuits | CIJE

Principles of Engineering

22. If the resistor being used was replaced with a 1,000,000Ω resistor, would that increase or
decrease the voltage fluctuation across the potentiometer as it was turned, and why?
______________________________________________________________________

23. Complete the circuit below by drawing in wires so that the brightness of the red LED is
controlled by the photoresistor while the blue LED is controlled by the potentiometer.
Use the 220Ω resistor in series with the potentiometer so that should the potentiometer
accidentally be turned all the way to 0Ω the LED will not burn out.

24. Draw a breadboard diagram of the first 2 circuits below, and a wiring diagram of the third:

CIJE | Unit 9: Advanced Circuits 119

Principles of Engineering

25. In what cases would a breadboard diagram be more beneficial, and when would a wiring
diagram be more helpful?

______________________________________________________________________

______________________________________________________________________

26. When powering multiple LEDs from one power supply, a resistor can either be placed
on each individual branch, or one resistor can be used to protect all three branches.
Calculate how bright (i.e. – current) each LED will be in each scenario.

a. Calculate the current for each individual branch
using V=I*R. Remember that each branch of a
parallel circuit receives the full 5 volts.

VTotal = V1 = V2 = V3

Once you know the V and R for each branch you
can solve for the current using V= I*R

________________________________________

b. Calculate the total current exiting the power
supply by adding up the current from each
resistor.

________________________________________

c. Which circuit type (series or parallel) provides for
brighter LEDs (i.e. – most current)?

________________________________________
27. Assume an LED has a voltage drop of 1.4V, and is being powered from an Arduino 5V

pin. How many LED’s in series can one Arduino digital pin power? _________________

28. Compute the total resistance value of the following circuits:

a) __________ b) __________

Hint: start by combining R3 and R4 Hint: start by combining R2, R3 and R4

R1 = 200Ω, R2 = 220Ω, R3 = 2000Ω, R4 = 500Ω

120 Unit 9: Advanced Circuits | CIJE

Unit 10:
Voltage
Dividers and
AnalogRead

Principles of Engineering

Preface

This section will focus on a specific type of series circuit called a voltage divider circuit. Students
will use the circuit to incorporate a sensor into the Arduino, and use the serial monitor to
display the readings from the sensor onto their computer screens.

Unit Sections

➢ 1 - Voltage Dividers
➢ Worksheet: Voltage Dividers
➢ 2 - Reading Data - Analog Data from a Light-Dependent Resistor
➢ 3 - Printing Data - Using the Serial Monitor
➢ Lab: Analog Data and the Serial Monitor

Learning Objectives

After this unit students should be able to:
➢ Be able to apply the voltage divider equation to a simple circuit
➢ Describe the distinction between an input and an output
➢ Setup and run an analog sensor
➢ Describe what analogRead() does
➢ Describe why data handling is necessary
➢ Describe the two steps for starting and using the serial monitor
➢ Open the serial monitor
➢ Describe the difference between print() and println()

122 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

Section 1: Voltage Dividers

• As current travels around a series circuit, each component, or resistance, “uses up” some
of the voltage.

• For example, in the circuit shown to the right, 1/3
of the voltage is “used” by each of the resistors as
the current goes through the loop. The amount
of voltage that each resistor uses up is based on
its ratio when compared with the remaining
resistors.

• The most common type of voltage divider, that
we will work with, is a two resistor voltage
divider, shown below. The formula on the right is
used to solve for the Vout of a two resistor voltage
divider.

A voltage divider is commonly used in this course in two scenarios:
1. As a voltage limiter:

Where Vin is too large, a voltage divider can be used to step down the
voltage, allowing you to use the smaller Vout.

2. Interfacing a sensor with the Arduino:
A voltage divider converts a variable resistance into a variable voltage.
This is useful for sensors like photoresistors and thermistors, which are
variable resistors. Converting them to variable voltages allows the
Arduino to read them.

3.
CIJE | Unit 10: Voltage Dividers and AnalogRead 123

Principles of Engineering

Examples

A Voltage Limiter

Question:

Suppose you need an 8 volt power supply but only have a 12 Volt battery. Design a
voltage divider that will provide you with the appropriate voltage.

Solution:

Using the voltage divider formula, select any resistance for
R2, in this case we will select 2 = 200 Ω, and solve for R1.

Knowing we need 8 volts as our Vout, this gives us an 1 value of 100 Ω.

Interfacing A Variable Resistance Sensor With The Arduino

To interface a variable resistance
sensor, such as the thermistor
(changes with temperature), or
the photoresistor (changes with
light) we can substitute one of the
set resistors for the variable
resistor, as shown in the image on
the right.
We can then use Arduino to “read” the change in Vout as a result of the changing
resistance. For example, as the resistance of the variable resistor increases, Vout will
decrease. As the resistance decreases, Vout will increase.

Question:

If a 1kΩ resistor is selected for R2, and a photoresistor in R1 has a range of 100Ω to
5MΩ, what will the range in voltage the Arduino sees at Vout? Assume we are
powering the circuit from Arduino’s 5 volt source.

Solution:

Under direct light:

In complete darkness:
Thus, when the Arduino reads 4.55 V we know the sensor is in complete light, and
when it reads .001 V we know it is in complete darkness.

124 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

Work sheet: Voltage Divider

Suppose you had the following voltage divider setup as shown on the right.
1. Suppose you were using a 5V power source and needed 3.8V to
power a sensor:
a. If R2 was a 1kΩ resistor, what resistor should be used for
R1? ____________________
b. If R2 was a 100kΩ resistor, what resistor should be used
for R1? ____________________

For questions 2 and 3, using the diagram above, assume R1 to be a
photoresistor, R2 a standard resistor, and the power supply (Vin) to be 5V.

2. Would the voltage sent to the Arduino increase or decrease as light incident on the sensor
is increased? ____________________

3. Suppose, in direct sunlight, the photoresistor acted as a 500Ω resistor. What value
resistance should be selected for R2 so that the Arduino would read 4.5V under full
sunlight? ____________________

4. Suppose, in complete darkness, the photoresistor acted as a 3MΩ resistor. If we chose R2
as a 1kΩ resistor, what voltage would the Arduino read under complete darkness?
____________________

5. What is a device(s) you use daily that could contain a voltage divider used to limit/reduce
voltage? _________________________________________________________________
________________________________________________________________________
________________________________________________________________________
CIJE | Unit 10: Voltage Dividers and AnalogRead 125

Principles of Engineering

Section 2: Reading Data - Analog Data from a Light-
Dependent Resistor

In the preceding sections, we learned how to turn on a digital pin using global variables to
simplify our code (and protect against errors). Now we want to learn how to read a value from
a sensor. In doing so, we are shifting our focus towards using the microcontroller to collect
input (i.e. data) at the pins versus using the pins to send output. When we were turning on the
LED in Blink, we were sending a voltage out to our external electronics, an LED in this case.
Learning to distinguish inputs and outputs is one of the critical tasks in engineering any system.
Microprocessors, like the one in the Arduino, are digital, meaning they only work with On and
Off. This works for many applications, for example, to turn lights on or off, or for sensors that
are used to detect the presence or absence of a certain properties, such as light or humidity.
However, for many situations, On and Off does not suffice. What if we want to be able to set the
brightness of the light, or vary the speed of a motor? What if we want to use a sensor that
measures more than two values, such as a thermometer? For these, we need to study analog
values, that is values that vary continuously between and maximum and a minimum.
In these situations, it is important to be able to create or read a varying voltage. The Arduino has
provisions for both variable output and variable input voltages. The maximum voltage is 5V and
the minimum is 0V, but the Arduino allows us to utilize the voltages in between.

First let us consider the analog input capability. The Arduino is able to measure a voltage between
0 and 5 volts. Due to how it does this, it returns a number between 0 and 1023 instead of a voltage,
but this number can easily be converted to a voltage if necessary (typically it isn't).
The analog input pins are in the corner as shown in the picture above. These pins are named
A0 to A5. Now we will attempt to have an Arduino read an input voltage.
For this example, we will use the light-dependent resistor (LDR) to collect data and send this
data to the Arduino. We could use any analog sensor, e.g., the thermistor, potentiometer, etc.,
in this example. While the wiring of the external circuitry may change when using different
sensors, the Arduino code will remain the same for any analog sensor we are reading.

126 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

The wiring diagram for the LDR interfaced with the Arduino is below,

=

The LDR circuit is a basic voltage divider circuit. 5 volts is put into one end of the circuit, and
depending on the ratio of the two resistors, somewhere between 5 and 0 volts will come out the
middle (at A0). The voltage becomes 'divided'. Since the photocell changes resistance with light,
the voltage that comes out into pin A0 will also change with light.
The following is an example code that can be used to read the photoresistor.

In this code, we have two global variables. One variable, analogPin, is the pin number. The
other, readValue, is the container (i.e. the variable) that we are going to keep our measurement
in. Notice that the value in our container readValue will change as our program runs.
In this program, we have a new function called analogRead()which has the form:

analogRead(pin # of sensor);
There is one major difference between the digitalWrite() command and analogRead().
Whereas in a program, a digitalWrite() might look like:

digitalWrite(13,HIGH);
the analogRead() command looks like:

dataValueFromSensor = analogRead(A2);
When we are reading data from a sensor, we have to put that data somewhere. Here our analog
data is being put in an integer container called dataValueFromSensor.
Let's use a real-world example to understand why we need to assign the data to a variable. When
you look at a thermometer, you get a piece of data, the temperature. You do something with the
data. Either you write it down in a notebook (i.e. save it) or you get a jacket to stay warm. The

CIJE | Unit 10: Voltage Dividers and AnalogRead 127

Principles of Engineering

point is that you don't just look at the thermometer and do nothing. You must do something with
the data, otherwise what is the point of making the measurement?
The analogRead() function is the same. You must do something with the data. In computer
programming parlance, the function returns data, and you must handle the data. Otherwise, the
program will give an error.

Section 3: Printing Data - Using the Serial Monitor

In the previous section, we used the LDR sensor to store measurements in a variable container.
However, we need a way to see what values we are getting. The easiest way to do this is to write
(i.e. - display) the value of the variable to the screen. To do this, we will use the serial monitor.
The serial monitor displays data using a serial connection. The type of connection allows for two-
way communication between the computer (or other devices) and the Arduino. Fortunately, the
Arduino IDE makes it very easy for us to write data to the screen.
In our program, the two steps are,

1. Start up the connection by including,
Serial.begin(9600); // Start Serial Monitor

in the setup() function.
2. Print the values to the monitor by including,

Serial.println(dataReadFromSensor);
in the loop() function.
The LDR sensor code from above, with the serial monitor added, is shown below:

In the setup() function, we initialize the serial monitor with the command,
Serial.begin(9600); //initialize serial connection

The number in parentheses is the baud rate. This is speed that data will be sent in the connection.
It is similar to the bits per second used to talk about internet download speeds, e.g. 2 megabits
per second (Mb/s). There are a variety of common baud rates used including 19200 baud, 57600
baud, and 115200 baud.

128 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

It is possible to communicate at ‘too fast’ a speed. 9600 is more than fast enough for writing
basic sensor data to the serial monitor, so unless you have a good reason for selecting a faster
speed, 9600 baud will be more than sufficient.
Once we have set up the serial connection, we can write our data to the monitor with one of two
commands,

Serial.print(data);
or

Serial.println(data);
The difference between the two commands is that Serial.println() goes to the next line
after it prints. This is the equivalent of hitting the RETURN key on your keyboard after typing a
word.
But before we can see the difference between these, we have to know how to open the Serial
Monitor. To do this, we click on the magnifying glass in the top right-hand corner of the IDE as
shown in the figure.

Once the LDR is wired up and the modified program is running, when we activate the serial
monitor, we see the digital print below:
Again, the two commands used to write to the monitor are,

Serial.print(" Value from LDR ");
Serial.println(readValue);
The first line prints a label. If you want to
print text to the serial monitor, enclose the
text in double quotes.
Since we used Serial.print(), we do not
go to the next line, and the variable
readValue is printed next to the text.
Because we used the command
Serial.println(readValue), after the
variable is printed the cursor goes to the next
line. This value is printed each time through
the loop.
To see the effect of using print() versus
println(), let's change the print statements to:

Serial.println("Value from LDR ");
Serial.println(readValue);

CIJE | Unit 10: Voltage Dividers and AnalogRead 129

Principles of Engineering

When we do this, the output changes as
shown on the right.
The result of the changing the first line
from print() to println() means
that the label and the value are printed
on separate lines.
It is important to make sure that the
serial monitor and the Arduino are
always set to the same baud rate. The
baud rate for the serial monitor is set in
the lower right-hand corner with a pull-
down menu. Other values may be
selected, such as 19200, 38400, or all the
way to 115200, but the default value of 9600 is usually sufficient. The baud rate must match
the rate entered in the Serial.begin() command.

If Serial.begin(9600);
was used in the code, then the
baud rate in the serial monitor
window must be set to 9600 as
well.

130 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

Lab: Analog Data and Serial Monitor

1. Write, compile, and run a code that prints your name on one line of the serial monitor,
and your birthday on the next. Below is an example code to print “I blinked” in the serial
monitor.
Note the difference between Serial.print() and Serial.println() (the letters el-
en, NOT one-en). The latter goes to the next line after it prints. This is the equivalent
of hitting the RETURN key on your keyboard after typing a word.

print what’s in the quotes
Serial.print(“ ”);
print what’s in the quotes and then hit Enter
Serial.println(“ ”);
2. Using serial print statements, with characters and spaces, have the serial monitor print
out a scrolling smiley face. For example: '- -'
|
\__/
This could be considered an example of ASCII art. An internet search will show many
more examples. Hint: Look up "escape sequences in C".
Copy and upload the LDR code below and open the Serial monitor window

The analogRead function checks the
voltage in an analog pin, and then stores
that information in a variable. The Arduino
can then ‘print’ that variable to display its
value.

CIJE | Unit 10: Voltage Dividers and AnalogRead 131

Principles of Engineering

3. Which analog pin on the Arduino board is the code setup to read? ___________
4. If x = 17, what will the following lines of code print? Serial.println(“x”);_______

Serial.println(x); ________
5. What would the serial monitor display if we changed Serial.println(readValue);

to Serial.println(“readValue”); ______________________________________
6. Using a wire, attach the 5V pin to the A0 pin. What number reads on the screen? _____
7. Attach the ground (GND) pin to the A0 pin. What number reads on the screen? _______

HIGH ................. LOW The Arduino uses a scale from 0-1023
1023 ................. 0 to display voltages from 0V-5V.
5V ................. 0V
This allows for a higher resolution
without having to use decimals.

8. If the Serial Monitor displays "512", how much voltage is the Arduino sensing? ________

9. If 3 volts were put into the analog pin, what would the serial monitor display? ________

10. If the serial monitor increases by one number, how much did the voltage increase? ____
11. In your code, delete "readValue = " before the "analogRead(analogPin);"

What do you see on the screen? Why? ________________________________________
12. Change “Serial.println(readValue)” to “Serial.println(analogRead(A0))”

Explain what is happening in this example. _____________________________________

________________________________________________________________________
Voltage Divider Circuit
13. Resistor Selection: A voltage divider circuit outputs a variable voltage based on the

balance between the two resistors; in our case a permanent resistor and a variable
resistance sensor. If the sensor resistance is radically larger or smaller than the
permanent resistor, the voltage divider will not put out a considerable voltage change as
the sensor senses the environment.
132 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

As a rule, select a permanent resistor between half and double the sensor’s resistance.
Measure the resistance of a photoresistor A) In darkness. ______________ Ω

B) In light. __________________ Ω
14. What is an appropriate range of resistance to use in series with this senor? _____ - ______
15. Build the circuit show below.

16. Using the code from the beginning of this lab, what is the range of numbers on the serial
monitor as you cover and uncover the photoresistor?
__________ to __________

17. What would be an appropriate
“threshold” number, so that
below this number it would
considered dark, and above
would be considered light, or
vice-e-verse?
_________________________
In a later lab we will use this number to turn on and off a device.

18. Instead of the LDR, set up the circuit with the thermistor. You can pinch
the sensor to heat it slightly. How do the numbers in the serial monitor
correlate to the temperature the sensor is reading?
__________________________________________________________ Thermistor

19. How can we correlate the sensor values on the screen to actual real-life properties (i.e. -
temperature, light intensity, etc.)?
________________________________________________________________________
________________________________________________________________________

20. What are some advantages and disadvantages to using a sensor that provides an analog
voltage as its output as opposed to digitally relaying you the actual information?
________________________________________________________________________

CIJE | Unit 10: Voltage Dividers and AnalogRead 133

Principles of Engineering

Lab: Sensors in a Circuit

Purpose:

In this experiment, you will create a temperature sensor characteristic by evaluating a thermistor
in a voltage divider circuit.

Equipment:

➢ A thermometer that will display the water temperature at all stages of measurement.
➢ Multimeter
➢ A measuring utensil of up to 50 ml.
➢ A liter of hot water (utensil 1)
➢ A liter of room temperature water (utensil 2)
➢ Assorted circuit components to build the circuit below

Procedure

You have a temperature sensor whose resistance as a function of temperature is unknown.
During the experiment, you are to soak the sensor in water at different temperatures and to
simultaneously gauge the temperature vs. the voltage output of the circuit.

1. Build the following voltage divider circuit
Note the use of a 10kΩ resistor in the circuit which correlates to the range of the
thermistor.

2. Start with 150 mL of room temperature water
3. Insert the thermistor and thermometer into the water. Wait 20 seconds and record the

water temperature and voltage drop across the resistor (R2) in the table on the following
page. Measure the voltage drop across R2 by placing a multimeter across it.
4. Add 50 mL of hot water and repeat step 3.
5. Continue adding hot water until you have obtained 10 readings in the table on the
following page.

134 Unit 10: Voltage Dividers and AnalogRead | CIJE

Principles of Engineering

6. Record your results in the table below

Trial Voltage Drop across R2 Water temperature (°F)
resistance (Ω)

1

2
3

4

5
6

7

8
9

10

7. Graph the temperature of the water as a function of voltage read by the sensor.
Label each axis with an appropriate scale.

8. Draw a best fit line through
your data.

9. Try to derive an equation of
your line that would convert any
voltage into a temperature.

= +

= ∗ +

___________________________

10. What physical property of the
thermistor changes with
temperature?

___________________________

___________________________

11. A voltage divider is used when we want to obtain and variable voltage reading with a sensor
that has a variable resistance property. Why is this useful?

______________________________________________________________________________

CIJE | Unit 10: Voltage Dividers and AnalogRead 135

Principles of Engineering

136 Unit 10: Voltage Dividers and AnalogRead | CIJE

Unit 11:
Introduction
to Sensors

Principles of Engineering

Preface

Sensors are a major component of most systems. This unit is designed to introduce some basic
sensor terminology and how sensors can be used to control the actions of the system. They are
essential to allow a system to respond the situations in the environment. In this unit, we will look
at several different types of sensors and how they might be used in a system to respond to
changes in the environment surrounding the system. In the following unit, we will look at specific
sensors and how to incorporate them with the Arduino.

The sections of this unit are:

➢ What is a Sensor
➢ Types of Information
➢ Output Types
➢ Sensor Attributes and Accuracy
➢ Characteristics
➢ Worksheet: Sensors
➢ Common Sensors and Actuators

Learning Objectives

At the end of this unit, students will be able to:
➢ Explain what a sensor is
➢ Identify types of environmental characteristic that are measured
➢ Select the type of sensor required for different situations
➢ Describe the difference between accuracy and precision

138 Unit 11: Introduction to Sensors | CIJE

Principles of Engineering

Section 1 - What is a Sensor

A sensor detects something in the environment and outputs an electrical signal that varies with
the level of the parameter. For example, a temperature sensor might output a voltage that varies
with the temperature. Cold temperature might give a low voltage. Hot would give a higher
voltage. A range sensor might output a voltage that increases as the distance to an object in front
of it increases, giving a low voltage if something is close, a high voltage if the nearest object is
further away.

Section 2 - Types of Information

Sensors are output devices. To use them correctly, they are connected to a processor pin which
is designated as an input pin. Processors have two types of input pins, analog pins and digital
pins. Sensors have different types of output. Some sensors produce voltages that can be read
directly, others give information in ways that need to be converted to voltages before they can
be read by the processor circuit. A simple push button switch creates an open or short circuit. A
simple circuit is required to convert this into a digital input that can be read by the processor.
Some sensors produce pulses, short periods when the output is high and then periods when the
output is low. Some sensors return a resistance that varies with the parameter being measured.

Section 3 -Output Types

Digital Outputs

A digital output is characterized by either a high-level voltage or a low-level voltage. A high-level
voltage, often characterized as a digital “1” is usually any voltage above 2.7 Volts. A low-level
voltage, a digital “0” is anything below 0.7 Volts. Any voltage between these levels is considered
unknown. A sensor that detects if a door is locked, or if a button is pressed would have a digital
output.

Analog Outputs

Often an input is not just a simple on or off state. In many cases, such as the temperature of a
room, or the brightness of a light, it requires more than just a simple high or low answer. In these
situations, we use sensors that output a voltage between a minimum and a maximum value. The
Arduino can read these types of outputs if they are between a minimum of 0, and Vref. Usually
Vref is 5 volts. The evaluation of an analog voltage gives a number. The Arduino gives numbers
from 0 for 0 volts and 1023 for maximum voltage. We will
discuss how to convert this result into something
meaningful in the next chapter.

Pulse Outputs

Some sensors return a digital signal that is turning on and
off. These types of signals have certain advantages but can
be more difficult to read. Sensors with pulse width output
results provide the information in the relationship
between the width of the “on” time and the period of the
pulses. Consider the example below:

CIJE | Unit 11: Introduction to Sensors 139

Principles of Engineering

Section 4 - Sensor Attributes and Accuracy

Sensors are not perfect. The relationship between the measured result and the actual value
depends on several parameters. Let’s look at the data for the Maxbotix range sensor. This is a
simple device that gives a voltage proportional to the distance from the sensor to an object in
front of it. The datasheet says:

The LV-MaxSonar®-EZ1™ detects objects from 0-inches to 254-inches (6.45-meters) and
provides sonar range information from 6-inches (0.15meters) out to 254-inches with 1 inch
(0.025meters)- resolution. Objects from 0-inches to 6-inches range as 6-inches. The
interface output formats included are pulse width output, analog voltage output, and
serial digital output.
This is a very nice sensor, but note the 1-inch resolution number. If we needed to measure
distance to an accuracy of 1mm, this sensor would not be useful.
Measurement correctness is usually characterized by “accuracy” and “precision”.
Accuracy is the sensor’s ability to give the right answer. Repeated measurements with an
accurate device will have an average value that is close to the correct value.
Precision is the device’s ability to give reproducible answers.
Consider the charts below:

In the first target, the projectile marks are all around the center of the
target. Each hit is off the center but the error is a deviation from the
perfect value. This is an example of accuracy with limited precision.

In the second example all hits are tightly grouped, showing excellent
reproducibility, even though they all miss the center ring. This is an
example of high precision but low accuracy.

In some cases, accuracy is important. In some cases, precision is more significant. It is important
to know what your design requires. In most situations either accuracy or precision is important
but not both. Improving both increases the cost of the sensor.

Section 5 - Characteristics

A sensor converts a physical dimension to an electrical one. Hence, the sensor has an output that
depends on its input. Does this remind you of the term “function” from mathematics? So that is
exactly what it is! The relationship between the sensor’s output and its input, i.e. the function
that describes the dependence of the electrical output on the physical input, is called a
characteristic. Graphs are a visual way to display the dependence between two variables (i.e. a
function), and usually the characteristic of a sensor is shown using a graph.

140 Unit 11: Introduction to Sensors | CIJE

Principles of Engineering

The electrical dimension at the outlet of the sensor is the dependent variable (the vertical axis of
the characteristic graph) and the measured physical dimension is the independent variable (the
horizontal axis of the graph).
For example, the following diagram shows the characteristic of a distance sensor (d) that
produces a voltage. Note that in this case the characteristic is linear, i.e. the graph is in the form
of a straight line:

V (v)

50

When the characteristic of the sensor is linear, it is very convenient to use, because the sensitivity
of the sensor is constant, i.e. the degree of change of output of the sensor is always constant for
a given change in the physical value (which is the gradient of the graph, which is constant for a
linear graph). Indeed, we add to the list of sensor attributes the linearity of the characteristic and
quantitatively we can ask about the degree of linearity of the characteristic, or the range of
physical values for which it is linear (what measure is associated with this that can be found and
used in Microsoft Excel?).
An example of a non-linear characteristic of a thermometer follows:

Resistance (kΩ)

CIJE | Unit 11: Introduction to Sensors 141

Principles of Engineering

Work sheet: Sensors

Question 1
Connect the parameter on the left to the type of sensor used to measure it on the right:

_____ Moisture in the air a. Pressure sensor
_____ Is the light on b. Microphone
_____ How hot is the water c. Current meter
_____ Is there a radio transmitter on d. Humidity sensor
_____ Do you hear that sound e. Photo voltaic cell
_____ How much current from the solar cell f. Water sensor
_____ How hard are you pushing that thing g. Thermometer
_____ Is it raining now h. RF Sensor
Question 2

Consider the following
projects below.

For each project decide if
the distance sensor
described in the
following graph would be
useful in the application,
and explain why.

a) A hand-held device that allows one to measure the approximate dimensions of a room.
The device is placed against one wall and measures the distance to an opposite wall
without having to use a tape measure. (Hint: look at the sensors maximum range).

__________________________________________________________________
b) A robot is to move up to an object, stop, pick up the object and then carry it back to the

starting point. The robot must stop 3 inches from the target for the arm to pick up the
object. This sensor would need to measure how far away from the object the robot is.

__________________________________________________________________
c) Hovercraft fan blows air downward to lift a vehicle. The unit is intended to float 5 inches

off the ground. If the distance exceeds 5 inches, the fan speed is reduced. If less than 5
inches, the fan speed is increased. This sensor would need to monitor the height of the
hovercraft off the ground.

__________________________________________________________________

142 Unit 11: Introduction to Sensors | CIJE

Principles of Engineering

Question 3
Consider each of the following projects. Determine which is more important for the
sensors, accuracy or precision, and explain why. Understand those sensors which have
excellent precision and excellent accuracy are very expensive.
a) We wish to measure temperature changes at sunrise and sunset. We will measure
the temperature every 30 seconds as the sun is coming up and as it is going down.
We are interested in determining if the temperature changes faster in the morning
or in the evening.

Accuracy or Precision, Why? __________________________________________

__________________________________________________________________
b) I am concerned about my health. Normally my body temperature is 98.4 degrees.

If my temperature goes above 99, I want to stay home in bed to recover. My
thermometer must have…

Accuracy or Precision, Why? __________________________________________

__________________________________________________________________
c) Electronic circuits have a high risk of damage if they are handled in an environment

with humidity below 50%. If the humidity drops below this value, we want turn on
the humidifiers to increase the moisture content in the air.

Accuracy or Precision, Why? __________________________________________

__________________________________________________________________
d) Mount Rushmore is slipping. Each year the rock slides a small amount. To evaluate

the danger to the historic sculpture, an iron rod has been put into Washington’s
head and another rod is anchored into the mountain several meters away. As the
rock moves, this distance increases. We wish to measure how rapidly this distance
is increasing.

Accuracy or Precision, Why? __________________________________________

__________________________________________________________________
Question 4
Analyze the attributes of a medical thermometer. Estimate where necessary.

a) Measurement range (°F) ______________________________________________

b) Resolution (e.g. : 0.1°F, 0.5°F, 5°F, etc.) __________________________________

c) Acceptable accuracy (±°F) _____________________________________________

CIJE | Unit 11: Introduction to Sensors 143

Principles of Engineering

Question 5
Mark the accuracy and precision of each situation as being either “High” or “Low”. The
blue “+” indicates the ideal result.

Accuracy _____________ _____________ _____________
Precision _____________ _____________ _____________

Question 6
Below is the data graph for the NI1000SOT temperature sensor

144 Unit 11: Introduction to Sensors | CIJE

Principles of Engineering

Indicate the following data and attributes:
a) Measurement range (°C) _____________________________________________
b) Linearity, yes or no? _________________________________________________
c) Resistance at 0°C (Ω) _________________________________________________
d) Sensitivity (change in Ω per degree) _____________________________________

Question 7
Suppose a sensor outputs an analog voltage range of 0 volts when the temperature is at
30°C, and 5 volts when the temperature is at 100°C.
a) What is the temperature when the sensor outputs 1.88V? __________________
b) What is the temperature when the sensor outputs 6V? _____________________

Question 8
A temperature sensor’s attribute is given as follows:

a) According to the data, what is the sensor’s temperature measurement range?
__________________________________________________________________

b) At what temperature range is the sensor’s sensitivity the highest (i.e. – for what
range of temperature values, will a small change in temperature correlate to a
large change in resistance)? Explain.
__________________________________________________________________
__________________________________________________________________
CIJE | Unit 11: Introduction to Sensors 145

Principles of Engineering

Question 9
To paint a vehicle automatically, the distance between the painting machine and the vehicle must
be measured. For this purpose, a distance sensor is to be used. The maximum possible distance
of the machine from the vehicle is known to be 3 feet.
The following characteristics of various distance sensors are given:

Which sensor, and why, would be best suited for ensuring the vehicle painting robot's arm
remains the appropriate distance away from the vehicle body it's paining?

____________________________________________________________________________

____________________________________________________________________________
Question 10
A temperature sensor’s characteristic is given as follows:

a) Find the slope of the graph and Rn [k Ω]
explain its meaning.

_________________________

b) Find the equation for the
resistance (y) as a function of
the temperature (x).

_________________________

c) What is the output of the
sensor at a temperature of
100°C?

_________________________

146 Unit 11: Introduction to Sensors | CIJE

Principles of Engineering

Question 11
The characteristics of four sensors for measuring the flow speeds of liquids are given. The sensors
measure speed and convert its value into an electric voltage:

Analyze the characteristics of the four sensors, compare them and indicate their properties in
the following table:

Measurement range Output value Linearity Behavior characteristic:
(Volts) (yes/no) For Linear – the characteristic equation
Sensor (Velocity)
For Nonlinear – most sensitive range

A

B

C

D

CIJE | Unit 11: Introduction to Sensors 147

Principles of Engineering

Common Sensors and Actuators
Sensors

1. Temperature sensor – Measure temperature (e.g. TMP36 Digital Temp. Sensor)
2. Accelerometer – Used to measure acceleration (or movement) in any direction
3. Compass – Used to sense what direction the sensor is pointed in
4. Water sensor – Used to sense water
5. Humidity sensor – Used to measure humidity
6. PH sensor – Used to measure pH of a liquid
7. Ultrasonic distance sensor – Measure the distance from the sensor to an object
8. Photoresistor – Used to measure light intensity
9. Soil moisture sensor – Used to measure amount of water in soil
10. Audio sensor – Used to sense noise volume (e.g. – clapping, crying, etc.)
11. Tilt sensor – indicates when an object isn’t resting flat
12. Color sensor – Used to sense the color of an object
13. Force sensor – Measures how hard an object is pressing down on it
14. Flex sensor – Measures how much an object is bending (e.g. – finger joint)
15. Barcode scanner – Used to read barcodes
16. Fingerprint scanner – Used to read and ID fingerprints
17. Galvanic skin sensor – Used to measure amount of sweat
18. Muscle sensor – Used to measure muscle contraction levels
19. Pulse sensor – Used to sense heart pulses (i.e. – beats)

Actuators (components of a machine, responsible for moving
or controlling a mechanism or system)

1. Vibrator – Shakes rapidly
2. RF Transceiver – Used to send information from one Arduino to another
3. Servo – Used to rotate an object to a specific angle
4. Stepper motor – Used to rotate an object a certain number of times
5. Solenoid valve – Used to open or close a valve (e.g. control water or air flow)
6. DC motor – Used to continuously rotate an object
7. Relay/transistor – Used to turn a high powered device on and off

148 Unit 11: Introduction to Sensors | CIJE

Unit 12:
Sensors in
Circuits

Principles of Engineering

Preface

In this unit, we will take another step towards designing and assembling a technological system
with a specific objective. The topic of sensors will be combined with series circuits. The goal is
to create a system that receive input from its environment and turns that into voltage which
can be measured electronically, or turn on a circuit.

Unit Sections:

➢ Series Circuit Load
➢ Worksheet: Sensors in a Voltage Divider
➢ Worksheet: Sensors in a Circuit

Learning Objectives

By the end of this unit students will be able to:
➢ Gather data about the characteristics of a sensor
➢ Integrate a sensor into a circuit
➢ Design a circuit alert compatible to the specified threshold crossing

150 Unit 12: Sensors in Circuits | CIJE


Click to View FlipBook Version