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

Section 1 - Analog Write

The Arduino has the ability to put out a variable voltage as well as reading one.
Sometimes we will want to control the brightness of an LED, or the speed of a motor. In that
case we can use a command called analogWrite(). analogWrite works by turning a pin on and off
very quickly, so quickly that our eyes and mind do not perceive the flicker. If an LED spends half
its time off and half its time on, then it will appear half as bright. This technique is called pulse
width modulation (PWM). It is used over and over in electronics because it allows us to control
a component in an "analog" way using a digital pin. We can appear to be sending an LED only 2.5
volts, when in actuality we are switching between sending it 5V and 0V. For this reason, we
attach our device to the digital pins when using analogWrite().

Not all digital pins on the Arduino can do PWM. Only pins 3, 5, 6, 9, 10 and 11 on the Arduino
Uno are PWM enabled pins. When set as OUTPUT pins with a pinMode() call, these pins can be
set to output a pulse that is high for a while and low for a while. This on and off happens 490,000
times a second. We can control how much of the cycle is on and how much off with an
analogWrite() function call.

CIJE | Unit 15: Buttons, Transistors & analogWrite 201

Principles of Engineering

The analogWrite() function requires 2 input parameters, the pin number, and a number between
0 and 255. If we send 0, the pin is always LOW. If we send 255, it is always HIGH. The numbers
in between give us varying on and off times which correspond to varying output voltages. We
can use this to set the brightness of an LED or change the speed of a motor for example.

202 Unit 15: Buttons, Transistors & analogWrite | CIJE

Principles of Engineering

Lab: Analog Write and RGB LED's

Background

Up until this point, we have used LEDs that are only a single color. However, with an RGB LED we

can produce any color we want without changing out the LED. An RGB LED is really three small

LEDs next to each other—one Red, one Green, and one Blue (hence,

why it is called RGB). When working with projected light (i.e. light Note: The analogWrite

coming directly from a light bulb), by mixing these three colors, function can only operate

called primary colors, you can produce any color. These are on Arduino Uno pins 3, 5,

different than the primaries you learn about in art class (red, blue, 6, 9, 10, and 11

yellow) which are related to reflected light (though these turn out

not to be the true primaries, either). By using analogWrite to create a specific brightness of each

of the primary colors, we can create the appearance of any color we desire. You can wrap the

light in tape to act as a diffuser to better mix the colors.

Procedure

1. Plug in the RGB to the Arduino as
shown in the circuit diagram below.
Note that the common leg of the
RGB LED, the one that connects to
ground, is a slightly different length
than the other three.

The wiring is the same as if you
were connecting three separate
LED's.

2. Develop a code that cycles through
the three colors by slowing turning on
one color and then fading it off before
continuing to the next color.

Below is an example code that will The analogWrite function is embedded
slowly fade an LED on: in a for loop that runs 255 times. Each time
it runs, the variable ‘ i ' increases by one.
for(int i = 0; i < 255; i++)
{ We can use the variable ‘ i ' to control the
brightness of the light, which will also
analogWrite(9, i); increase as the loop progresses.
delay(15);
} We need a delay in the loop or the
brightening will happen faster than the
3. Add three potentiometers to the human eye can perceive.

circuit and connect each to its own

individual analog pin. Use the values

from analogRead() to control the
brightness of each color using a

CIJE | Unit 15: Buttons, Transistors & analogWrite 203

Principles of Engineering

separate potentiometer. Adjust the potentiometers until you have created orange and
purple "LED's".

4. Activity: Create a game where an RGB automatically and randomly selects a color. Using
the three potentiometers and RGB LED from the previous question to try and match the
same color as the random RGB. The LED should blink when you get it correct. Try and
add a timer to see who can match the colors quickest.

5. Challenge: Modify the code from step 2 so that the individual color cycles (brightening
and fading) overlap, producing new and mixed colors, in addition to the primary colors,
as the code proceeds through the cycle.

204 Unit 15: Buttons, Transistors & analogWrite | CIJE

Principles of Engineering

Section 2 - Transistors and DC motors

Background

Often we need to drive something that takes more current than the microprocessor can
produce. Each pin on an Arduino can only provide .04 amps (40 mA). To put that into
perspective, an iPad needs 2 amps to charge, and a portable air conditioner can use up to
15 amps. At that rate it would take 50 Arduinos just to charge an iPad.

A transistor is an electrical device that can be used to turn circuits on and off. It is placed in a
circuit like a switch would be, and is “turned on and off” by applying a voltage, or ground, to a

third leg, called the gate. When energized, the
transistor allows current to flow from the drain down
through the source.

The circuit on the left shows a simple switch used to
control an LED in a circuit.

The circuit on the right shows the same circuit but
with the switch replaced by a transistor. The
transistor “opens and closes” based on whether a
voltage is put into it.

The voltage used to “open and close” the transistor
is different than the voltage used to power the LED.

Figure showing LED Figure showing LED activated by
activated by a manual an Arduino controlled transistor
switch
switch

Lab: Analog Write, Transistors and DC motors

1. When normally powering a high-power device we would use
some sort of external power supply, such as a battery pack, as
shown in the figure to the right. While this will operate the
device, it does not allow the Arduino to intelligently control
the device.

2. By adding a transistor into the circuit, as shown in the lower
figure, we can use the Arduino to open and close the
circuit. The transistor acts as a switch that the Arduino
can control.

3. By attaching the 3rd leg of the transistor to a digital
Arduino pin we can turn the switch on and off by setting

CIJE | Unit 15: Buttons, Transistors & analogWrite 205

Principles of Engineering

the pin HIGH or LOW using the digitalWrite command.
4. Plug the transistor into the breadboard and construct the circuit as shown in the figure

below. It doesn’t matter what high powered device you are trying to control, i.e. a
motor, a light, etc., the transistor will perform the same operation for all of them.

In a transistor circuit, the digital pin is NOT powering the motor, it is merely turning on
the switch (i.e. the transistor) that allows power form the battery to flow to the motor
5. In the above circuit, the power for the motor is being provided from the battery pack.

Any power supply can be used as long it contains enough power to power the device
you are trying to run. In some instances, the Arduino 5V pin may suffice.
6. Write a program that turns the motor on for 10 seconds and then off for 10 seconds by
using the digitalWrite command. You can use the blink example as the basis for
your code.
7. Edit the code from the previous step so that the motor goes from full speed to slow speed
instead of turning off completely.
This can be accomplished by using one of the following digital pins: 3, 6, 9, 10, 11, to
control the transistor and the analogWrite command as follows:

analogWrite(pin, value);
where “value” ranges from 0 (off) to 255 (maximum power).

Note: a minimum voltage is required for a motor to overcome starting friction
8. Why will the motor run off the batteries but not directly from the digital pin?

________________________________________________________________________
206 Unit 15: Buttons, Transistors & analogWrite | CIJE

Principles of Engineering

9. Using a "for loop" and the analogWrite command, write a program that will cause the
motor to ramp up, taking 10 seconds to reach full speed, and then take an additional 10
seconds to slow down to zero power.

10. Activity: Use the ultrasonic distance sensor to control the speed of the motor. Attach a
propeller to the motor to create a fan. The farther away from the fan you are, the harder
it should blow. If your hand gets close to the fan it should automatically turn off.

11. Challenge: Add two buttons to your circuit. Modify the code so that one button causes
the motor to speed up and one button will cause the motor to slow down.

12. What are three everyday items that might use a transistor to control them?

_____________________ _____________________ _____________________

13. A mechanical relay is a switch that a microcontroller can turn on and off by physically
taking two wires and either moving them together or pulling them apart. What are some
benefits of the transistor, with its non-moving parts, over a mechanical relay?

________________________________________________________________________

________________________________________________________________________

14. What are some of the disadvantages of a power transistor versus using a mechanical
moving switch?

________________________________________________________________________

15. Activity: a transistor can be used in a circuit to simulate an “if” statement. If the voltage
is above the threshold voltage, a device can be turned on, and if below it can be turned
off. Below is a simple circuit for a night light that does not use a microcontroller or code.

