0% found this document useful (0 votes)
285 views49 pages

Industrial Training

The document discusses a training report submitted by Arundhati Sharma after completing a course on advanced embedded systems with Arduino and ESP at Bit to Byte Robotics, Kota. The course covered topics like embedded systems, Arduino boards, C programming, and various hands-on projects involving components like LEDs, sensors, motors and wireless modules. The training helped improve skills in electronics, programming and building embedded systems. Some key projects undertaken included an LED blink code, LED intensity control using a potentiometer, and motion detectors using sensors.
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)
285 views49 pages

Industrial Training

The document discusses a training report submitted by Arundhati Sharma after completing a course on advanced embedded systems with Arduino and ESP at Bit to Byte Robotics, Kota. The course covered topics like embedded systems, Arduino boards, C programming, and various hands-on projects involving components like LEDs, sensors, motors and wireless modules. The training helped improve skills in electronics, programming and building embedded systems. Some key projects undertaken included an LED blink code, LED intensity control using a potentiometer, and motion detectors using sensors.
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/ 49

ADVANCED EMBEDDED SYSTEMS WITH

ARDUINO & ESP

Practical Training Report


Submitted in partial fulfillment for the award of degree of
Bachelor of Technology
in
Department of Electronics Engineering
(Electronic & Communication Engineering)

Submitted to: Submitted by:


Mr. Leeladhar Nagar Arundhati Sharma
Guest faculty Roll No. 20/284

Department of Electronics Engineering


University Department,
Rajasthan Technical University, Kota
January- 2023

1
1
DECLARATION
I hereby declare that the work which is being presented in the dissertation entitled
"ADVANCED EMBEDDED SYSTEMS WITH ARDUINO & ESP" towards
partial fulfilment of the requirements for the award of the Degree of "Bachelor of
Technology in Electronics and Communication Engineering", submitted in the
Department of Electronics Engineering of the Rajasthan Technical University,
Kota, is an authentic record of my own work carried out under the supervision of
Mr. Leeladhar Nagar, Guest faculty of Electronics Engineering, Rajasthan
Technical University, Kota.

Date- Arundhati Sharma

Place- Kota 20/284

1
ACKNOWLEDGEMENT
I take this opportunity to express a deep sense of gratitude BIT TO BYTE
ROBOTICS, KOTA, for providing excellent guidance, encouragement and
inspiration through-out this dissertation. Without his invaluable guidance, this
dissertation would never have been a successful one.

I also want to give thanks to all the faculty members of department of electronics
engineering and my family for their love, support and encouragement during this
time. I want to thank my dear friends, the ones that remain here and the ones that
have already left, for making this period such an extraordinary experience in my
life.

Last but not least, my heartiest thanks to all the people, who have been a pillar of
support during the arduous time of research.

Arundhati Sharma

1
LIST OF FIGURES
Figure Caption Page
2.1 Embedded system structure design 13
2.2 Interface of Arduino IDE 14
2.3 Arduino board 15
3.1 Schematic diagram for LED blink 19
3.2 Circuit diagram for LED blink 19
Schematic diagram for LED
3.3 21
intensity control with potentiometer
Circuit diagram for LED intensity
3.4 21
control with potentiometer
3.5 Schematic diagram of servo motor 23
3.6 Circuit diagram of servo motor 23
Schematic diagram of humidity and
3.7 25
temperature control sensor
Schematic diagram of motion
3.8 27
detector with buzzer
Circuit diagram of motion detector
3.9 27
with buzzer
Schematic diagram of motion
3.10 29
detector with LED
Circuit diagram of motion detector
3.11 29
with LED
Schematic diagram of motion
3.12 31
detector with ultrasonic
Circuit diagram of motion detector
3.13 31
with ultrasonic
Schematic diagram of IR sensor
3.14 33
with LED
Schematic diagram of IR sensor
3.15 35
with buzzer
Schematic diagram of Bluetooth
3.16 37
LED module
Schematic diagram of fingerprint
3.17 44
sensor
3.18 Schematic diagram of Wi-Fi module 45

