0% found this document useful (0 votes)
32 views14 pages

Arduino Worksheet Intermidiate Level - Creative Technology

sample worksheet

Uploaded by

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

Arduino Worksheet Intermidiate Level - Creative Technology

sample worksheet

Uploaded by

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

ARDUINO WORKSHEETS

COMPILED BY: ENGR. RICARDO C. CLEOFE

PHOTORESISTOR
Photoresistor is a light sensitive resistor. When the strength that light casts onto the
photoresistor surface is not the same, resistance of photoresistor will change. With this
feature, we can use photoresistor to detect light intensity. Photoresistor and symbol are as
follows.

The circuit below is often used to detect the change of photoresistor resistance:

In the above circuit, when photoresistor resistance changes due to light intensity,
voltage between photoresistor and resistor R1 will change, so light's intensity can be
obtained by measuring the voltage.

1|Page
ARDUINO WORKSHEETS
COMPILED BY: ENGR. RICARDO C. CLEOFE

Servo
SERVO SWEEP
COMPONENT KNOWLEDGE
SERVO
Servo is an auto-control system, consisting of DC motor, reduction gear, sensor and control
circuit. Usually, it can rotate in the range of 180 degrees. Servo can output larger torque and
is widely used in model airplane, robot and so on. It has three lines, including two for electric
power line positive (2-VCC, red), negative (3-GND, brown), and the signal line (1-Signal,
orange).

We use 50Hz PWM signal with a duty cycle in a certain range to drive the servo. The lasting
time 0.5ms-2.5ms of PWM single cycle high level corresponds to the servo angle 0 degrees -
180 degree linearly. Part of the corresponding values are as follows:

When you change the servo signal, servo will rotate to the designated position.
CIRCUIT
Use D3 of Arduino UNO to drive the servo.
Pay attention to the color of servo lead wire: VCC (red), GND (brown), and signal line (orange).
The wrong connection can cause damage to servo.

2|Page
Sketch
Now, write the code to control servo, making it sweep in the motion range continuously.

3|Page
ARDUINO WORKSHEETS
COMPILED BY: ENGR. RICARDO C. CLEOFE

LED Matrix
CODE KNOWLEDGE
HEXADECIMAL
The conversion between binary and decimal system has been mentioned before. When you
write the code, the number is decimal by default. Hexadecimal numbers need to add the 0x
prefix in the code, such as 0x01. One Hexadecimal bit can present one number between 0-15.
In order to facilitate writing, the numbers greater than 9 are written into the letter A-F (case-
insensitive) such as 0x2A. The corresponding relationship is as follows:

Conversion between hexadecimal and decimal system is similar to the conversion between
hexadecimal and binary such as the sixteen digit 0x12:

When a hexadecimal number need to be converted to decimal number, first, the nth number
of it need be multiplied by n power of 16, then sum all multiplicative results. Take 0x12 as an
example:
1 *16^1+2*16^0=18
When decimal number is converted to hexadecimal number, decimal number is divided by 16.
Then we will get quotient and remainder, and quotient obtained will be continuously divided
by 16 until quotient is zero. Arrange all remainders from right to left in a line. Then we
complete the conversion. For example:

The result is of the conversion 0x12.


When you write code, sometimes it is convenient to use hexadecimal, especially involving bit
operation, because 1 hexadecimal number can be expressed by 4 binary number (2^4=16).
The corresponding relationship between 4 bit binary numbers and 1 hexadecimal number is
shown as follows:

For example, binary 00010010 is corresponding to hexadecimal 0x12.

COMPONENT KNOWLEDGE

4|Page
74HC595
74HC595 chip is used to convert serial data into parallel data. 74HC595 can convert the serial
data of one byte to 8 bits, and send its corresponding level to the corresponding 8 ports. With
this feature, 74HC595 can be used to expand the IO port of Arduino board. At least 3 ports on
the Arduino board are need to control 8 ports of 74HC595.

The ports of 74HC595 are described as follows:

LED MATRIX
LED matrix is a rectangular display module that consists of several LEDs. The following is an
8*8 monochrome LED matrix with 64 LEDs (8 rows and 8 columns).