The voltage divider in the center of the circuit is connected to the gate of the transistor.
So instead of the voltage output causing the analogRead numbers to go up or down, it
can cause the transistor to turn on or off.

Try and build the
circuit and create a
night light without
using an Arduino.
Note: Use the
potentiometer to
help ensure the
output voltage from
the voltage divider
circuit is in the
proper range to turn
the transistor on and
off.

CIJE | Unit 15: Buttons, Transistors & analogWrite 207

Principles of Engineering

Section 3 - Buttons and Digital Read

Buttons and switches are similar in that they are both used to connect to wires together. The
difference being that a button makes an intermittent connection, while a switch makes a
continuing, or latching connection. The images below show the wiring for a button.

When pressed, the button connects the two leads on side A to the two leads on side B. In
the picture on the left the button is not pressed and the pin is connected to ground. In the
picture on the right, the button is pressed and the pin is connected to 5V.

AB AB

In this scenario, the Arduino pin is normally LOW, and pushing the button will make it HIGH
To setup the pins being used to sense buttons declare them as INPUT in the void setup.

void setup()
{

pinMode(2, INPUT); // declares pin 2 as an INPUT
}

To use the button in a code we must digitalRead the pin that is connected to the circuit.
The pin will be LOW when the button is not pushed, and be HIGH when the button is pushed
and the pin becomes connected to 5V. We can use the digitalRead function as part of an
"If" statement's boolean. For example:

if(digitalRead(2)== HIGH) //The button has been pushed

208 Unit 15: Buttons, Transistors & analogWrite | CIJE

Principles of Engineering

We can then turn on a light plugged into pin 8 by continuing the statement

if(digitalRead(2)== HIGH) //The button IS pushed
{ //Turn on the light

digitalWrite(8, HIGH);
}

And turn it off if the button is not pressed

if(digitalRead(2)== HIGH)
{

digitalWrite(8, HIGH);
}
else
{

digitalWrite(8, LOW); //Turn off the light

}

We can also store the value from the digitalRead function and use it to decide whether to

turn the light on or off:

int x = digitalRead(2);
Serial.println(x);

if(x == HIGH)
{

digitalWrite(8, HIGH);
}
else
{

digitalWrite(8, LOW);
}

CIJE | Unit 15: Buttons, Transistors & analogWrite 209

Principles of Engineering

Lab: Buttons and Digital Read

1. Build a circuit and create a code that will cause a light to turn on when a button is
pressed, and turn off when it's released.

2. Add a buzzer to the circuit so it will buzz when the button is pressed. Do NOT use
coding. Attach the buzzer directly to the button circuit on the breadboard.

3. Edit the code so that the button will stay on for 10 seconds once the button is pressed
then turn off until pressed again.

4. Modify the code so that the light will blink three times when the button is pressed.
5. Develop a code so that the light will blink slowly when the button is not pressed, and

blink much faster while the button is pressed.
Hint: Try and use the 'while' flow control as opposed to the 'if'.

6. Similar to number 3 above, however, have the light turn on when the button is
pressed, and have it remain on for 10 seconds once the button is released.

7. Add another button to the circuit. Have one button cause the light to blink slowly,
and the other to cause it to blink quickly.

8. Have the light continue to blink at the rate set by the buttons in number 6 even after
the buttons has been released.

9. Look up the term "button bounce" and describe what it is. ____________________

____________________________________________________________________

10. What are some ways to avoid "button bounce"? ____________________________

____________________________________________________________________

____________________________________________________________________
11. Activity: Develop a game using three buttons and two lights. The goal of the game

is to see who can press their button first after a “starting light” turns on. Whoever
wins should have their light turn on as well. If a player presses their button before
the starting light is illuminated the other player is the winner.

Hint: look up the random function so the starting light turns on at a different
time interval each time the game is played.
12. Challenge: Develop a code so that one push of the button will cause the light to turn
off if it was on, and on if it was off.
Hint: Try and use another variable to 'store' the setting of the light, on or off, and use the button
to switch the value of that variable.

210 Unit 15: Buttons, Transistors & analogWrite | CIJE

Unit 16: Servo
Motors &
Ultrasonic
Sensors

Principles of Engineering

Preface

This unit deals with two of the most basic and widely used sensors in Arduino projects. The
servo motor and the ultrasonic distance sensor.
This unit also deals with the fundamental skillset of being able to merge two separate codes.

Unit Sections

➢ Lab: Ultrasonic distance sensor
➢ Lab: Servo motor
➢ Lab: Auto batter

Learning Objectives

Following this unit students will be able to:
➢ Use an ultrasonic distance sensor to compute the distance to a foreign object
➢ Operate a servo motor efficiently and precisely
➢ Combine two independent codes, operating two independent devices, into one unified
code. Additionally, students will use if statements to have the two device’s actions
dependent on each other.

212 Unit 16: Servo Motors & Ultrasonic Sensors | CIJE

Principles of Engineering

Lab: Ultrasonic Distance Sensor

The ultrasonic distance sensor works by emitting short bursts
of sound and listens for this sound to echo off nearby objects
(the frequency of the sound is too high for
humans to hear). The sensor can measure
the time of flight of the sound burst. A user
can then compute the distance to an object
using this time of flight and the speed of
sound.
The distance an object travels is calculated
by multiplying its speed by the time it’s been
traveling.

Distance = Speed * Time
For example, if a car is traveling at 60 mph (speed) for one hour (time), it has traveled 60*1 = 60
miles. If its traveled two hours, its traveled 60*2 = 120 miles.
In our case, we will multiply the speed of sound by the time it’s been traveling. It is important to
make sure units are kept consistent. Since we want to compute the distance in inches, and the
Arduino measures microseconds, we need our speed of sound to be in inches per microseconds.

So the speed of sound is 0.0135 inches per microsecond. If we multiply that by the time the wave
was traveling (in microseconds) we can compute the distance (in inches) the wave has traveled.
Additionally, we must divide by 2 since we are only interested in how far the wave traveled in
one direction even though it is actually making a round trip.

Whenever using a sensor of any type, it is always important to understand its range and
limitations. To the right is the ultrasonic distance sensor’s operating profile. It indicates the
range in both distance
and angle for which the
sensor will operate.
Anything within the oval
shaped outline in the
center will be sensed by
the sensor.

CIJE | Unit 16: Servo Motors & Ultrasonic Sensors 213

Principles of Engineering

Exercise

1. Using the profile chart on the previous page, what is the maximum distance the
ultrasonic distance sensor can sense something directly in front of it? _______________

2. At 20 degrees from the face of the sensor, what is the maximum distance it can
sense? __________________________

3. What distance will the sensor record if there is no object within range? ______________
4. Why? ___________________________________________________________________

Construct the following circuit for the ultrasonic sensor and upload the code to Arduino:

int trigPin = 12; 5. What do you suppose the "pulseIn" command
int echoPin = 11; does?
long duration, inches; _______________________________________
_______________________________________
void setup()
{ 6. For what types and shapes of objects does the
sensor not work?
Serial.begin(9600); _______________________________________
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT); _______________________________________
}
void loop() 7. Why use the "long" data type as opposed to
{ "int" (hint: duration is counting microseconds)?
digitalWrite(trigPin, LOW); _______________________________________
delayMicroseconds(2);
digitalWrite(trigPin, HIGH); 8. What are some other medium, besides
delayMicroseconds(5); ultrasound, that could be used to measure
digitalWrite(trigPin, LOW); distance in this way?
duration = pulseIn(echoPin, HIGH); _______________________________________
inches = duration / 74 / 2;
Serial.println(inches); _______________________________________
delay(200);
}

214 Unit 16: Servo Motors & Ultrasonic Sensors | CIJE

Principles of Engineering

Lab: Servo Motor

A servo motor is a rotary actuator that allows for precise
control of angular position. The output shaft of a
servo does not rotate freely, but rather is
made to seek an angular position under
electronic control. They typically have a
movement range of 180 degrees but can go up
to 210 degrees.