1
Contents
Title page 1
Certificate 2
Declaration 3
Acknowledgement 4
List of figures 5
Table of content 6-7
Chapter 1- Introduction 8-10
1. Bit to Byte Robotics
2. Course curriculum
2.1. About the course
2.2. What did I learn?
2.2.1. Basic electronics
2.2.2. Basic electronics components
2.2.3. Arduino Introduction
2.2.4. Programming Introduction
2.2.5. Projects
Chapter 2- Topics covered during training 11-16
1. What is embedded system?
1.1. Definition
1.2. Technologies where embedded system is widely used
1.2.1. Automobiles
1.2.2. Mobile phones
1.2.3. Industrial machines
1.2.4. Medical equipment
1.3. Structure of embedded system
1.3.1. Hardware
1.3.2. Software and filmware
2. What is Arduino?
2.1. Arduino board components
3. C-programming
3.1. Introduction to c programming
3.2. Features of C programming
3.3. How to program C in arduino?

1
Chapter 3- Projects made 17-44
1. Normal LED code with Arduino and blink
2. LED intensity control with potentiometer
3. Servo motor
4. Humidity and temperature control sensor
5. Motion detector
5.1. With buzzer
5.2. With LED
5.3. With ultrasonic
6. IR sensor
6.1. LED
6.2. Buzzer
7. Bluetooth LED (on and off using mobile app)
8. Fingerprint sensor
9. Wi-Fi module
Chapter 4- Conclusion 45-48

1
Chapter 1
Introduction
1. Bit to Byte Robotics (BBR)
1.1 About BBR
Bit to Byte Robotics (BBR) is a young start-up company that offers cutting-edge
products to improve productivity, safety, and quality of life based on modern
technologies like embedded robotics, artificial intelligence, and the internet of
things. However, we also have a variety of hardware and software products for
industries and home appliances to replace traditional inefficient and risky system
to increase the productivity and safety. The products are primarily developed for
farmers to solve lethal and unsolved problems caused by traditional equipment
and technologies.

2. Course Curriculum
2.1 About the course
Through this course I learned how the Arduino platform works in terms of the
physical board and libraries and the IDE (integrated development environment).
The course also covered programming the Arduino using C code and accessing
the pins on the board via the software to control external devices. Along with
Arduino you will learn about how ESP8266 and raspberry pi works.

2.2 What did I learn?


We learned about various things related to Arduino and tried to improve my skills
in electronics-

1
2.2.1 Basic electronics-
The emission, behaviour, and consequences of electrons via electronic devices
are the subject of electronics, a subfield of electrical engineering and physics. In
contrast to traditional electrical engineering, which solely uses passive effects
like resistance, capacitance, and inductance to influence electric current flow,
electronics uses active devices to control electron flow through amplification and
rectification.
2.2.2 Basic electronics components-
Resistors: Components used to resist current.
Switches: Components that may be made to either conduct (closed) or not (open).

Capacitors: Components that store electrical charge in an electrical field.


Magnetic or Inductive Components: These are Electrical components that use
magnetism.
2.2.3 Arduino Introduction-
The open-source Arduino platform is used to create electrical projects. With
Arduino, you can write and upload computer code to a physical programmable
circuit board (commonly called a microcontroller) using a piece of software
called the IDE (Integrated Development Environment), which runs on your
computer.
2.2.4 Programming Introduction-
Arduino programming is a simplified version of C++, which makes the learning
process easy. The Arduino IDE is used to control the functions of boards. It
further sends the set of specifications to the microcontroller. Arduino does not
need an extra board or piece to load new code.

1
2.2.5 Projects-
2.2.5.1 Normal LED code with Arduino and blink
2.2.5.2 LED intensity control with pontiometer
2.2.5.3 Servo motor
2.2.5.4 Humidity and temperature control sensor
2.2.5.5 Motion detector (with buzzer, led, and ultrasonic)
2.2.5.6 LED and buzzer- IR sensor
2.2.5.7 Bluetooth- LED on and off using a mobile app
2.2.5.8 Fingerprint sensor
2.2.5.9 Wi-Fi module

1
Chapter 2

Topics covered during training

1. What is embedded system?


1.1 Definition
A computer hardware and software combination created for a particular purpose
is an embedded system. Additionally, embedded systems may operate as part of a
bigger system. The systems may be programmable or may only perform certain
functions. An embedded system may be found in industrial machinery, consumer
electronics, agricultural and processing sector equipment, automobiles, medical
devices, cameras, digital watches, home appliances, aeroplanes, vending
machines, toys, and mobile devices.

1.2 Technologies where embedded system is widely used


