0% found this document useful (0 votes)
75 views33 pages

‎⁨اردوينو pdf⁩

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

‎⁨اردوينو pdf⁩

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

‫جمهورية العراق‬

‫وزارة التعليم العالي و البحث العلمي‬


‫جامعة الكفيل‬
‫كلية الهندسة التقنية ‪/‬قسم هنسة تقنيات الحاسوب‬

‫‪Arduino‬‬
About Arduino
Arduino is an open-source platform used for building electronic projects. It
consists of a board with a microcontroller that can be programmed to perform a
wide range of tasks, from turning lights on and off to executing complex robotic
systems.
Arduino history

Arduino started in the early 21st century


2006-2010

During this period, several versions of the boards were developed, such as the Arduino
Diecimila and Arduino Duemilanove, which used ATmega168 and ATmega328 microcontrollers,
respectively.
The Arduino IDE was released, providing an integrated development environment to easily
write and upload code to the boards.

2011-2015

The Arduino Uno was launched, becoming the most popular and widely used board.
A variety of new boards appeared, such as the Arduino Mega, Arduino Nano, and Arduino
Leonardo.
Arduino was used in a wide range of educational applications, hobby projects, and commercial
projects.
3003-2004

The Arduino project started at the Interaction Design Institute Ivrea (IDII) in Italy. The goal was to create
a cheaper and easier alternative to the complex and expensive electronics platforms of the time, like the
Basic Stamp.
The team consisted of Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, and David Mellis.

2005

The first Arduino board was known as “Arduino Serial” and was released in 2005. It was based on the
ATmega8 microcontroller.
The name “Arduino” is derived from a local bar in Ivrea called “Bar di Re Arduino.”
2016-present

New boards such as the Arduino Due and Arduino Zero were developed, featuring more
advanced processors.
New technologies were introduced, such as wireless communication and Bluetooth, with
products like the Arduino MKR1000 and Arduino Nano 33 IoT.
The global Arduino community expanded, with numerous books, training courses, and forums
supporting new users.
Arduino Philosophy
Arduino is based on an open-source philosophy,
meaning that schematics and software are
available for everyone to use, modify, and share.
This has made Arduino an ideal tool for
hobbyists, programmers, and designers to easily
develop their own projects.

Due to its ease of use and low cost, Arduino has


become the foundation for many educational
and experimental projects in fields such as
robotics, home automation, and interactive
environments.
Arduino can play an important
role in artificial intelligence (AI)
projects thanks to its flexibility
and ease of use. While Arduino
itself may not be powerful
enough to run complex AI
algorithms, it can be used to
create embedded systems that
interact with the environment
and collect data to perform
intelligent tasks.
Arduino Terminology

In the world of Arduino, there are


many terms that are important to
know in order to understand how
the boards and programming
work.

Here are some of the basic terms:


Hardware Terms
1. Arduino Board: The board that contains the microcontroller and pins.

2. Microcontroller: The chip that executes the code, such as the ATmega328.

3. I/O Pins: Pins that can be used to read or send digital or analog signals.

4. Analog Pins: Used to read analog values (0-1023).

5. Digital Pins: Used to read or send digital signals (0 or 1).

6. Shields: Additional boards that are placed on top of the Arduino board to

add new functionalities like wireless communication or motor control.

7. USB Port: Used to program the board and supply power to it.

8. Power Jack: A port to connect an external power source.


software

01 IDE (Integrated Development Environment): A software environment used to


write code and upload it to the board.

02 Sketch: The name given to an Arduino program that you write in the IDE.

03 Libraries: Collections of pre-written code that add additional functionality to


projects, such as handling sensors and motors.

04 Function: A block of code that performs a specific task. The basic functions
in Arduino are setup() and loop().

05 setup(): The function that contains the code that runs once when the board
starts.

06 loop(): The function that contains the code that runs repeatedly while the
board is powered on.
components of an Arduino board
ICSP

digital I/O pins

reset button
resonator

usb port
ICSP

crystal oscillator

microcontroller
voltage

power pins
analog pins
Types of Arduino Boards

There are many types of Arduino boards, each designed to meet different needs in terms
of size, capabilities, and uses.

Here are some of the most common types:


1. Arduino Uno

The most popular and widely used, featuring


the ATmega328P microcontroller.

It has 14 digital I/O pins (6 of which can be


used as PWM outputs) and 6 analog input
pins.

Operates at 16 MHz.
2. Arduino Mega 2560
• Features the ATmega2560 microcontroller.

• Ideal for projects that require a large


number of I/O pins.

• It has 54 digital I/O pins (15 of which can be


used as PWM outputs) and 16 analog input
pins.
3. Arduino Nano

• A smaller version of the Arduino Uno,


featuring the ATmega328 microcontroller.

• Suitable for projects that require a


compact size.

• It has 14 digital I/O pins and 8 analog


input pins.
4. Arduino Leonardo

• Features the ATmega32u4 microcontroller.

• It has 20 digital I/O pins (7 of which can be used as PWM outputs) and 12
analog input pins.
5. Arduino Yun

• Combines Arduino and Linux (OpenWrt distribution) on a single board.

• Features the ATmega32u4 microcontroller and Atheros AR9331 processor.

• Supports Ethernet and Wi-Fi connectivity.


6. Arduino Pro Mini
• A smaller and simpler version, featuring the ATmega328 microcontroller.

• Available in two versions (3.3V/8MHz and 5V/16MHz).

• Ideal for projects that require power efficiency and a small size.
Benefits of Arduino
1. Ease of Use: The Arduino platform provides a simplified programming environment that
makes it easy for beginners to learn programming and electronics.