A Servo consists of a motor, gearbox and some
sort of angular sensor to indicate its position. In
contrast to a regular motor, which is designed to
continuously rotate in complete circles, most servo motors are designed to only partially rotate
to a specific angle.

The servo motor receives a pulse (a 5V signal for a set amount of time) from the Arduino and
rotates to a certain angle based on the length of the pulse.

The servo motor expects to see a pulse every 20 milliseconds (ms) and the length of the pulse

will determine how far the motor turns.

For example, a 1.5ms (1500 micro- The length of the pulse, or “Blink”, determines
seconds) pulse will make the motor turn the angle the servo motor will go to.
to the 90-degree position. If the pulse is
shorter than 1.5 ms, then the motor will A 1.5 millisecond (1500 microsecond) blink will
turn the shaft to closer to 0 degrees. If the set the servo to 90°.
pulse is longer than 1.5ms, the shaft turns
closer to 180 degrees. The total pulse phase (i.e. – the HIGH + LOW)
should equal 20 milliseconds (20000
microseconds)

CIJE | Unit 16: Servo Motors & Ultrasonic Sensors 215

Principles of Engineering

Exercise

Wiring

Think about where you will attach the servo to the Arduino. Based on the information above,
should you use Analog or Digital pins? Look at the three wire cable attached to the servo. Where
should you attach the servo to the Arduino? Red and black/brown wires almost always refer to
what connections?

Hint: the Servo motor comes with a
standard 3 pin connector. On the Arduino
board, directly beneath the female digital
pins, are rows of 3 male pins. Those pins
are meant to be in line with the female
connectors of the servo motors.

1. Reading the above paragraphs, try and connect #include <Servo.h>
the servo to the Arduino board. Upload the Servo myservo;
following code. void setup()
{
2. Edit the code so the servo stays static at 45
degrees. myservo.attach(13); //pin
}
3. Add a potentiometer to your circuit, as shown void loop()
in the diagram below, and open the example {
code in the Arduino software under File >
Examples > Servo > Knob. See what the knob myservo.write(90); //angle
can do. Note how it is possible to construct delay(50);
the circuit without a breadboard using the }
female wires and the male pins on the
Arduino.

4. What does the "map" function in the code do?

_______________________________________________________

________________________________________________________

5. What are some advantages and disadvantages to using a servo motor
over a standard motor?

________________________________________________________________________

________________________________________________________________________
6. Name 3 devices you see everyday that would use a servo motor.

________________________________________________________________________

216 Unit 16: Servo Motors & Ultrasonic Sensors | CIJE

Principles of Engineering

Choose one of the following activities

The following four lines are the only required lines of coding to operate the servo,
however, they must be pasted into the proper locations of the code

1) #include <Servo.h> //above void setup
2) Servo myservo; //above void setup
3) myservo.attach(pin); //in void setup
4) myservo.write(angle); //in void loop

7. Windshield Wiper Design: Using a button and a servo motor, design a circuit and code so
that pressing a button will cause the servo to "wipe clean" a windshield (rotate back and
forth one time).

8. Create a “sun catcher” by placing a light sensor on the end of a servo motor arm. The
servo should search for the sun by rotating the photoresistor until it senses the most
amount of light and then stop there, pointing at the sun.

9. Challenge: Using 3 buttons and a servo motor, design a system whereas pressing one
button will cause the windshield wipers to clean intermittently (once every 5 seconds),
one button will cause them to clean continuously, and one button will cause them to turn
off. Ideally you should not have to hold down the buttons during operation of the wipers.

10. Challenge: Pretend you are a doctor doing a remote surgery, where the potentiometer
is your joystick and the servo is the remote scalpel. Edit the "knob" code (from question
3) so that if you accidentally turn the potentiometer too fast (i.e. – flinch), the servo will
not follow your command but instead hold its position until you return the potentiometer
and move it slowly.

CIJE | Unit 16: Servo Motors & Ultrasonic Sensors 217

Principles of Engineering

Lab: Combining Codes - Auto Batter
Background

In this lab, you will be utilizing two of the sensors you have previously worked with, the servo
and ultrasonic distance sensors. The goal of the lab is to create a 'batter' by attaching a stick or
straw to the servo motor, and use the ultrasonic sensor as 'eyes' to determine precisely when to
swing the servo to hit an object rolled towards it.
Both sensors should be plugged into the same Arduino, and only one code needs to be written.
Use the codes from the previous labs to create one code that will incorporate both sensors.
An Arduino code can have only one 'void setup' and one 'void loop'.

Procedure

1. Attach the servo and ultrasonic distance sensor to the Arduino as done in previous
experiments.

1

2

2. Open the code for the servo motor and the ultrasonic distance sensor.

3. Merge the servo code into the ultrasonic sensor code by copying only the lines that are
necessary to operate the servo. The following four lines are the only required lines of
coding to operate the servo, however, they must be pasted into the proper locations of
the code.

5) #include <Servo.h> //'pin' is the pin # the servo is attached to
6) Servo myservo; //'angle' is the angle the servo will travel to
7) myservo.attach(pin);

8) myservo.write(angle);

4. Use an 'if' statement to control the servo based on how close the object comes to the
ultrasonic distance sensor.

5. The servo should be activated to the 'bat' away the object before it can hit the ultrasonic
sensor.

218 Unit 16: Servo Motors & Ultrasonic Sensors | CIJE

Unit 17:
Data Types,
Arithmetic &
Functions

Principles of Engineering

Section 1: Data Types - int, float, and more

Recall from previous sections that variables are containers of memory for data. There were
three aspects to any variable: the data type, the name of the variable, and the value stored
inside the container. Until now we have only worked with the integer (int) data type, but if we
were to only use variables of type int, we would severely limit the kinds of systems we could
build. In the next sections, we will examine how to use other types and thus greatly expand the
potential reach of our designs.

In this first section, we are going to look at some of the more commonly used data types. These
are included in the table below.

Name Symbol Examples Declaration Example
integer int 3,0,-157, 6354 int myInteger = 987;
character char a, A, !, j, ? char myChar = 'a';
decimal float 2.1, -64.345 float myFloat = 4.50;
boolean bool true, false bool myBool = true;

➢ int

The first data type has already been used extensively. Recall that when we declare any variable,
we must include the type, the variable name, and the initial value.

➢ character

The next type is a single character. A character is defined by putting the character in single
quotes. Here are some examples of INCORRECT cases,

char myChar = "a"; INCORRECT: can't use double quotes
char myChar = 'ab'; INCORRECT: can only have one character in quotes

➢ float

After characters, we have decimal numbers. Until now we have only dealt with integers. If we
want to create a variable that will store decimal numbers, we need to declare a float, which is
short for floating point number.

➢ boolean

Finally, we have boolean numbers. A boolean is a variable that can only take one of two possible
values, true or false, and nothing else! A boolean is named for George Boole, who is one of the
founders of modern logic and computation. This data type is very useful when we are using
conditionals such as the test conditions in if/else statements. Boolean variables can be declared
as true/false or as numbers.

bool myBool = false; // myBool is set to false
bool myBool = 0; // myBool is false, 0 is equivalent to false
bool myBool = true; //myBool is set to true

220 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

bool myBool = 1; //myBool is true

bool myBool = -345; //myBool is true

The last example shows that any non-zero value will be considered true! If the variable is not
zero, the computer will set the value of the variable to true (i.e. 1).

Integers and Their Siblings

Integers (meaning the whole numbers and their negatives, not the data type int) are the most
important kind of number we use when working with computers. Much of this has to do with the
physical structure of the processor and memory. Given integers importance in computation, it is
not surprising that there are different types of integers. The key distinguishing feature between
the different types of integers is the size of the maximum number the variable data type can hold.
We will focus on three main types of integers—int, long, and char.

Data Type/Symbol Range Number of Possible Integers

int* -32,768 to 32,767 65,536

long -2,147,483,648 to 2,147,483,648 4,294,967,296

char -128 to 127 256