1.2.1 Automobiles-
In most modern cars, there are numerous computers—up to 100, sometimes—or
embedded systems that are used to carry out various functions. Some of these
systems carry out fundamental utility tasks, while others offer entertainment or
user-facing features. Cruise control, backup sensors, suspension control,
navigation systems, and airbag systems are a few embedded technologies found
in consumer vehicles.
1.2.2 Mobile phones-
These consist of many embedded systems, including GUI software and hardware,
operating systems (OSes), cameras, microphones, and USB (Universal Serial
Bus) I/O (input/output) modules.
1.2.3 Industrial Machines-
They can contain embedded systems, like sensors, and can be embedded systems
themselves. Industrial machines often have embedded automation systems that
perform specific monitoring and control functions.
1.2.4 Medical equipment-
These might have embedded systems, such as sensors and control systems.
Medical devices, like commercial machines, must also be very user-friendly to

1
avoid machine errors that may have been avoided. This implies that they
frequently have a more complicated OS and GUI created for a suitable UI.

1.3 Structure of embedded system


Embedded systems vary in complexity but, generally, consist of three main
elements:

1.3.1 Hardware-
In terms of hardware, a basic embedded system would consist of the following
elements:
1.3.1.1 Sensors
1.3.1.2 Analog to digital convertors
1.3.1.3 Processors
1.3.1.4 Digital to analog convertors
1.3.1.5 Actuators
The sensor reads external inputs, the converters make that input readable to the
processor, and the processor turns that information into useful output for the
embedded system.

Fig. 2.1 Embedded system structure design

1.3.2 Software and firmware-


The complexity of software for embedded systems might vary. However,
embedded IoT systems and industrial-grade microcontrollers typically run
relatively straightforward software that uses little memory.

1
2. What is Ardiuno?
The open-source Arduino platform is used to create electrical projects. With
Arduino, you can write and upload computer code to a physical programmable
circuit board (commonly called a microcontroller) using a piece of software
called the IDE (Integrated Development Environment), which runs on your
computer.

Fig. 2.2 Interface of Arduino IDE

1
2.1 Arduino board components

Fig. 2.3 Arduino board

These are the components that make up an Arduino board and what each of their
functionalities are.
2.1.1 Reset Button-
This will restart any code that is loaded to the Arduino board
2.1.2 AREF-
Stands for “Analog Reference” and is used to set an external reference voltage
2.1.3 Ground Pin-
There are a few ground pins on the Arduino and they all work the same
2.1.4 Analog Pins-
These pins read the signal from an analog sensor and convert it to digital
2.1.5 Digital Input/Output-
Pins 0-13 can be used for digital input or output
2.1.6 PWM-
The pins marked with the (~) symbol can simulate analog output
2.1.7 USB Connection-
Used for powering up your Arduino and uploading sketches
2.1.8 TX/RX-
Transmit and receive data indication LEDs

1
2.1.9 ATmega Microcontroller-
Popular microcontroller chip, this is where the programs are stored
2.1.10 Power LED Indicator-
This LED lights up anytime the board is plugged in a power source
2.1.11 Voltage Regulator-
Controls the amount of voltage going into the Arduino board
2.1.12 DC Power Barrel Jack-
This is used for powering your Arduino with a power supply
2.1.13 3.3V Pin-
This pin supplies 3.3 volts of power
2.1.14 5V Pin-
This pin supplies 5 volts of power

3. C-programming

3.1 Introduction to C language


The C programming language is a procedural, general-purpose language that is
independent of the operating system and facilitates structured programming. It
also offers low-level access to the system memory. The C programming language
was created by Dennis Ritchie in 1972 at AT&T (then known as Bell
Laboratory), where it was used with the UNIX operating system on a DEC PDP
II. Additionally, it was Ken Thompson's B programming language's replacement.
C was created to address the issues that BASIC, B, and BPCL programming
languages had.

1
3.2 Features of C Programming
The most important features provided by the C programming languages include:

3.2.1 It has inbuilt functions and operators that can solve virtually any complex
problem.
3.2.2 C is the combination of both low level (assembly) and high-level programming
languages; also, it can be used to write an application and interact with low-level
system memory and hardware.
3.2.3 It can be written on practically any operating system and even works in most
handheld devices.
3.2.4 Programs written in C are speedy due to the support provided by its datatypes and
operators.
3.2.5 It is easily extendable, as C++ was derived from C with additions like OOPS and
other features.
3.2.6 The functions and operators are supported by the libraries provided by the
programming language itself.