5|Page
In order to facilitate the operation and save the ports, positive pole of LEDs in each row and
negative pole of LEDs in each column are respectively connected together inside LED matrix
module, which is called Common Anode. There is another form. Negative pole of LEDs in each
row and positive pole of LEDs in each column are respectively connected together, which is
called Common Cathode.

Let us learn how connection mode of common anode works. Choose 16 ports on UNO board to
connect to the 16 ports of LED Matrix. Configured one port in columns for low level, which
make the column of the port selected. Then configure the eight ports in row to display content
in the selected column. Delay for a moment. And then select the next column and outputs the
corresponding content. This kind of operation to column is called scan. If you want to display
the following image of a smiling face, you can display it in 8 columns, and each column is
represented by one byte.

6|Page
Scanning rows is another display way of dot matrix. It can save the controller ports, but it still
needs 16 ports. So we use one 74HC595 to save some ports. You can use more 74HC595 to
save ports where there are more ports needed.

7|Page
ARDUINO WORKSHEETS
COMPILED BY: ENGR. RICARDO C. CLEOFE

Digital Display
In the previous Project, we have used the LED matrix to display images and characters. Now,
let us use a screen module LCD1602 with a higher resolution to display more content.
DISPLAY THE STRING ON LCD1602
COMPONENT LIST

COMPONENT KNOWLEDGE
LCD1602
LCD1602 can display 2 lines of characters in 16 columns. It can display numbers, letters,
symbols, ASCII code and so on. As shown in the following is a monochrome LCD1602 display
screen:

Circuit symbol and pin descriptions of LCD1602 are shown as follows:

8|Page
CIRCUIT
The connection of Arduino UNO board and LCD1602 is shown below. And use a rotary
potentiometer to adjust the contrast of LCD1602.

ARDUINO WORKSHEETS
COMPILED BY: ENGR. RICARDO C. CLEOFE
9|Page
TEMPERATURE & HUMIDITY SENSOR
In this Project, we will learn how to use a sensor that can detect temperature
and humidity.
Now, let’s try to get the temperature and humidity value of the current environment.
COMPONENT LIST

COMPONENT KNOWLEDGE
DHT11
DHT11 is a compound temperature & humidity sensor, and the output digital signal has been
calibrated inside.

DHT11 uses customized single-line communication protocol, so we can use the library to read
data more conveniently.
CIRCUIT
Use D10 pin on Arduino UNO to connect DHT11.

10 | P a g e
11 | P a g e
ARDUINO WORKSHEETS
COMPILED BY: ENGR. RICARDO C. CLEOFE

Ultrasonic Ranging
In this Project, we learn a module which use ultrasonic to measure distance,
HC-SR04 ultrasonic ranging module.

COMPONENT LIST

COMPONENT KNOWLEDGE
ULTRASONIC RANGING MODULE
Ultrasonic ranging module use the principle that ultrasonic will reflect when it encounters
obstacles. Ultrasonic module integrates a transmitter and a receiver. The transmitter is used
to convert electrical signals (electrical energy) into sound waves (mechanical energy) and the
function of the receiver is opposite.

Start counting the time when ultrasonic is transmitted. And when ultrasonic encounters an
obstacle, it will reflect back. The counting will end after ultrasonic is received, and the time
difference is the total time of ultrasonic from transmitting to receiving. Because the speed of

12 | P a g e
sound in air is constant, and is about v=340m/s. So we can calculate the distance between
the module and the obstacle: S=vt/2.

Instructions for use:


Output a high-level pulse in Trig pin lasting for least 10us. Then the module begins to transmit
ultrasonic. At the same time, the Echo pin will be pulled up. When the module receives the
returned ultrasonic, the Echo pin will be pulled down. The duration of high level in Echo pin is
the total time of the ultrasonic from transmitting to receiving, s=vt/2, which is used to
operate the HC-SR04 in Arduino.

CIRCUIT
The connection of Arduino UNO board and HC-SR04 is shown below.

Sketch

13 | P a g e
14 | P a g e

You might also like