*Note: The data type int will not be the same across all computers; however, these are the correct
limits for the Arduino UNO and other ATMega328-based boards.

As we can see, there is a large difference in the number of possible integers between the different
integer types. In each application, we need to make sure that we are using a data type that is big
enough to contain our largest possible value, BUT, we don't want to declare everything as a long
because data types that can hold larger integers (unsurprisingly) take up more memory. When
we are working with microcontrollers like the Arduino, we will quickly run out of memory if we
declare everything a long.

Which data type would be best for the following variables?

1. A variable to hold the number of people attending a Dallas Cowboys game?

2. A variable to hold the number of children a mother has?

3. A variable to hold the number of people at your high school?

Since Cowboy's stadium can hold upwards of 100,000 people, we can't use int since it will likely
be too small. We can use a long integer. One possible example of the variable declaration is:

long numDallasAttend = 0;

The best integer type to use for the number of children is a char. No (human) mother will ever
produce more than 127 children. An astute reader will notice that we previously have used char
for character data, and this is still correct. When you store a value in a char, the computer
converts the character 'a' into a specific integer value. Later in the text, we will study exactly how
this works, but for now we simply need to understand we can store any integer from -128 to 127
in a char. One possible declaration is,

char numChild = 0;

CIJE | Unit 17: Data Types, Arithmetic & Functions 221

Principles of Engineering

For the number of students, an int will be the best choice. Most schools have more than 127
students, but none have more than 32,000 students (though many universities do). An int is a
good choice here.

int numHSStudents = 0;

Unsigned Integers

All the integer types above can take positive or negative values. However, there are many times
that there is no logical way for the variable we are interested in to be negative. Some examples
are counting people, or keeping temperatures in Kelvin. Can you think of others?

If a number cannot be negative, we can tell the computer that the variable will be unsigned. This
has two major benefits. One, it prevents us from accidentally assigning a negative number to a
variable that should never be negative. Two, most importantly it allows us to double the size of
the maximum positive integers. To declare a variable as strictly positive, that is, unsigned, we
simply type unsigned before the variable type.

Here are the unsigned versions of the integer types listed above,

Data Type/Symbol Range Number of Possible Integers
unsigned int 0 to 65,535 65,536
unsigned long 0 to 4,294,967,295 4,294,967,296
unsigned char 0 to 255 256

Note that the overall number of possible integers doesn't change between signed and unsigned
variants, but the maximum positive integer does. This is because the signed and unsigned types
take up the same amount of memory in the computer.

In the previous examples, we created signed variables for counting. In each of these cases we
could have also declared them as unsigned. For example,

unsigned long numDallasAttend = 0;

In all of the above cases, choosing unsigned over signed wouldn't change performance, and using
either version would be acceptable; however, unsigned types would have the advantage of
preventing an error of accidentally assigning a negative integer to the variable.

In summation: Anytime a variable is declared, the programmer must carefully consider the largest
value the variable could take and make sure the type that is chosen can hold this value.

The obvious next questions are what determines the size of the type (i.e. why does char only hold
256 values) and what happens if a number larger than the maximum size is written to the
variable. Answering these two questions is the goal of the next section.

222 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

Lab: Data Types

1. For the following numbers, label which of the data types mentioned in this section we
would use to most efficiently store it, and the symbol we would use to declare it:

Note: Like most areas of coding, there are often multiple solutions to one problem.
With variable type selection, often the nature of the information, not just the value of
it, can be used to determine the variable type. Where not clear, hypothesize as to the
nature of the information being stored.

Value Name Symbol
23 integer int

45

2,000,000,000

4,000,000,000

6,000,000,000

5.76

65,536

127

128

true

A

97

4,294,967,000

-300

0

35.34

35.00

CIJE | Unit 17: Data Types, Arithmetic & Functions 223

Principles of Engineering

Section 2: Data Overflow (optional)

In this section, we will introduce some of the key concepts regarding how numbers are stored
and used in computers. This material is important for any student seeking an in-depth
understanding of computation and programming.
To understand why a char can only take 256 different values, we need to understand how a
computer stores data. Fundamentally a computer is an enormous number of switches connected
by wires. Think about any standard light switch. How many possible values does it have? Up and
Down. On and Off. 1 or 0. Switches like these are binary, meaning they have two possible values.
The type of switch in a computer is called a transistor.
Previously, we have seen what happens when you declare a variable. For instance,

unsigned char numSiblings = 5; //number of siblings

The computer takes the number 5 and stores it as an equivalent set of 1's and 0's. That is it takes
a base-10 number (the numbers we usually work with in our lives), 5, and converts it into a binary
(base-2) number. The point of this discussion is not to teach you how to convert numbers to
binary, but rather to get you to understand that the computer converts all numbers into 1's and
0's.
To understand how the size limits of the different data types emerge let's look at a binary system
we are all familiar with, coins, where a coin can either be heads-up (H) or tails-down (T).
If we have one coin, how many possible outcomes are there? Two.

Now if we have two coins, how many possible outcomes do we have? Try to list them all. Here
order matters, HT is not the same as TH since they are two different coins (just as 53 and 35 are
not the same number).
What are the number of different outcomes if we have three coins? Try to list these as well before
looking at the graphic below.

224 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

From here we can see the pattern. Every coin we add doubles the number of outcomes! We see
that with 2 coins I get 4 (2*2 or 22), and with three coins I get 8 (2*2*2 or 23). How many possible
combinations would you get with 4 coins?
Let's return to computers now. A char is composed of 8 different binary numbers. Each individual
binary number is referred to as a bit. In fact, 8 bits has a name, a byte, which is a common
measure of memory size. To clarify, let's look at an unsigned char variable that is storing the
number 153.

153 in binary is B10011001 (the B is to indicate it is a binary number). Again, how to convert is
not important for this discussion, merely that a char is an 8-bit container. So how many different
numbers can I store in 8 bits? The number of possible combinations of 1's and 0's that can be
held by 8-bits. This is exactly the same as asking how many different combinations of heads and
tails I can get with 8 different coins. We know the answer to this, 28 possibilities, which is 256.
Doesn't this number look familiar from the table in the previous section?
From here it is short work to the other type of integers. The int type is 16-bit (for the Arduino
UNO). How many possible combinations? 216 of course! The type long is 32-bit so it has 232
possible combinations.
Overflow:
Finally, let's look at what happens when you assign a number to a container that is larger than
the maximum value the container can hold. Assigning a variable beyond the max value causes it
to overflow.

CIJE | Unit 17: Data Types, Arithmetic & Functions 225

Principles of Engineering

Here we have declared an unsigned char named charTooBig and assigned a value of 375 to it.
Then we print the values of this variable in decimal and binary format by including a format
identifier after the variable name in the Serial.println() command. DEC will print a decimal
number and BIN will produce the binary representation (if we don't include a format identifier
then the default is DEC).
Here we have assigned a value larger than the maximum value of an unsigned char,255. This is
what the serial monitor will print,

DEC: 119
BIN: 01110111
Clearly, this isn't what we wanted! Let's look more in detail at what happened.
Recall that numbers are stored on the computer in binary form. The binary representation of 375
is (use a search engine for the conversion for now),
DEC: 375
BIN: 0101110111
Compare the binary numbers for 119 and 375. Notice that 375 needs more than 8-bits (9 in fact).
When we tried to store a value that was too large in the container, the binary number was simply
cut off after 8-bits (a byte). It was truncated with the result being 119.

As we can see, the container size doesn't change. It will only store the number up to the maximum
number of bits it has and will discard the rest. So again, when declaring a new variable, the
programmer should make sure that the size of the variable is appropriate.
One very common source of overflow errors is when we are doing arithmetic on variables. If you
have a char that has a value of 255 and you add 32 to it, what happens? Overflow!

226 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

Section 3: Arithmetic