3.3 How to program C in Arduino?


3.3.1 To run the code, on the menu bar, choose Sketch > Upload.
3.3.2 The code will be uploaded to the ATmega Microcontroller.
3.3.3 Press the reset button to restart any code that is loaded to the Arduino board.

1
Chapter 3

Projects completed

1. Normal LED code with Arduino and blink


1.1 Objective
To successfully make an LED blink using Arduino and C++ code.
1.2 Equipment required
1.2.1 1 × Arduino Uno R3
1.2.2 1 × LED
1.2.3 1 × 330Ω Resistor
1.3 Code
// C++ code
//
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}

1
Fig. 3.1 Schematic diagram for LED blink

Fig. 3.2 Circuit diagram of LED blink

1
2. LED intensity control with Potentiometer
2.1 Objective
To successfully make an LED intensity control with potentiometer using Arduino
and C++ code.
2.2 Equipment required
2.2.1 1x Uno R3 development board
2.2.2 1x Bread board and supporting connecting line
2.2.3 1x 220Ω current limiting resistor
2.2.4 1x LED
2.2.5 1x potentiometer

2.3 Code
#define LED_PIN 11
#define POTENTIOMETER_PIN A1

void setup()
{
pinMode(LED_PIN, OUTPUT);
}

void loop()
{
int potentiometerValue = analogRead(POTENTIOMETER_PIN);
int brightness = potentiometerValue / 4;
analogWrite(LED_PIN, brightness);
}

1
Fig. 3.3 Schematic diagram for LED intensity control with Potentiometer

Fig. 3.4 Circuit diagram for LED intensity control with Potentiometer

1
3. Servo motor
3.1 Objective
To successfully make a servo meter using Arduino and C++ code.
3.2 Equipment required
3.2.1 1x Uno R3 development board
3.2.2 Positional micro servo
3.3 Code
/*
Servo Motor Control - 50Hz Pulse Train Generator
by Dejan, https://howtomechatronics.com
*/

#define servoPin 9

void setup() {
pinMode(servoPin, OUTPUT);
}

void loop() {
// A pulse each 20ms
digitalWrite(servoPin, HIGH);
delayMicroseconds(1450); // Duration of the pusle in microseconds
digitalWrite(servoPin, LOW);
delayMicroseconds(18550); // 20ms - duration of the pusle
// Pulses duration: 600 - 0deg; 1450 - 90deg; 2300 - 180deg
}

1
Fig. 3.5 Schematic diagram of servo motor

Fig. 3.6 Circuit diagram of servo motor

1
4. Humidity and temperature control sensor
4.1 Objective
To successfully make a humidity and temperature control sensor using Arduino
and C++ code.
4.2 Equipment required
4.2.1 Uno R3 development board
4.2.2 Resistor
4.2.3 DHT11
4.3 Code
#include <dht.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
#define DHT11_PIN 7
void setup(){
lcd.begin(16, 2);
}
void loop(){
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(DHT.temperature);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.print(DHT.humidity);
lcd.print("%");
delay(1000);
}

1
Fig. 3.7 Schematic diagram of humidity and temperature control sensor

