Cartooino Project Book (Volume 1)
Cartooino Project Book (Volume 1)
Cartooino Project Book (Volume 1)
it ve
ac
e r
t
In
T
EN
D INO
T U U
S D
E
AR
N
O
o n
s-
n d
a
H
1
Acknowledgement
GreenLab
Cartooino
Acknowledgement
The cartooino Book is a comical
adaptation of the Arduino Projects Book.
The Book was developed by Greenlab
Microfactory for use for her “One student,
One Arduino” project. The essence of which
is to create a more relatable learning
approach for the participants. Therefore,
the Microfactory would like to acknowledge
Arduino LLC for their selflessness and
contribution to the body of knowledge by
fortifying the open source community
with their products and projects.
Lolia
In addition, Greenlab Microfactory will also
like to acknowledge that some of the content
of this book were derived and adapted from
the online platforms of Tutorials Point etc.
.
Disclaimer
This book was not created for commercial
purposes, and the contents of the cartooino
projects Book are licensed under a Creative
Commons Attribution -ShareAlike (CC BY-SA)
by Greenlab Microfactory. This means that
you can copy, reuse, adapt and build upon
the text of this book non-commercially while
attributing the original work(but not in any
way that suggests that we endorse you or your
use of the work) and only if the result are
Ayomide
transmitted under the same Creative
Common license.
Building a simple
circuit 02
Understanding the
program interface 03
Spaceship interface
04
YouNiversity 05
GreenLab
Cartooino
02
Introduction
Aliya
A regular pupil and a participant of the
One Student One Arduino Project
divine
A regular pupil and a participant of the
One Student One Arduino Project
Uncle green
Lead facilitator of theOne Student One
Arduino Project
GreenLab
Cartooino
03
Introduction
Faith
A regular pupil and a participant of the
One Student One Arduino Project
Emmanuel
A 400 level Student of computer science at
UNIBEN and a co-facilitator of the One Student
One Arduino Project
GreenLab
Cartooino
04
Maths teacher: X + Y= COS 30
0.324 X + Y=?
Maths class
was
interesting
2 4x but not as
much as the
kite
competition
34
o o l over
sch
school over
school ove
r
Are you not going Kunle I have to
to wait for the
run home because of the Maybe next time
football game?
Kite competition
05
Aisha what’s
that?
06
Hi, My Name is And that is called
UNCLE GREEN a Drone Built with
Arduino.
07
How high can
your kite
fly?
Nice
08
It will be
stressful
Should we go
join the Arduino
project with
Ayomide
Aliya remember
you have to tell And don’t forget
your mom to do your assignment
This place is
awesome
WOW
09
Meanwhile
Aliya jhorr
Aliya’s House
come and help me
in the kitchen
BUY
YOU
ICE B R
LOC
HER K
E
So ma,
Yesterday I was
introduced Aliya pass me the
to Arduino spoon
Can I stay
a little longer Just don’t
after school? stay too late
10
NEXT DAY
Episode 01
11
Getting to know your tool
Next Day
Hello kids, I am glad that you could
come today, i officially welcome you
to the “One student One Arduino” Project
Electricity is a type of
energy, much like heat,
gravity or light. Electrical
energy flows through conductors
like wire. You can convert
electrical energy into other forms
of energy.
Do you know that
What can electricity be Like In Our
one essential need
used for? Electric Bulb
is electricity
To watch TV
Electrical
Heat(thermal) energy
12
Getting to know your tool
More Examples of
Electrical energy Conversion Movement, heat and sound
energy
The components you might use to do Transducers change other types of energy into electrical
this is called electrical transducers. energy and vice versa.
Circuits are closed loops of wires with a power source (like a battery) and
something to do something useful with the energy, called a load.
15 14 13 12
16 11
17
10 9
1
8
3
4
2 6
5 7
1. Power USB- it gives power to the Arduino board power when you
connect the USB cable to the USB connection
2.Power(Barrel jack)
you can also power the board from AC mains power by connecting it to the
barrel jack
14
Getting to know your tool
Other parts of the
Arduino board are
15
Getting to know your tool
Arduino Reset -You can reset your Arduino board i.e, start your
program from the beginning. You can reset the UNO board in two
ways. The first, by using the reset buton (17) on the board.
Second you can connect an extenal
reset buttom to the arduino pin labelled RESET(5)
16
Getting to know your tool
Before we proceed
further, it is worthwhile
to read a resistor. How can we read
Resistors Let us look below
17
Getting to know your tool
Source:https://electronics.stackexchange.com/questions/119/6
-brand-resistors-which-way-should-the-bands-be-read.
18
We are a step closer to
real Fun. In order
to build your toys,
you will need to download,
install and setup the
ARDUINO IDE on your We are going to use your computer
computer.
Episode 1.2
Getting to know your tool-
How to Download, Install and set up
the Arduino IDE software
Am
Am
Interested
Interes-
ted
20
How to Download, Install and set up
the Arduino IDE software
With internet
STEP 1.
Now we want to download
the IDE, click the link-
https://www.arduino.cc/en/Mai
n/Software
21
How to Download, Install and set up
the Arduino IDE software
22
How to Download, Install and set up
the Arduino IDE software
Go to Tools
Board and select your
board
Step 5: Select your Arduino board. To avoid any error when uploading your
program to the board, you must select the correct Arduino board name, which
matches with the board connected to your computer.
23
How to Download, Install and set up
the Arduino IDE software
24
How to Download, Install and set up
the Arduino IDE software
25
How to Download, Install and set up
the Arduino IDE software
Resistors
This resist flow of electrical
in a circuit, changing the
Piezo voltage and current as a result.
This is an electrical Resistor values are measured
component that in ohms (represented by the
can be used to greek Omega character: )
detect vibrations The coloured stripes on the
sides of the resistors indicate
and create noises.
their value( see resistor colour
table)
What is that?
DC motor:
This converts electrical energy to
mechanical energy when electricity is
applied to its leads. Coils of wire inside
the motor become magnetized when
current flows through them
26
How to Download, Install and set up
the Arduino IDE software
Breadboard:
Though the name sounds funny but
it is a kind of bread that cannot be
chewed. A board on which you can
build electronic circuits. It’s like a
patch panel
#TIP
A resistor is a device that restrict the
flow of electric current in a system
27
How to Download, Install and set up
the Arduino IDE software
Push Button
It momentary switches that close a
circuit when pressed. They snap into
bread-boards easily. These are good
for detecting on/off signals
Here is a list
Now that
we have
described
each
lets get
started
Now you understand how
potentiometer works
28
How to Download, Install and set up
the Arduino IDE software
Good Question!
When we meet next I will explain
everything better for you
#TIP
29
How to Download, Install and set up
the Arduino IDE software
So we are almost
Done
H-bridge Photoresistors
so we can
start now
It is 4 0 Clock already
30
Practice Question
In Deep Environment
Internal Deep Escape
Integrated Development Environment
Integrated Device Environment
31
Episode 2
Building a simple circuit
32
Building a simple circuit
I am sure
that I will win
a medal or two
33
Building a simple circuit
35
Building a simple circuit
Series circuit
- Components in SERIES come one after another
To build this remove your power source, add a with next to the one already on
your breadboard. Wire them together in series as shown below. Connect the
LED cathode to ground, Power up the Arduino again. Now turn on the LED,
you will need to press both switches. Since these are in series, they both
need to be closed for circuit to be completed.
36
Building a simple circuit
Parallel Circuit
- Component in PARALLEL run side by side
To wire up switches in parallel, keep the
switches and LED where they are, but
remove the connection between the two
switches. Wire both switches to resistor.
Attach the other end of both switches to
the LED, as shown in the diagram on the
right hand side. Now when you press
any of the buttons, the circuit is completed
and the light turns on.
OK
What next.. Lolia push the button
if the LED will light up
We have now
gotten to the
end of our
project. During
this project
37
Practice Question
38
GreenLab
Cartooino
Episode 3
Understanding
the program
interface
39
Understanding the Program structure
40
Understanding the Program structure
hmmmm!
41
Understanding the Program structure
Unsigned int
Unsigned ints (unsigned integers) are the same as int in the way that
they store a 2 byte value. Instead of storing negative numbers, however, they
only store positive values, yielding a useful range of 0 to 65,535(2^16)-1). The
Due stores a 4 byte (32 bit) value, ranging from 0 to 4,294,967,295(2^32-1).
example
42
Understanding the Program structure
Char
A data type that takes up one byte of memory that stores a character value.
Character literals are written in single quotes like this ‘A’ and for multiple
characters , strings use double quotes: “ABC”. However, character are
stored as numbers. You can see the specific encoding in the ASCII chart.
This means that is possible to do arithemic operations on characters, in
which the ASCII value of the character is used. For example, ‘A’ +1 has
the value 66, since the ASCII value of the capital letter A is 65.
Example
Char chr _a = ‘a’ ://declaration of variable with type char and initialize it
with character a
Char chr_c = 97://declaration of variable with type char and initialize it
with characecter
Unsigned char
Unsigned char is an unsigned data type that occupies one byte of memory.
The unsigned char data type encodes numbers from 0 to 255.
Example
Unisigned Char chr _y = 121://decalaration of values with type Unsigned char
and initialize it with character y
Byte
A byte stores an 8-bit unsigned number from 0 to 255.
Example
Byte m=25;//declaration of variab;e with type byte and inialize it with 25
int
Intergers are the primary data-type for number storage int stores a 16-bit
(2-byte) value. This yields a range of -32,768 to 3,767(minimum value
of -2^15 and a minimum. value of (2^15)-1):
The int size varies from board to board. On the Arduino Due, for example,
an int stores a 32-bit(4-byte)value. This yields a range of -2,147,483,648 to
2,147,483,647 (minimum value of -2^31 and a maximum value of (2^31)-1).
Example
int counter =32 ;//declaration of variable with type int and initialize it with 32.
43
Understanding the Program structure
Operators
An Operator is symbol that tells the compiler to perform specific
mathematical or logical functions. The following are the types
of operators.
Arithmetic Operators
Assume variable A holds 10 and variable B holds holds 20 then-
Example
void loop () {
int a = 9,b = 4,c;
c = a + b;
c = a - b;
c = a * b;
c = a / b;
c = a % b;
}
Result
a + b = 13
a - b= 5
a * b = 36
a/b=2
Remainder when a divided by = 1
A - B will
subtraction - Subtracts second operand from
give -10
the first
% A * B will
multiplication Multiply both operands
give 200
B / A will
division / Divide numerator by denominator
an integer division give 2
Comparison Operators
Operator table
44
Understanding the Program structure
45
Understanding the Program structure
Bitwise Operators
Assume variable A holds 60 and variable B holds 13 then-
operator Operator Description Example
name Symbol
(A l B) will give
Binary OR Operator copies a bit if it
or l exists in either operand
61 which is 0011
1101
(A ^ B) will give
Binary XOR Operator copies the bit if is
xor ^ 49 which is 0011
set in one operand but not both.
0001
Example
void loop(){ Result
int a =10, b = 20; c=12
int c = 0; c=61
c = a & b; c=49
c = a l b; c=-60
c = a ^ b; c=240
c = a ~ b; c=15 Example
void loop(){ Result
c = a << b; int a =10, b = 20; c=12
c = a >> b; int c = 0; c=61
c = a & b; c=49
} c = a l b; c=-60
c = a ^ b; c=240
c = a ~ b; c=15
c = a << b;
c = a >> b;
}
46
Understanding the Program structure
Local Variables
These are variables that are declared inside a function or block. They can be used only by
the statement that are inside that function or block of code. Local variable are known to
function outside their own. Following is the example using local variables -
Void setup(){
}
Void loop(){
int x, y ;
int z ; Local variable declaration
x = 0;
y = 0; actual initialization
z = 10;
}
Global varibles
These variabls are defined outside of all the functions, usually at the top of the
program. The global variable will hold their value throughout life-time of your program.
A global variable can be accessed by any information. That is, a global variable is
available for use throughout your entire program after its declaration.
Void setup(){
}
Void loop(){
float c = 0 ; Global variable declaration
int x, y ; Void setup(){
int z ; Local variable declaration
}
x = 0; Void loop(){
y = 0; actual initialization int x, y ;
int z ; Local variable declaration
z = 10; x = 0;
} y = 0; actual initialization
z = 10;
}
47
Understanding the Program structure
{} ()
48
Understanding the Program structure
Boolean Operators
Assume variable A holds 10 and variable B holds 20 then-
Example
void loop(){
int a=9,b=4
bool c=false,
if((a > b)&& (b > a))
c= true;
else
c= false;
49
Understanding the Program structure
Compound Operators
Assume variable A holds 10 and variable B holds 20 then-
50
Understanding the Program structure
Example
void loop(){
int a= 10, =20
int c= 0; Booleans
a++;
a--;
b += a;
b -= a;
b*= a;
b /= a;
a %= b;
a l= b;
a &= b;
}
Result
a + 11
a=9
b=30
b=10
b=200
b=2
a=0
a=61
a=12
51
Understanding the Program structure
S/NO.
1. If statement
It takes an expression in parenthesis and a statement or block of statements. If the
expression is true then the statement or block of statemnt gets executed otherwies.
these statement are skipped.
2. If ...else statement
An if statement can be followed by an optional else statement, which executes
when the expression is false
5.
Conditional Operator ?:
If statement
It takes an expression in parenthesis and a statement or block of statements. If the
expression is true then the statement or block of statemnt gets executed otherwies.
these statement are skipped.
If ...else statement
An if statement can be followed by an optional else statement, which executes
when the expression is false
Conditional Operator ?:
52
Understanding the Program structure
#TAG
RESISTANCE (R)
IS A MATERIAL’S
OPPOSITION TO
THE FLOW OF
ELECTRIC CURRENT.
IT IS MEASURED My Elder brother has a laptop
IN OHMS. I will use it
When
When we meet
we meet nextnext
time we would build a
we would
spaceship be building
interface, and see how it works.
a spaceship interface
53
s 4
paceship interface
54
Spaceship Interface
55
Spaceship Interface
GreenLab
Microfactory This is going to be our
virtual lab where major
project will be carried out
what is a candence
It is a watch like
device that allows
change into your
What is a candence superhero outfits
Oh
56
Spaceship Interface
kids you will learn in this project how to to control things
with your Arduino. You will be making a control panel with a universal
switch and light that would be used to stop General ZOD With this
interface a green LED will be on until you press a button.
When the Ardiuno gets the signal from the button the
green light will turn off and two
others will start blinking this should
disable his plans
General ZOD
is evil inventor
that creates
mind freak robots.
His latest invention
I s set to hit lagos.
Who is general ZOD we have to stop his
plan.
The Arduino digital pins can read only two states: when there is voltage on an input pin and
when there’s not. This kind of input is normally called digital(or sometimes binary, for two-
stats). These states are commonly referred to as HIGH and LOW. HIGH is the same as saying
“there is voltage here!” and LOW means “there is no voltage on this pin!”. When you turn an
OUTPUT pin HIGH using a command called digitalWrite(). you are turning it on. Measure the
voltage between the pin and the ground, you will get 5 volts. When you turn an OUTPUT pin
LOW, you are turning it off. The Arduino’s digital pins can act as both inputs and outputs. In
your code, you will configure them depending on what you want their function to be. When the
pins are output, you can turn on components like LEDS, if you configure the pins as inputs,
you can check if a switch is being pressed or not. Since pins 0 and 1 are used for
communicating with the computer, it is best to start with pin2.
To proceed, follow the connection diagram above, wire up your breadboard to the Arduino’s
5V and ground (GND) connections, just like the previous project. Place the two red LEDs and
one green LED on the breadboard. Attach the cathode (short leg) of each LED to ground
through a 220-ohm resistor. Connect the annode (long leg) of the green LED to pin 3. Connect
the red LEDs’ anodes to pin 4 and 5, respectively.
Place the switch on the breadboard just as you did in the previous project. Attach one side to
power, and the other side to digital pin 2 on the Arduino. You will also need to add a 10k-ohm
resistor from ground to the switch pin that connect to the Arduino. That pull down resistor
connects the pin to ground when the switch is open, so it reads LOW when there is no voltage
coming in through the switch.
Yeah!!
57
Spaceship Interface
58
Spaceship Interface
Lets look carefully at
the codes
59
Spaceship Interface
Check if GreenLab
Launching Codes is on to us
#TIP
Capacitor is a device used to
store electric charge, consisting
of one or more pairs of
conductors separated by an
insulator
60
Spaceship Interface
Meanwhile...
Let check our space interface
code, shall we?...
Divine you are welcome
61
Spaceship Interface
its almost
time kids
Destroy
terminant
Lets show
them who’s
boss
63
Spaceship Interface
Be
careful
Push the
button
Ok
WINNER
64
#TIP
Why does the metal clamps make a connection, but not the plastic of the breadboard?
There are electrical conducting materials. They are called conductors. Metalls, for instance
silver, copper or aluminium are very good conductors. They conduct, because they’ve got so
called freely moving electrons. This is actually what current consists of.
Materials without the ability of conducting electricity are called insulators. Plastic, ceramic
and glas belonging to the group of insulators. Maybe you’ve already seen the large insulators
on high-tension power lines? They hold the cables to the high-voltage poles. Usually they are
made of ceramic.
65
Episode 05- GreenLab
Your Rights to Innovat Welcome to YouNiversity Cartooino
Your Rights to Innovate
YouNiversity
66
Welcome to YouNiversity
67
M O N D AY
TIP
What is AI
The full meaning of AI is
Artificial Intelligence
68
GreenLab
Cartooino
EPISODE 6 -
Colour mixing lamp
69
Colour mixing lamp
Uncle Green how Hello kids, welcome back from
was your day? YouNiversity! Aliya what did you learn?
70
Colour mixing lamp
Please note that the RGB LED you
will use for this project has four
pins instead of two pins LED you
have been using before
LEDs
#TIP
LED(Light emitting diode) is a semi conductor device that emits light when
an electric current is passed through it. Light is produced when the particles
that carry the current known as electrons and holes combine together within
the semiconductor material.
71
Colour mixing lamp
Yes Aliya if carefully written
So uncle
will the
Arduino
tell the
lamp what
colour to
display?
72
Colour mixing lamp
Connecting your
Arduino Board to
your IDE
Ayomide we have to worked Since today is Friday I will give you kids a
together quick assignment
Ok then
73
A rear picture of kids doing their project
Cartooino
Book 2
74
Cartooino
Project
Book
2020
Thank You
GreenLab
Cartooino