In every computer, the processor performs just a few basics operations on data. These are
addition, subtraction, multiplication, division, and comparison. As we can see, arithmetic forms
a basic part of how computers work. For instance, computer graphics, whether in video games
or streaming videos, are created by doing millions (or even billions) of arithmetic operations per
second. There is no escaping math if we are to do computer programming. However, except for
some specialized fields like scientific computation and graphics, the math rarely exceeds the high
school level!

Addition and Subtraction

Here is an example that adds 2 to a variable and prints the result to the serial monitor. Run the
code to see what happens.

Here an integer variable named addValue is created and initialized to 0. In loop(), we add 2 to to
addValue and put the new result back into addValue overwriting the old value. We then write
this result to the serial monitor and add a delay to make it easier to read.
Unsurprisingly, the way to add a number to another is to use the + sign. But let's look in more
detail at what on first glance may look strange,

addValue = addValue + 2;

The most important thing to understand is that the computer does the right-side first. So it takes
the current value of addValue and adds 2 to it. Then it puts this new value back into the variable
container, erasing the old value. One way to see this might be,

addValue (new) = addValue (old) + 2;

Let's follow this code two times through the loop to see what is going on. At the beginning, before
we enter loop() for the first time, addValue=0. Once we enter loop() , the computer will do,

addValue = (0) + 2;

addValue is now equal to 2. We write to the serial monitor, then wait 300 ms. Now we go back
to the top of loop(), and the computer will do,

addValue = (2) + 2;

So addValue is now equal to 4, and we would continue to increment addValue by 2 each time
through the loop.
Subtraction works essentially the same way, this code,

CIJE | Unit 17: Data Types, Arithmetic & Functions 227

Principles of Engineering

valueNow = valueNow - 3;

would subtract 3 from a variable name valueNow.
We can also add variables to each other. Below is a program that reads two analog sensors and
adds the result,

Increment and Decrement Operators
Counting up and counting down are two of the most common operations that occur in computer
programming, so a shortcut was developed for these operations.
If we wanted to count up, we could use the line,

countVariable = countVariable + 1; //count up by 1

However, more commonly a programmer would use the increment operator,

++countVariable; //same as countVariable = countVariable + 1

Conversely, if we want to count down, we could use the line,

countVariable = countVariable - 1; //count down by 1

However, more commonly a programmer would use the decrement operator,

--countVariable; //same as countVariable = countVariable - 1

These two operators are likely found in upwards of 90% of programs, so even if a programmer
decides not to use it in their code, they will encounter these while working with example
programs.
One important point: there are actually two increment operators, ++i (prefix) and i++ (postfix).
These can create different results in certain situations. Since the behavior of the prefix version,
++i, is typically what is desired, we strongly recommend its use over the postfix version for now.
All of this applies for the decrement operator too. Therefore, we strongly recommend using the
prefix version, --i.

228 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

Multiplication and Division
Multiplication and division work largely the same as addition and subtraction. If we want to
multiply a variable by a number and store it in the same variable, we write,

valNow = valNow * 2; //multiplies valNow by 2 and stores the result

Division works the same way.

valNow = valNow / 2; //divide valNow by 2 and store the result

To calculate exponents such as squares and cubes, we simply repeat the multiplication or division
the appropriate number of times. For example, for a variable named valNow,

valSquared = valNow*valNow; //square of valNow
valCubed = valNow*valNow*valNow; //cube of valNow

Division with Integers versus Floats
It is very important to keep in mind when doing division with integers, if you store the result in
another integer, the numbers after the decimal will not be included, as the example below shows,

This code divides 15/4 and stores the result. These are two integers, but the result is not an
integer. We all know that the answer of 15/4 is 3.75. But, if you compile and run this code you
will see the results are,

divideInt = 3 and divideFloat = 3.75
Because of the way that integers are stored by the computer, any decimal remainder is lost.
Notice that the number is not rounded! It is cut off. If you store 3.1 in an integer container, it
becomes 3. If 3.999999, it becomes 3.
Let's repeat: computers do not round!

CIJE | Unit 17: Data Types, Arithmetic & Functions 229

Principles of Engineering

If you want to keep the decimal remainder in a number, then you must store it in a float as we
did in the code above.

Shorthand for Arithmetic Followed by Assignment

Similarly to incrementing/decrementing, there is a shorthand for arithmetic followed by an
assignment operator. For an integer variable valueNow,

valueNow = valueNow + 3;

can be shortened to,

valueNow += 3;

Again, we don't have to use this shorthand, but it will occur frequently in other programmer's
codes.
Below is a table demonstrating these shorthands using an integer valueNow as an example,

Shorthand Is Equivalent To
valueNow+=1; valueNow = valueNow + 1;
valueNow-=1; valueNow = valueNow - 1;
valueNow*=1; valueNow = valueNow * 1;
valueNow/=1; valueNow = valueNow / 1;

230 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

Lab: Arithmetic

1. If we change the variable addValue in
the following from an integer to an
unsigned char, what would happen?

________________________________
________________________________

________________________________

2. How could we change the code to use
addition shorthand notation?

________________________________________________________________________

3. Will the following code turn on an LED in pin 13, or will the LED remain off? Try to
predict the behavior by reading the code.

______________________________________

______________________________________
______________________________________

4. Compile and run the program to see if you are
right.

5. If it doesn't turn on, adjust the value of value2
so that it does. If it does turn on, change
value2 so that it doesn't.

6. The cutoff of the remainder when dividing
integers is not necessarily a bad thing. Can you think of an example where this behavior
might be used advantageously?

________________________________________________________________________
7. What are four ways to add 1 to a number in coding?

_______________________________ _______________________________

_______________________________ _______________________________

8. For each of the following, indicate what will print on the screen if you serial print ‘x’:

int x = 3.75; _____ float x = 7/2.3; _____ int x = 2*1.5; _____

float x = 7; _____ int x = 3.2; _____ int x = 7/2.3; _____

CIJE | Unit 17: Data Types, Arithmetic & Functions 231

Principles of Engineering

Section 4: Arduino Functions

Up to this point, we have used a limited number of the built-in functions in the Arduino language;
however, there are many more. Anytime we have a question about the Arduino language the
first place we should look is the main Arduino reference page.
To locate the Arduino reference page, in the Arduino IDE, navigate to Help > Reference. This will
open the following page in your default web browser (the internet is not required),

The reference is organized into three columns: structure, variables, and functions. In the
structure column, we have things like what is the format of the if/else statement or what does a
comment look like. The variables section tells us what data types we have available to us and
what constants are declared. But the column that will likely be the most useful is the functions
column. This will tell us how to correctly use the built-in functions of the Arduino language.

Reference Example 1: digitalWrite()

Look up a function you are already familiar with. In the Arduino reference, click on digitalWrite()
near the top of the functions column. This will open the top part of the reference page,

232 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

Every function reference will contain six parts,
1. Description of the purpose and behavior of the function
2. The syntax, i.e., how do we write the function correctly
3. The parameters the function needs, i.e. the inputs
4. The returns, i.e. the output
5. Examples and Notes
6. See also, for additional related information

Once we understand what the function does, to correctly use the function, we must focus on
parts 2 – 4 of the reference.
Part 2: Syntax

The syntax tells us how to write the function in code
and tells us the number of parameters that the
function requires. The order of the parameters must
be maintained.
Of course, the next question is what is pin and value? To answer this, we look at the parameter
section.
CIJE | Unit 17: Data Types, Arithmetic & Functions 233

Principles of Engineering

Part 3: Parameters
The syntax section told us what parameters we needed but
didn't define them. This is done in the parameters section.
Here pin is the pin number we want to turn on and off and
value is either HIGH or LOW.

Part 4: Returns
In the analogRead() section, we saw that if a function
returned a value then we had to put it somewhere (handle
it). Part 4 of the reference page will tell you if you need to do

this. For digitalWrite() we see that there are no returns (that is digitalWrite() returns a void).
This means that we can just write the function name with the correct parameters on a line by
itself.
So a correct use of digitalWrite() in an Arduino program would look like:

digitalWrite(12,LOW);

Reference Example 2: analogRead()

Now let's look at another function that we have used previously, analogRead(). The reference
sheet gives us the following information,