1
5. Motion detector
5.1 With buzzer
5.1.1 Objective
To successfully make a motion detector with buzzer using Arduino and C++
code.
5.1.2 Equipment required
5.1.2.1 Uno R3 development board
5.1.2.2 Piezo
5.1.2.3 PIR Sensor
5.1.3 Code
const int MOTION_SENSOR_PIN = 7;
const int BUZZER_PIN= 3;
int motionStateCurrent = LOW;
int motionStatePrevious = LOW;
void setup() {
Serial.begin(9600);
pinMode(MOTION_SENSOR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
motionStatePrevious = motionStateCurrent;
motionStateCurrent = digitalRead(MOTION_SENSOR_PIN);
if (motionStatePrevious == LOW && motionStateCurrent == HIGH) {
Serial.println("Motion detected!");
digitalWrite(BUZZER_PIN, HIGH); }
else
if (motionStatePrevious == HIGH && motionStateCurrent == LOW) {
Serial.println("Motion stopped!");
digitalWrite(BUZZER_PIN, LOW);
}
}

1
Fig. 3.8 Schematic diagram of motion detector with buzzer

Fig. 3.9 Circuit diagram of motion detector with buzzer

1
5.2 With LED
5.2.1 Objective
To successfully make a motion detector with LED using Arduino and C++ code.
5.2.2 Equipment required
5.2.2.1 Uno R3 development board
5.2.2.2 LED (Red, Green)
5.2.2.3 LED RGB
5.2.2.4 3 x 220Ω resistors
5.2.2.5 PIR Sensor
5.2.3 Code
const int MOTION_SENSOR_PIN = 7;
const int BUZZER_PIN= 3;
int motionStateCurrent = LOW;
int motionStatePrevious = LOW;
void setup() {
Serial.begin(9600);
pinMode(MOTION_SENSOR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
motionStatePrevious = motionStateCurrent;
motionStateCurrent = digitalRead(MOTION_SENSOR_PIN);
if (motionStatePrevious == LOW && motionStateCurrent == HIGH) {
Serial.println("Motion detected!");
digitalWrite(BUZZER_PIN, HIGH); }
else
if (motionStatePrevious == HIGH && motionStateCurrent == LOW) {
Serial.println("Motion stopped!");
digitalWrite(BUZZER_PIN, LOW);
}
}

1
Fig. 3.10 Schematic diagram of motion detector with LED

Fig. 3.11 Circuit diagram of motion detector with LED

1
5.3 With Ultrasonic sensor
5.3.1 Objective
To successfully make a motion detector with LED using Arduino and C++ code.
5.3.2 Equipment required
1.1.1.1 Uno R3 development board
1.1.1.2 Ultrasonic distance sensor
5.3.3 Code
int inches = 0;
int cm = 0;
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);}
void setup()
{
Serial.begin(9600);
}
void loop()
{
cm = 0.01723 * readUltrasonicDistance(7, 7);
inches = (cm / 2.54);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.println("cm");
delay(100); // Wait for 100 millisecond(s)

1
}

1
Fig. 3.12 Schematic diagram of motion detector with Ultrasonic

Fig. 3.13 Circuit diagram of motion detector with Ultrasonic

1
6. IR sensor
6.1 With LED
6.1.1 Objective
To successfully make an IR sensor with LED using Arduino and C++ code.
6.1.2 Equipment required
6.1.2.1 Uno R3 development board
6.1.2.2 IR Sensor
6.1.2.3 LED
6.1.3 Code
/*** www.arduinopoint.com ***/
/*** Arduino with IR Sensor ***/

int SensorPin = 2;
int OutputPin = 13;
void setup() {
pinMode(OutputPin, OUTPUT);
pinMode(SensorPin, INPUT);
Serial.begin(9600);
}
void loop() {
int SensorValue = digitalRead(SensorPin);
Serial.print("SensorPin Value: ");
Serial.println(SensorValue);
delay(1000);
if (SensorValue==LOW){ // LOW MEANS Object Detected
digitalWrite(OutputPin, HIGH);
}
else
{
digitalWrite(OutputPin, LOW);
}
}

1
Fig. 3.14 Schematic diagram of IR Sensor with LED

1
6.2 With LED
6.2.1 Objective
To successfully make an IR sensor with buzzer using Arduino and C++ code.
6.2.2 Equipment required
6.2.2.1 Uno R3 development board
6.2.2.2 IR Sensor
6.2.2.3 LED bulbs
6.2.2.4 Buzzer
6.2.3 Code
void setup() {
Serial.begin(9600);
pinMode(2, INPUT); pinMode(3, OUTPUT);
pinMode(4, OUTPUT); pinMode(5, OUTPUT);
}void loop() {
balckwhite();//Identification of black and white
obstacle();//Identification obstacles.
}void balckwhite() {
bool led = digitalRead(2);
if (led == 0) {
Serial.println("White"); digitalWrite(3, HIGH);
digitalWrite(4, LOW);
} else {
Serial.println("Black"); digitalWrite(4, HIGH);
digitalWrite(3, LOW);
}}void obstacle() {
int buzzer = analogRead(A0);
if (buzzer <= 80) {
digitalWrite(5, HIGH); Serial.println("Buzzer on");
} else {
digitalWrite(5, LOW);
Serial.println("Buzzer off");
}

1
}

Fig. 3.15 Schematic diagram of IR Sensor with Buzzer

