Embedded Lab: Arduino Projects in Science Lessons
Embedded Lab: Arduino Projects in Science Lessons
Embedded Lab: Arduino Projects in Science Lessons
Abstract—We describe the way we designed and built embedded source idea, not only in the way they have been and still are
labs while teaching students the basic principles of digital being developed, but also within their community of users.
electronics. By this means, we also introduced students to the Processing, for example, has a feature which allows a
world of embedded microcontrollers with the thought that they publication of a project in form of a website, including an
might someday build their own circuits. applet and the source code. Because of this feature, many
projects built with Processing are being published with the
Keywords-open source hardware, embedded lab, Arduino, LCD, source code, which allows other people, especially beginners,
ultrasound sensor, electronic composer, measurement
to learn from existing projects. They share an orientation
I. INTRODUCTION towards designers and artists as users. The tools'
functionalities, workflow, and language are focused on the
Why did embedded systems and system designs become a activities of sketching: Without any initial setup, users can start
core of our teaching approach implemented in Basic experimenting immediately, and directly experience the results.
Measurement in Physics course? The answer is in the In conjunction with Arduino and other electronic prototyping
following: firstly, embedded systems architecting or designing kits, users use a breadboard and wire up their circuits manually.
architecture of experimental set-up cannot be achieved through This proves to be compatible with a self-taught trial-and-error
rote learning or the cognitive application of pre-defined copy-and paste approach. It also enables the seeing-drawing-
knowledge since by definition the solution to the problem to be seeing cycle, where the design is explored in a tight iteration of
solved is not known in advance [1]. Rather, it depends on the modification followed by testing the experience [5].
ability to learn, and to progress through a formative, dynamic Additionally, a standard electronic interface based upon the
learning process which draws on higher order creative critical “shield” concept makes working with complex hardware a
thinking that begins with experience and observation and simple matter of plugging in the optional boards. All those
concludes with a product which is unique application of features of open source platforms support the system thinking
knowledge for a particular physical/engineering purpose [1]. teaching and building an experimental set-up. Along with
The process of designing a system involves thinking deeply Arduino, Fritzing [5] becomes a powerful new way to think
about the state of system that has been envisioned, and how the about designing electronics and hardware since it allows the
particular components interconnect with each other. But it is users to empower themselves by designing hardware that was
also about considering: what to do when things go wrong, why once only in reach of trained electrical engineers.
a proposed solution might fail, and what unintended
consequences might occur based on built design. As a This paper explores the world of Arduino, Fritzing and
methodology for learning about systems, design is about sensors through multiple versions of existing ideas. We
providing constructive context in which to explore ideas, integrate ongoing feedback into the learning process, and
interactions and expressions. Linking design to digital media identify the strength and weakness of designed systems [6].
tools expands this concept further. When learning the tools of
networks and computer systems, it is important to think of II. THE EMBEDDED LAB
them as a system rather than a specified set of interfaces [1-2]. The lab consists of a small data acquisition board able to
read signals from various sensors connected to a standard
The programming environment Processing [3] and the personal computer through a USB cable. There are four main
microcontroller Arduino [4] have been two important tools in components to the framework, namely: (a) an Arduino board,
system design development including embedded systems. equipped with a microcontroller; (b) the computer program
Processing is a Java-based programming language including an running on the microcontroller itself, loaded from the PC; (c) a
easy-to-use IDE with focus on visual programming. Arduino is custom shield (which could be developed as a series of shields)
a system consisting of a microcontroller with USB or (d) the control software running on the host computer and set
Bluetooth connections, and a programming environment of sensors interfaced to the Arduino platforms and used to
targeted towards designers and artists who want to build interact with the surrounding.
interactive artifacts. Processing and Arduino rely on the open
– 284 –
4thMediterranean Conference on Embedded Computing MECO – 2015 Budva, Montenegro
The Arduino platform. – The Arduino platform is an open The connection of the Arduino module to the breadboard is
source electronics prototyping platform based on flexible, easy- shown in Figure 2. The breadboard power supply and ground
to-use hardware and software. It is intended for artists, (GND) pins were connected to the corresponding pins on the
designers, hobbyists and anyone interested in creating microcontroller. On the Arduino module, the 5V pin and any of
interactive objects or environments. The system provides sets the ground connections were used. One end of the 8 ȍ speaker
of digital and analog I/O pins that can be interfaced with was connected to pin 8 of the Arduino board. The other end
various extension boards and other circuits. The boards feature was connected to the ground pin. The experimental-set up can
serial communications interfaces, including USB on some be further modified by adding two photo resistors as shown in
models, for loading programs from personal computers. For Figure 3. The photocells act as a voltage divider, allowing us to
programming the microcontrollers, the Arduino platform change the value of the analog input by covering either one of
provides an integrated development environment (IDE) based them.
on the Processing project, which includes support for C and
C++ programming languages [7].
The Arduino shield. -The shields are small print circuit
boards (PCB) to be plugged into the top of the Arduino board,
and which act as an interface between the board and the
external world (e.g.,with sensors) or extend the functionalities
of the board itself.
The Arduino firmware – By building onto the Arduino core
library, we have implemented a set of configurable programs
(or sketches) for the microcontroller.
III. APPLICATIONS
On its own, Arduino is simply a microcontroller
development board. But by building a project around it, an Figure 2. The sensor circuit consists of the Arduino and a breadboard.
embedded system is created. A few of the projects designed
during the Basic Measurement in Physics course are presented
below. Students attending the course are second-year
undergraduates of the Department of Physics at the Faculty of
Science of the University of Montenegro.
A. Making music with Arduino and a speaker: a composer
fed by an electrical signal
The aim of the project was to produce Beethoven’s Für
Elise. In order to produce the tone output, the following
hardware components were used: an Arduino board, an 8ȍ
small speaker, a 1Kȍ resistor, and hook-up wires. The circuits
and hardware components are displayed in Figure 1.
Figure 3. Sensor circuit with two additional photodiodes, done by Fritzing
program..
– 285 –
4thMediterranean Conference on Embedded Computing MECO – 2015 Budva, Montenegro
– 286 –
4thMediterranean Conference on Embedded Computing MECO – 2015 Budva, Montenegro
and a Keypad shield for Arduino Omega boards. A 2x16 LCD first detected echo is assumed to measure the range to the
is one which can display a total of two lines with up to 16 closest object. Robots then use this information to plan paths
characters per line. The Arduino LCD Keypad shield operates around obstacles and to prevent collisions. In sonar mapping, a
in 4-bit mode. This means it uses a total of 6-pins to control the collection of echoes acquired by performing a rotational scan
LCD display: pins 4, 5, 6, 7, 8, and 9. To control LCD data, it or from a sonar array is used to construct a map of the
uses pins 4, 5, 6, and 7, while the RS and Enable pin are environment. Similar to a radar display, a range dot is placed
controlled by pins 8 and 9. The shield is simply plugged into on the detected range, along the probing pulse direction. For
the Arduino main board with no soldering required. object recognition, a sequence of echoes or sonar maps is
processed to classify echo-producing structures composed of
one or more physical objects. When successful, this
information is useful for robot registration or landmark
navigation.
The project was implemented as follows: Firstly, students
were taught basic sonar principles. Secondly, they were taught
how to build Arduino, sensor, and LCD circuits for measuring
distance. Fourthly, a short experiment was conducted in order
to investigate the sensor's limitations.
The HC-SR04 ultrasonic ranging module designed for
embedded system projects is used as a sensor. It has a
resolution of 0.3 cm and a distance range from 2cm to 500cm.
It runs on a 5V DC supply with a standby current of less than
2mA. The module transmits an ultrasonic signal, picks up its
echo, measures the time elapsed between the two events and
outputs a waveform whose high time is modulated by the
measured time which is proportional to the distance.
– 287 –
4thMediterranean Conference on Embedded Computing MECO – 2015 Budva, Montenegro
connection of the HC-SR04 to an Arduino microcontroller is HD44780 (or a compatible) chipset, which is found on most
completed as follows: The sensor module’s 5V and Ground text-based LCDs.
pins are connected to the Arduino pins. In this example, the
module’s trigger and echo pins are connected to pin 52 and pin The Arduino code is used as follows:
53 of the Arduino, respectively. #include <LiquidCrystal.h>
This command activates the library which contains
commands connected to the LCD[4]. The active pins for the
LCD are defined as follows:
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int t2,t1,i,j;
//Trig i Echo pins are defined and declared.
const int trigPin=52, echoPin=53;
void setup()
{
Figure 8. Arduino with ultrasound sensor for distance measurements
//initialize serial communication
Fig. 8 shows the hardware, while Fig. 9 shows ultrasonic
Serial.begin(9600);
module operation. The 10 ȝs High Level (5V) pulse is
generated by the microcontroller (Arduino) and then used by lcd.begin(16, 2);
the ultrasound sensor as a trigger signal. The ultrasound
module then automatically transmits eight 40 KHz ultrasonic lcd.clear();
burst. If an obstacle is located in front of the ultrasound sensor, //Configures the specified pin to behave either as an input
it will reflect the ultrasonic bursts. If a signal returns, the or an output
ECHO output of the sensor will be in HIGH state (5V) for the
time it takes to send and receive the ultrasonic bursts. Pulse pinMode(52,OUTPUT);
width ranges from about 150ȝs to 25ms; and if no obstacle is pinMode(53,INPUT);
detected, the width of the echo pulse will be approximately
38ms. From the timing chart, one can observe that the 40KHz }
pulse train is transmitted just after the 10uS triggering pulse //Trig pin is output because it sends the signal, while Echo
while the echo output follows somewhat later. The next is input since it receives the signal.
triggering pulse can be made only after the echo has faded
away. This time period is called the cycle period. As mentioned float length()
earlier, the cycle period for the HC-SR04 must not fall below
{
50ms. In order to visualize information, the LCD was plugged
into Arduino shield. float time, distance;
// The digitalWrite() sets the value of a digital output pin.
Possible values are HIGH or LOW. If the pin has been
configured as an OUTPUT with pinMode(), its voltage will be
set to the corresponding value: 5V (or 3.3V on 3.3V boards)
for HIGH, 0V (ground) for LOW. If the pin is configured as an
INPUT, digitalWrite() will enable (HIGH) or disable (LOW)
the internal pull-up on the input pin..
digitalWrite(trigPin,HIGH);
delay(1);
Figure 9. Ultrasonic Module Operation digitalWrite(trigPin,LOW);
// pulseIn() reads a pulse (either HIGH or LOW) on a pin.
When all the components were connected (HC-SR04
ultrasonic ranging module, LCD, wires, breadboard, the time=pulseIn(echoPin,HIGH);
Arduino) the next phase of the project was to program the
// Distance is calculated as one-half the product of
Arduino board via Arduino IDE (Integrated Development
traveling time and ultrasound speed. Speed of sound is 340m/s
Environment) software. A LiquidCristal library allows the
or 1/29.1 ms/cm.
Arduino board to control LCDs employing the Hitachi
– 288 –
4thMediterranean Conference on Embedded Computing MECO – 2015 Budva, Montenegro
return distance; This paper presents a new approach in teaching the Basic
Measurements in Physics course, where the design and
} architecture of embedded systems were used as an inspiration
void loop() for a lab-on-chip laboratory design. Various projects are
shown. The Arduino, combined with sensors, was shown to
{ have huge developmental potential and is a great source of
lcd.clear(); learning inspiration for students. Open source platform linked
to the digital media moves education away from using ICT to
float x; x=distance(); deliver and control instruction to an environment supporting
lcd.print(x); the learners’ own creation of knowledge as well as their
investigative and thinking processes. It changes the way ICT is
Serial.println(x); lcd.print(" cm"); used: from a means of transmitting information by
representation to a mechanism for generating knowledge,
delay(300);
moving from linear logic to non-linear, networked logic. The
} interplay of student-owned laboratories and embedded systems
is shown to have a powerful influence on students. When the
After the code was checked and further developed, we conventional method of teaching was used, students exhibited a
conducted a short experiment to investigate the sensor's lack of motivation to work intensely towards finding the
limitations. Here are the main obstacles we found: solution to a problem, and often struggled with misconceptions.
• The slow sound speed, relative to an optical sensor, On the other hand, moving to a student-owned lab, caused
reduces the sonar sensing rate. A new probing pulse significant improvement in their understanding of electronic
should be transmitted after all detectable echoes from circuits and scientific concepts. This was demonstrated mainly
the previous pulse have expired, otherwise a false by the considerable change we saw in the students’ attitude
reading can occur. toward independent, self-regulated and self-directed learning.
Furthermore student-owned labs support collaborative learning,
• The wide sonar beam causes poor directional which can be further amplified if learners are taught to think
resolution. about alternatives and to articulate their thoughts.
• Soft surfaces cause a signifiant uncertainties. ACKNOWLEDGMENT
• Multiple reflections cause artifacts (no objects exist but The work is part of the Basic Measurement in Physics
echo signal is received); course of Faculty of Science and Mathematics at the University
of Montenegro.
• Signal travel time and amplitude variations are caused
by inconsistencies in the sound speed due to REFERENCES
inhomogeneous of medium. This cause furthermore
uncertainties in echo time.
[1] P- Godfrey, R. Deakin Crick, and S. Huang, “Systems Thinking,
• Interference between sensors is very significant for Systems, Design and Learning Power in Engineering Education”,
International Journal of Engineering Education, Vol. 30, No. 1, pp. 112–
small sensor spacing and long distances. 127, 2014.
• Thermal fluctuations cause re-direction through echo [2] P. Blumenfeld, T. Kempler and J. Krajcik., “Motivation and cognitive
engagement in learning environments“. In R. K. Sawyer (Ed.),
refractions. This cause furthermore temporal variations Cambridge Handbook of the Learning Sciences (pp. 475-488).
in the echoes and variations in their amplitude. Cambridge: Cambridge University Press., 2006
Our findings lead to several more ideas. The variations in [3] C. Reas, and B. Fry, “Processing: A Programming, Handbook for Visual
Designers and Artista“, MIT Press, 2007. Software available at
echo amplitude that are caused by changes in environmental http://www.processing.org
conditions could be used for monitoring the changes in
[4] http://arduino.cc/
breathing patterns in people with breathing problems such as
[5] http://fritzing.org/media/uploads/publications/Fritzing-TEI09-final.pdf
sleep apnea. This serious disorder causes people to stop
[6] A.F Mondragon-Torres, J.W. Christman, “A comprehensive embedded
breathing several times during sleep. For that purpose, we systems design course and laboratory”, Microelectronic Systems
would like in future to determine the viability of an ultrasonic Education (MSE), 2013 IEEE International Conference, pp 56 – 59,
device for recording breathing activity, which makes no ISBN: 978-1-4799-0139-5
contact with, and is otherwise imperceptible by the subject. [7] David James Russell, “Introduction to embedded systems: using ANSI C
Based on a low-powered ultrasonic active source and and the Arduino development environment”, Publisher: San Rafael,
transducer, the device would measure frequency shifts Calif. (1537 Fourth Street, San Rafael, CA 94901 USA) : Morgan &
Claypool, 2010, ISBN- 9781608454990, 9781608454983
produced by the difference in velocity between the flow of
exhaled air and the ambient environment, i.e., the Doppler
effect.
– 289 –