234 Unit 17: Data Types, Arithmetic & Functions | CIJE

Principles of Engineering

The syntax section tells us that analogRead() take one parameter, and the parameters section
tells us this is the pin number we wish to read. The big difference between digitalWrite() is that
analogRead() has a return value.
In the analogRead() section, we saw that functions that have outputs must put that value into a
variable container. The reference for analogRead() tells us that there is an integer output when
we call the function. In fact, it tells us that the value will be between 0 and 1023.
A correctly implemented version of this function could be:

int valNow=0; // best declared in global variables
valNow = analogRead(A0); //almost always inside loop()

It is important that we declare the variable container for the output as the correct type! If the
output is a ‘long’, for example, then using an ‘int’ type will very likely lead to errors. This applies
for all types of returns. Since analogRead() produces a maximum value of 1023 and a minimum
of 0, we can use an int (min value= -32,768 and max value= 32,767) but a char won't work. We
could also use long but remember that this takes up more memory and is completely unnecessary
for handling analogRead() output.
The number of functions in the Arduino language are relatively few. By using the Arduino
reference page, we can determine how to correctly write the parameters and outputs to
appropriately implement the functions.

CIJE | Unit 17: Data Types, Arithmetic & Functions 235

Principles of Engineering

Lab: Arduino Functions

1. Complete the following table using the Arduino reference page. The first two functions
have been completed as an example. Use void to indicate no input or output.

Function Name Input(s) Input Data Output Implementation Example
digitalWrite() digitalWrite(8,LOW);
analogRead() Pin number, Type(s) type(s) val = analogRead(A3);
HIGH/LOW
int, boolean void
Pin number
int int

millis()

micros()

map()

abs()

sqrt()

constrain()

cos()

max()

tone()

noTone()

2. When implementing the millis() command, the output must be stored in a long rather
than an int. Why is that?

________________________________________________________________________

3. Wire an external LED to digital pin 11 (using a resistor). Generate a random number, using
the random() function, and use that number to randomly change the brightness of the
LED every 100 milliseconds.

4. Challenge: Wire three lights to three separate Arduino pins (a green light with a red light
on each side), and a potentiometer to an analog input pin (the two outer pins of the
potentiometer are connected to 5V and ground, and the center pin is connected to the
analogRead pin).
Create a game whereas the Arduino selects a random “location” for the potentiometer to
get to, and the two red lights indicate if you need to turn the potentiometer left or right
to get there. When the potentiometer is in the correct location the green light turns on
and the serial monitor prints how many milliseconds it took to get there.

236 Unit 17: Data Types, Arithmetic & Functions | CIJE

Unit 18:

Entrepreneurship

Principles of Engineering

Preface

This unit deals with the subject of entrepreneurship. The goal is to open your eyes to the issues
and question an entrepreneur must be aware of and willing to answer. The unit will also
introduce basic economic principals and help you better understand what financial principals are
used in determining the viability of a startup. It will also help you better understand what
financial obligations and costs are associated with a startup.

Unit Sections:

➢ Ideas
➢ Business Plan
➢ Worksheet: Business Plan
➢ Economics
➢ Worksheet: Economic Terms
➢ Profit
➢ Worksheet: Making a Profit
➢ Lab: What Effects Pricing?

Later units include

➢ Design process
➢ The Pitch

Learning Objectives

Following this unit students will be able to:
➢ Identify questions and concerns an entrepreneur needs to answer
➢ Explain and be aware of issues an entrepreneur with a startup will face
➢ Have a better understating of what it takes to start a company
➢ Have greater depth of understanding of the financial obligations an entrepreneur
undertakes

238 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

Idea

• What type of business

Business plan

Economics

• Maximize Profit

Risk

• Risk Assessment and Mitigation

Market Research

Design Process (Unit xx)

Pitch (Unit xx)

• Powerpoint

Section 1 - Ideas

While often a business starts with an idea, it can also start from an entrepreneur knowing what
type of business they are looking to start. For example:

A. What kind of business would you start if your family would lend you $5000?
B. What kind of business would you start if you and two classmates had access to a loan for

$100,000?
C. What kind of business could you start if you want to do business with another country?
D. What type of business could you start while still going to school?
E. What type of business could you start using the skills you have now?
F. What type of business could you run while also working in a part time job?
G. How could you start a business and then later make it into your own franchising business

for purposes of expansion?

CIJE | Unit 18: Entrepreneurship 239

Principles of Engineering

Section 2 - Business Plan

The business plan is a tool to help you find and explore opportunities.

Students at any level of education can use the concept of preparing a business plan as a method
of exploring all kinds of ideas for starting a business. It is merely a series of questions that lead
you to think about the requirements and the possibilities of any kind of business. Until you start
to ask these questions, you cannot visualize the details necessary to be successful in a business.

There are many different approaches to writing a business plan, some more complex than others.
But the basic components of a business plan can be organized as follows:

➢ Providing a description of the business
➢ Choosing the best marketing strategy
➢ Identifying the management plan
➢ Analyzing the finances needed to start the business and make it successful.

➢ Why Develop a Plan?

The process of making choices is the most important reason for anyone to learn how to write a
business plan. It is fun to think of yourself as a business owner, to dream about your successes,
and to talk about your ideas. But when you have to answer the specific questions of a business
plan, you must make decisions about the direction your business will take…decisions that may
show you that this idea is not likely to be successful. But then you can go back and make different
decisions until you find a way to be successful. Once you are into the day-to-day operations of a
business it may be too late. But most banks value a good business plan when you are looking for
funds for your business.

➢ Business Plan Questions

The business plan is a tool designed to help you find and explore opportunities. It also provides
you with a way to analyze potential opportunities continuously. A business plan is personal and
should never be “canned” or prepared professionally by others. No one knows you or your ideas
better than you do. It is the process of seeking the answers to important questions about your
enterprise that are important as you try to realize the dream of owning your own business.

Use the following questions to make decision about a business idea of your choice.

1. How can you describe the business in only one paragraph please?
2. What is your product, or service?
3. Who will buy it?
4. Where should you locate the business?
5. How can you attract customers?
6. What is your competition?
7. How much should you charge for the products or service?
8. What advice do you need and who can provide it?
9. How will you organize the managers and/or workers of the business?
10. How will you split the profits? Who is responsible for the losses?
11. What should you consider to be able to produce the product and get it to the customer?
12. How much money is needed to get the business started?
13. How many customers will you have per month and how much will they buy per month?
14. How much does it cost to make the product or provide the service?

240 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

15. What are your operating costs? (Include your own salary)
16. How much money will your business earn each month by selling your product or service?
17. How much investment will you need to keep the business going until you make a profit?
18. What is your potential profit per year for Year I, Year II, and Year III?
19. How much money do you need to borrow to start this business?
20. How will you make the business grow in the future?

There are other questions you might ask depending on the type of business you have in mind.
There are many different formats for a business plan based on what you need for the business of
your choice. The point is to start asking yourself questions and then looking for the answers.

After developing your business plan, you will want to discuss your ideas with the class or an advisor
to improve your plan and determine what you learned in the process of preparing a business plan.
Now that you are thinking like an entrepreneur you may find these same questions pop up about
many different business possibilities as you experience new opportunities in life.

➢ Funding

Banks and other lending agencies often ask for a business plan to determine whether your
business idea has promise, but many entrepreneurs never write out their plans because they are
too busy or don’t really know how to.

For entrepreneurship educators, the business plan is the technology of preparation to run a
business. It forces the writer to make choices and decisions, and to look at the outcomes of
various approaches to running the business. A business plan will be quite different for a person
expecting to borrow money from the bank versus a grade school student creating a plan for a
money-making project. Despite the difference in sophistication, many of the same questions from
the list above must be answered.

➢ Operational Checklist