1
7. Bluetooth LED
7.1 Objective
To successfully make a Bluetooth LED using Arduino and C++ code.
7.2 Equipment required
7.2.1 1x Uno R3 development board
7.2.2 LED
7.2.3 HC05 Bluetooth module
7.3 Code
char Incoming_value = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() > 0)
{
Incoming_value = Serial.read();
Serial.print(Incoming_value);
Serial.print("/n");
if (Incoming_value == '1')
digitalWrite(13,HIGH);
else if(Incoming_value == '0')
digitalWrite(13,LOW);
}
}

1
Fig. 3.16 Schematic diagram of Bluetooth LED Module

1
8. Fingerprint Sensor
8.1 Objective
To successfully make a fingerprint sensor using Arduino and C++ code.
8.2 Equipment required
8.2.1 1x Uno R3 development board
8.2.2 LED
8.2.3 HC05 Bluetooth module
8.3 Code
#include <Adafruit_Fingerprint.h>
#if (defined(__AVR__) || defined(ESP8266)) && !
defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
// Set up the serial port to use softwareserial..
SoftwareSerial mySerial(2, 3);
#else
// On Leonardo/M0/etc, others with hardware serial, use hardware serial!
// #0 is green wire, #1 is white
#define mySerial Serial1
#endif
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
uint8_t id;
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("\n\nAdafruit Fingerprint sensor enrollment");
// set the data rate for the sensor serial port
finger.begin(57600);

1
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
Serial.println(F("Reading sensor parameters"));
finger.getParameters();
Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX);
Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX);
Serial.print(F("Capacity: ")); Serial.println(finger.capacity);
Serial.print(F("Security level: ")); Serial.println(finger.security_level);
Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);
}
uint8_t readnumber(void) {
uint8_t num = 0;
while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
}
return num;
}
void loop() // run over and over again
{
Serial.println("Ready to enroll a fingerprint!");
Serial.println("Please type in the ID # (from 1 to 127) you want to save this
finger as...");
id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}

1
Serial.print("Enrolling ID #");
Serial.println(id);
while (! getFingerprintEnroll() );
}
uint8_t getFingerprintEnroll() {
int p = -1;
Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id);
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println(".");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
break;
default:
Serial.println("Unknown error");
break;
}
}

// OK success!
p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");

1
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}
Serial.println("Remove finger");
delay(2000);
p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}
Serial.print("ID "); Serial.println(id);
p = -1;
Serial.println("Place same finger again");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:

1
Serial.print(".");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
break;
default:
Serial.println("Unknown error");
break;
}
}
// OK success!
p = finger.image2Tz(2);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");

1
return p;
}