2. Low Cost: Arduino boards are available at affordable prices compared to other
development systems, making them accessible to hobbyists, students, and developers.

3. Versatility: Arduino can be used in a wide range of applications, such as robotics, home
automation, artistic projects, and Internet of Things (IoT) projects.

4. Large Support Community:There is a large global community of users and developers who
share their projects, ideas, and solutions, making it easier to get help and support.

5. Expandability:Arduino supports many shields and modules that can be easily connected to
expand the system's capabilities, such as sensors, motors, and wireless communication.

6. Flexible Programming: Arduino supports a programming language based on C/C++, allowing


for flexible and powerful code writing.

7. Educational: It is an excellent tool for learning the fundamentals of programming and


electronics, making it useful for academic education and workshops.
ArduinoEvolution
Arduino systems have evolved significantly since their

inception, leading to numerous improvements and expanding

their capabilities in various fields. It can be said that the term

"Arduino" has become one of the most famous and widely

used terms among tech enthusiasts, hobbyists, and even

professional developers. Anyone involved in engineering and

technology fields will have heard this name at least once.


Integrated Development Environment
(IDE)

The Arduino IDE is a software program used to write


and upload code to the Arduino board. It supports the C
and C++ programming languages and simplifies the
programming process through ready-made libraries and
multiple examples.
Example

Project Idea:

This device uses multiple sensors to detect the


environmental conditions around a plant, such as soil
moisture, temperature, and light intensity, and displays
the plant’s “mood” using different colors on RGB LEDs.
The project visually shows how the plant feels based on
the surrounding conditions.
What you need:

1. Arduino board.
2. Soil moisture sensor.
3. Temperature and humidity sensor (e.g., DHT11 or DHT22).
4. Light sensor (LDR).
5. RGB LED.
6. Resistors (220 ohms).
7. Connecting wires.
8. Breadboard.
Connecting the devices:

1. Soil moisture sensor:


• Connect the sensor pins to the board as per instructions (usually VCC to 5V, GND to GND, and
signal to an analog pin like A1).
2. Temperature and humidity sensor:
• Connect the sensor pins to the board as per instructions (usually VCC to 5V, GND to GND, and
signal to a digital pin like D2).
3. Light sensor (LDR):
• Connect one end of the LDR to 5V.
• Connect the other end to the analog pin A0 and to a 10k ohm resistor, which is connected to
GND.
4. RGB LED:
• Connect the common pin (longest leg) of the RGB LED to GND.
• Connect the other three pins to digital pins (like D9, D10, D11) through 220-ohm resistors.
Writing the code:

#include <DHT.h> void loop() {


int ldrValue = analogRead(ldrPin);
#define DHTPIN 2 // DHT sensor pin int moistureValue = analogRead(moisturePin);
#define DHTTYPE DHT11 // DHT sensor type float h = dht.readHumidity();
float t = dht.readTemperature();
DHT dht(DHTPIN, DHTTYPE);
Serial.print("LDR Value: ");
int ldrPin = A0; // Light sensor pin Serial.println(ldrValue);
int moisturePin = A1; // Soil moisture sensor pin Serial.print("Moisture Value: ");
int redPin = 9; // Red LED pin Serial.println(moistureValue);
int greenPin = 10; // Green LED pin Serial.print("Humidity: ");
int bluePin = 11; // Blue LED pin Serial.print(h);
Serial.print(" %\t");
void setup() { Serial.print("Temperature: ");
pinMode(ldrPin, INPUT); Serial.print(t);
pinMode(moisturePin, INPUT); Serial.println(" *C");
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT); if (moistureValue < 300) {
pinMode(bluePin, OUTPUT); // Low moisture condition
setColor(255, 0, 0); // Red
Serial.begin(9600);
dht.begin();
}
} else if (moistureValue >= 300 && } else {
moistureValue <= 700) { // High light condition
// Suitable moisture condition setColor(255, 0, 255); // Magenta
setColor(0, 255, 0); // Green }
} else {
// High moisture condition delay(2000);
setColor(0, 0, 255); // Blue }
}
void setColor(int red, int green, int blue) {
if (ldrValue < 300) { analogWrite(redPin, red);
// Low light condition analogWrite(greenPin, green);
setColor(255, 255, 0); // Yellow analogWrite(bluePin, blue);
} else if (ldrValue >= 300 && ldrValue <= 700) { }
// Suitable light condition
setColor(0, 255, 255); // Cyan
Code Explanation:

1. The DHT sensor library is included, and the sensor pins


are defined.
2. In the setup function, the pins are set as inputs or
outputs. Serial communication is initiated for monitoring.
3. In the loop function, sensor values are read and printed
to the serial monitor.
4. The plant’s condition is determined based on the read
values, and the RGB LED color is changed to reflect the
plant’s “mood.”
Uploading the Code to the Arduino:

1. Open the Arduino IDE.


2. Copy and paste the above code into the programming
window.
3. Connect the Arduino board to your computer using a
USB cable.
4. Select the appropriate board type and port from the
“Tools” menu.
5. Click the upload button to transfer the code to the
Arduino board.
Running the Project:

Upon completing these steps, you will see the RGB LED
change color based on the plant’s condition (soil moisture,
temperature, humidity, and ambient light). This project can
be a fun and unique way to visually display the
environmental status around your plant.
Learning Resources

There are many online resources for learning


Arduino, including the official Arduino website
and training courses on various platforms.
finally

Arduino is a powerful and versatile tool that allows both hobbyists


and professionals to build a variety of electronic projects. Its ease of
use, low cost, and strong community support make it a suitable and
ideal choice for learning and development in the field of electronics.
Thank you

By

Fatimh Amjad Sakina Neamah Dhuha Mohammed

You might also like