Make your more efficient by clearly documenting your process and explain how you do what you
do. Outline the important tasks that absolutely need to be done correctly. This document will be
a reference guide for everyone in your team/company to prevent confusion that possibly lead to
mistakes. As you write up your process document, you will likely discover areas for improvement
and clarification. Ask each team member to explain step-by-step how they do what they do and if
possible, draw up a checklist. The checklists and process documents should be clear and easy to
understand so that another person can reproduce the same result by following the checklist. In
addition, you should observe how they actually work and compare it to how they say they work.
Draw a process diagram with the “if-then” structure. If your design doesn’t seem to be popular
with people, then… If you are over budget, then… Discussing the process with your team will get
everyone to be on the same page and make the operation more efficient. The team you start out
with is small, but as you hire more people, a process document and operation checklist is essential
for managing a growing company.

➢ Example business plan for “The Good Ole Lemonade Stand”

Investors want to know the answers to two major questions: 1. How much profit can the business
make? 2. How much money do you need to get the business started and to keep it going until you make

a profit?

Below are answers to business plan questions from entrepreneurs opening a lemonade stand

CIJE | Unit 18: Entrepreneurship 241

Principles of Engineering

1. How many customers do you expect to attract during the 2 months? How much will they
buy?

Answer: We will count on an average of 5 customers an hour. We will be open 6 hours a day
for 2 months (60 days). Therefore, we can expect 1,800 customers over a 2-month period. If
they serve 6-ounce cups, they will sell approximately 1.41 gallons of lemonade a day, or 84.6
gallons in 2 months.

In addition, they expect to sell 5 gallons in bulk over the 2 months, or a total of 89.6 gallons.

2. How much will it cost to make that amount of lemonade?

Answer: After shopping around for the best prices, they found it would cost $7.39 per gallon:

24 lemons @ $.25 $6.00

1 lb sugar @ $.40 $0.40

21 6-ounce cups @ $.04 $0.84

food coloring and napkins $0.10

1/2 lb. Ice @ $.10 $0.05

Total Cost per Gallon $7.39

3. How much will you need to charge for lemonade?
Answer: With 1 gallon of lemonade, we can fill 21, 6-ounce cups (128 oz divided by 6 = 21.3
cups). It will cost $.352 to make a 6-ounce cup of lemonade ($7.39 divided by 21 cups = $.352
per cup).

They found that nearby competitors were charging between 50 cents for a 12-ounce soda and
89 cents for a 12 ounce lemonade. They had hoped to charge $.35 for a 6-oz cup. But since it
costs 35 cents to make a cup without adding expenses and profit, they decide to charge 60
cents a cup.

4. What will their total sales be at a selling price of 60 cents per cup?
Answer: 30 cups per day X 60 days X $.60 per cup = $1080

plus 5 gallons @ $8.00 per gallon = $40 Total sales will be $1,120

5. How much will the lemonade ingredients and other items cost?
Answer: (89.6 gallons X $7.39 per gallon = $662.14)

Cost of goods sold = $662.14

6. What is their gross profit?
Answer: (“Estimated sales” = $1120 minus “Cost of goods sold” = $662.14)

This leaves $457.86 for the “Gross Profit”

7. What are their operating expenses?
Answer: They plan to pay a small wage to the person working the stand (50 cents per
hour). They will need advertising posters for the stand. They estimate operating costs at (360
hours X $.50 = $180) plus posters (4 posters @ $1.00 = $4.00).

Total operating expenses = $184.00

8. How much is their net profit?
Answer: (“Gross profit” = $457.86 minus “Operating expenses” = $184.00 equals $273.86
“Net Profit”)

After subtracting the operating expenses from the gross profit, they will have $273.86.

242 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

Worksheet: Business Plan

Base your answers to the following questions on the business plan for “The Good Ole Lemonade
Stand” on the previous page
1. How would the profit be different if they decided to use half as many lemons in their recipe

for lemonade?

____________________________________________________________________________
2. What would their profits be if they could sell the lemonade for $1.00 per cup?

____________________________________________________________________________
3. What price do you think would be the best for them to charge for lemonade? Why?

____________________________________________________________________________
4. What happens if their customer estimate is wrong and they only have half as many lemonade

customers? What will their new profit be?

____________________________________________________________________________
5. What was their biggest assumption in their business plan?

____________________________________________________________________________
6. How would the “Cost of Goods Sold” be changed if they had to account for the value of

inventory left over at the end of your accounting period? They assumed that all the lemonade
would be sold in this example.

____________________________________________________________________________
7. Complete a similar financial analysis for one of the following businesses (or your own) by

answering the questions below:
selling homemade jewelry, doing car repairs, selling flowers, selling breakfast items
before school, etc.

a) How many customers do you expect to attract during the 2 months? How much will
they buy?

______________________________________________________________________
b) How much will it cost to make your product? Provide a breakdown for each part.

______________________________________________________________________
c) How much will you need to charge for the product?

______________________________________________________________________
d) What will your total sales revenue be at that price (total money brought in)?

______________________________________________________________________

CIJE | Unit 18: Entrepreneurship 243

Principles of Engineering

e) What will the gross profit be (income after subtracting the cost of the goods)?
______________________________________________________________________

f) What are your operating expenses?
______________________________________________________________________

g) How much is your net profit (gross profit minus expenses)?
______________________________________________________________________

8. Produce a 6-minute PowerPoint to pitch your business plan to a bank for funding.
9. For each of the ideas below, match it to the type of business from the list on the right

A. _____ Lemonade stand 1. A business you would start with $5,000
B. _____ Refreshment stand at local games
C. _____ Child care 2. A business you would start with
D. _____ Hot dog stand $100,000
E. _____ Yard care
F. _____ Developing a web page for others 3. A business you would start if you want
G. _____ Youth community center to do business internationally
H. _____ Shopping service for seniors
I. _____ Pet sitting 4. A business you could start while still
J. _____ Delivery services going to school
K. _____ House cleaning service
L. _____ Janitorial services for local businesses 5. A business you could start while also
M. _____ Selling used clothes working part time
N. _____ Jewelry making
O. _____ Catalog sales 6. A business you could start and then
P. _____ Temporaries agency later franchise
Q. _____ Computer service business
R. _____ Add value to an existing product