// OK converted!
Serial.print("Creating model for #"); Serial.println(id);
p = finger.createModel();
if (p == FINGERPRINT_OK) {
Serial.println("Prints matched!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_ENROLLMISMATCH) {
Serial.println("Fingerprints did not match");
return p;
} else {
Serial.println("Unknown error");
return p;
}
Serial.print("ID "); Serial.println(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
Serial.println("Stored!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_BADLOCATION) {
Serial.println("Could not store in that location");
return p;
} else if (p == FINGERPRINT_FLASHERR) {
Serial.println("Error writing to flash");
return p;
} else {
Serial.println("Unknown error");

1
return p;
}
return true;}

Fig. 3.17 Schematic diagram of Fingerprint sensor

1
9. Wi-Fi Module
9.1 Objective
To successfully make a Wi-Fi module using Arduino and C++ code.
9.2 Equipment required
9.2.1 1x Uno R3 development board
9.2.2 LED
9.2.3 HC05 Bluetooth module

Fig. 3.18 Schematic diagram of Wi-Fi module

1
Chapter 4

Conclusion

Arduino is an open-source computer hardware and software company, project


and user community that designs and manufactures microcontroller-based kits for
building digital devices and interactive objects.

Once users are knowledgeable of the Arduino programming language, they are
able to implement a variety of solutions to numerous problems.

The Arduino provide an integrated development environment (IDE) based on the


processing project, which includes support for C, C++ and java programming
languages. Examples: Thermostats, motion sensors and simple robots. These
boards are available in preassembled form or as do-it-yourself kits.

Upon the successful completion of this course, we were able to understand:

1. About the main features of Arduino based embedded system


Features are used to make our work easy because libraries uploaded increase the
amount of space it takes up. These are the official libraries that included in
Arduino distribution:
1.1. EEPROM – reading and writing to “permanent” storage Software Serial (for
serial communication on any digital pins stepper)
1.2. Matrix – basic image sprite manipulation library for use in animation with an
LED matrix.
1.3. Date Time – a library for keeping track of the current date and time in the
software.

To install, unzip the library to a sub-directory of the libraries of the Arduino


application directory. Then launch the Arduino environment, you should see the
library in the Import Library menu.

1
2. The hardware interfacing of the peripherals to Arduino system
An Arduino consist of an Atmel 8, 16 or 32- bit AVR microcontroller with
complementary components that facilitates programming. An import aspect of
Arduino is its standard connectors, which lets users connect the CPU board to a
variety of interchangeable add-on modules known as shields. Some shields
communicate directly over various pins but many are individually addressable via
IC serial bus- so many shields can be stacked and used in parallel. Official
Arduinos have used the mega AVR series of chips, specifically the ATmega8,
ATmega168, ATmega1280 and ATmega2560. A handful of other processors
have been used by Arduino compatibles. Most boards include 5-volt linear
regulator and a 16MHz crystal oscillator, although some designs such as the
Lilypad run at 8MHz and dispense with the onboard voltage regulator due to
specific form factor restrictions. An Arduino microcontroller is also pre-
programmed with a boot loader that simplifies uploading of program to the on-
chip flash memory, compared with other devices that typically need an external
programmer. This makes using an Arduino more default boot loader installed on
Arduino UNO.
The Arduino board exposes most of the microcontrollers I/O pins for use by other
circuits. The current Uno provides 14 digital I/O pins, six of which can produce
pulse-width modulated signals, and six analog inputs, which can also be used as
six digital I/O pins. There are many Arduino- compatible and Arduino- derived
boards. Some are functionally equivalent to an Arduino and can be used
interchangeably.

1
3. About the method of designing new embedded systems using Arduino system
The Arduino Integrated development (IDE) is a cross-platform application
written in Java, and derives from the IDE for the Processing programming
language and the Wiring projects. It is designed to introduce programming to
artists and other newcomers unfamiliar with software development. It includes a
code editor with features such as syntax highlighting, brace matching, and
automatic indentation, and is also capable of compiling and uploading programs
to the board with a single click. A program or code written for Arduino is called a
“sketch”.
Arduino programs are written in C or C++. The Arduino IDE comes with a
software library called “Wiring” from the original wiring project, which makes
many common input/output operations much easier. The users need only to
define two functions to make an executable cyclic executive program:
3.1. Setup (): a function that runs once at the start of a program and that can initialize
settings.
3.2. Loop (): a function called repeatedly until the board powers off.
Most Arduino boards contain an LED and a load resistor connected between the
pin 13 and ground, which is convenient feature for many simple tests. The
previous code would not be seen by a standard C++ compiler as a valid program,
so when the user clicks the “Upload to I/O board” button in the IDE, a copy of
the code is written to a temporary file with an extra include header at the top and
a very simple main () function at the bottom, to make it a valid C++ program.
The Arduino IDE uses the GNU tool chain and AVR Linc to compile programs,
and uses avr to upload programs to the board.
As the Arduino platform uses Atmel microcontrollers, Atmel’s development
environment, AVR studio or the newer Atmel Studio, may also be used to
develop software for the Arduino

1
4. About system designing using Arduino
The first Arduino was introduced in 2005, aiming to provide an inexpensive and
easy way for novices and professionals to create devices that interact with their
environment using sensors and actuators. The hardware design specifications are
openly available, allowing the Arduino boards to be manufactured by anyone.
Adafruit industries estimated in mid-2011 that over 300,000 official Arduinos
had been commercially produced, and in 2013 that 700,000 official’s boards were
in user’s hands.
The UNO differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmeag16U2 programmed as a USB-
to-serial convertor.
“Uno” means one in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino,
moving forward. The Uno is the latest in a series of USB Arduino boards, and the
reference model for the Arduino platforms, for a comparison with previous
version.
5. About the development environment
Arduino is an open-source hardware, the Arduino hardware reference designs are
distributed under a Creative Commons Attribution Share-Alike 2.5 license and
are available on the Arduino website. Layout and production files are some
versions of the Arduino hardware are also available. The source code for the IDE
is available and released under the GNU General Public License, version2.
Several Arduino-compatible products commercially released have avoided the
“Arduino” name by using “-Duino” name variants.

You might also like