(packaging, different size, etc.)
S. _____ Travel services
T. _____ Musical group
U. _____ Repair services (shoes, electrical

equipment, cars, clothing, etc.

244 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

Section 3 - Economics “Language”

The market for any product or service is composed of many consumers. These consumers are
people or organizations that are willing to buy your product and/or service. Business
organizations sell their own products or service, but they are also major consumers of other
businesses. For example, if you are selling trucks, you may target business owners as your market
for the trucks. Most of your marketing activities will be focused on those types of businesses that
use trucks in their operations. And most of your consumers in your market niche will be those
business owners.

The price you charge for your products and services will depend on several factors. First you need
to be sure to be able to cover the costs of providing those items to consumers. Some of these
costs are fixed and do not change no matter how many items you sell. These items include rent,
insurance, a truck for deliveries, and the owner’s salary. Other costs are variable, that is the
number you must buy, adding to your costs, vary with the number of items you produce or
sell. These items might include packaging materials, production workers’ salaries, and shipping
charges.

When considering the potential success of your business you must think of the law of supply and
demand. This means the number of items like yours that are available to the market (supply) and
the number of consumers who are in the market for this product (demand).

When the supply is scarce and there is a great need for this product or service in this particular
market, you say that the demand is higher than the supply. When this is true, those who already
produce this product can charge a high price for it. People will pay a lot for it if they really want
it. It can be said that the demand is high.

Under these circumstances entrepreneurs often see an opportunity to introduce a new product
that fills this same need for the consumer. Or they may merely find a way to increase the supply
of the same product or service. In any event, now they have increased the supply of the product
for the consumers. The suppliers now find that they cannot charge such high prices because there
are more competitors for the consumer’s money. In this case the supply gets higher and the price
gets lower.

When supply gets too high for the demand, business owners drop prices to attract
consumers. Businesses work hard to make enough sales to cover their costs and then make
a profit. Some companies may even be forced to go out of business if consumers do not buy from
them at a price that will cover their costs and make a profit.

Businesses also must try to keep their costs as low as possible to make a profit. One of the highest
costs of providing a product or service is the cost of workers. Human capital is the economic term
for those people that produce a product or service. An increase in the amount of work produced
by the workers without an increase in pay leads to an increase in productivity for the business. The
resulting high productivity keeps the costs per item low and helps increase profits for the
company.

CIJE | Unit 18: Entrepreneurship 245

Principles of Engineering

Worksheet: Economics Terms

Complete the sentences using the words that follow:

1. The ______________ is comprised of users, referred to as _______________. Efforts you

invest in trying to get them to purchase your product is called _______________.

market consumers marketing

2. Price is affected by _______________ and _______________. _______________ will

raise the price, while _______________ will lower it.

supply demand

3. An increase in ______________ will lead to an increase in ______________ and thus a

decrease in ______________. supply price
competitors

4. _________________ are the _________________ minus the _________________.

sales revenue gross profits cost of good

5. _________________ minus your _________________ are your _________________

operating expense net profits gross profits

6. Define the following expenses as fixed, variable, or one-time costs:

A _____ New office furniture

B _____ Rent

C _____ Trucks

D _____ Computers 1. Fixed

E _____ Phone Service 2. Variable

F _____ Gas 3. One-Time costs

G _____ Materials for product

H _____ Marketing

I _____ Owner Salary

J _____ Worker Salary

246 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

Section 4 - Profit

Understanding profit is essential to anyone interested in starting their own business. It is also
important for anyone who works in a business that seeks to make a profit. Much of the
misunderstanding about profit is related to a lack of understanding of the terms used in business
that explain financial decisions.

For example, return on investment (ROI) means the percentage you make each year on the
money you invest. If you put $10,000 in a savings account at the bank you will earn interest. If you
put that same $10,000 in stocks you will hope to earn dividends as well as have the value of the
stock go up to give you a return on your investment. Now, if you invest that $10,000 in your
business you will hope to be able to make even more as a return on your investment than just
putting it in the bank. In that case, you would expect to make an annual profit that is greater than
about $500 (5% of $10,000). After all, the higher the risk the greater return the entrepreneur
would expect for the investment.

Profit is not included in the amount of money a business owner pays himself/herself. Many new
entrepreneurs forget to count the costs of their time and take out a regular salary. Or when times
are tough the salary is the first thing they forget. Profit is not the difference between the costs of
the product or service and the price being charged for it. In addition to the costs of the product
sold, you must account for the fixed costs that are paid regularly each month no matter what.
These include such items as rent or mortgage payments, utilities, regular salaries, insurance, etc.

Next you must remember to plan for the variable costs of running the business that fluctuate with
the success of the business and resulting needs for advertising, staffing, supplies, etc. The fixed
costs and the variable costs together are known as overhead. Overhead, as well as the costs of
the products sold, is subtracted from the income from sales before profit can be made.

Finally, you must pay taxes out of the income before determining your profit from your business.
These include federal, state, and local taxes which are based on a percentage of your income
minus expenses.

After all these costs, the owners’ profit is what is left.

What are the decisions that affect profit? For any small business, there are many day-to-day
decisions that change the possible profit the business might make. For example, consider what
each of the following choices might do to your profit:

• Pay employees more
• Hire more employees
• Buy new furniture
• Buy a new truck
• Find a cheaper source of products
• Increase the advertising budget
• Give your daughter money to buy a new dress
• Select a cheaper long distance phone service
• Remodel your building

These decisions increase or decrease your cost of operations, affecting what is left as profit.

When deciding how to price the goods or services to be sold, the owner must take into
consideration the costs of all decisions made. Some decisions will result in higher sales which will

CIJE | Unit 18: Entrepreneurship 247

Principles of Engineering

more than make up for increased costs. It is thought that appropriate advertising will do this. Or
if you pay your employees more they may be willing to work harder and increase sales. However,
nothing is sure about these decisions and their effect on profits.
Business owners often decide to use a percentage of the product costs in determining their selling
prices. The percentage is based on distributing the costs of running the business (overhead) and
profits in an equal manner to all items sold, based on the product costs. This is called markup.
Think of markup as the share of the consumer’s price that is necessary to run the business, plus
what is left over as return on the owner’s investment. The markup on all the products sold, added
together, is designed to cover the costs of running the business and making a profit.
Business owners use past experience and experience of similar businesses to determine the
expected overhead costs and profit they hope to make. This is called their margin, the amount of
money available after the costs of products sold are deducted from the income from sales. If your
sales equal $1 million and your product costs are $200,000, your margin is $800,000. Remember,
this is not your profit.

Adam Tal Benzion has started three companies, including Hackster.io, and sold two. Here are his
thoughts on entrepreneurship:

“Entrepreneurship means different things to different people. In its purest sense, it means
that you're starting a business with products and services, customers and suppliers, profits
and losses. In Silicon Valley, it also means that you're doing all that in high speed, with
massive growth opportunities and while creating something new using software,
hardware, biotech, aerospace, etc. An important principle to remember when embarking
on an entrepreneurial career:
Profits sustain businesses, and even if you're planning on being venture backed for
years...you still need to have a clear vision of how you're going to pay for all that work.”
Investors are not only looking for ideas, they want to see a business that takes a good idea and
demonstrated their ability to turn the investor’s money into many times what it’s worth. Investors
want to see the whole package, not just the idea.

248 Unit 18: Entrepreneurship | CIJE

Principles of Engineering

Worksheet: Making a Profit

Example

Question:

Goodies Gift Shop in its third year of operation in Small Town USA. Amelia Goodies, the owner,
runs the shop with 4 full time employees, 2 part timers and herself. This year Amelia has projected
sales of $600,000 with a margin of $250,000. She has budgeted the following overhead:

Owner Salary $35,000
Employee Wages $100,000
Rent $10,000
Advertising $4,200
Supplies $1,000
Telephone $1,000
Other utilities $600
Insurance $2,000
Payroll taxes $30,000
Maintenance $3,700
Legal and other professional fees $500
Miscellaneous $2,000
Interest on Loan $10,000

Total Overhead Expenses $200,000

If taxes are 20% of Net Income, what is the planned profit for the year?

Answer:

If her sales are $600,000 with a margin of $250,000, that means her product only cost her
$350,000 to purchase, and she is planning on having $250,000 left over for expenses and profit.
Since her expenses are only $200,000, that leaves $50,000 for profit. After 20% to taxes, she is
left with $40,000 in profits.

The day-to-day decisions for the gift shop and the level of business Amelia is able to maintain will
affect this budget, resulting in many variations of the plan.

What effects would the following issues have on profit?

1. The employees demand a 10% raise, what will her new profits be?

_________________________________________________________________________

2. The lease is up on the building and the owner would like to sell her the building for
$150,000 or increase the rent to $15,000. If she pays the higher rent, what will her new
profits be? Does it make more sense to buy the building or continue renting? Why?

_________________________________________________________________________

3. Amelia is considering adding another full-time employee for an annual cost of $20,000.
What will that do to her profits? What will her new profit be?

_________________________________________________________________________

CIJE | Unit 18: Entrepreneurship 249

Principles of Engineering

4. If sales are great and she brings in $650,000, what will her profits be?
_________________________________________________________________________

5. If sales are poor and she only brings in $550,000, what will her profits be?
_________________________________________________________________________

6. Insurance coverage is too low and she needs to double it, can she still make a profit? How
much?
_________________________________________________________________________

7. There are new opportunities to advertise in connection with community events that would
expand her advertising budget. How much can she spend this year on advertising if she
concedes to make zero profit?
_________________________________________________________________________

For the following questions, no calculations are required in your answer
8. Shoplifting losses force her to increase her markup, and this the price, an extra 5%. Will

that help or hurt her profits? Explain.
_________________________________________________________________________
9. She is considering buying a used van for $10,000 and offering free delivery services to her
customers. Will that help or hurt her profits? Explain.
_________________________________________________________________________

250 Unit 18: Entrepreneurship | CIJE


Click to View FlipBook Version