Arduino (Emman) PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Arduino Kit

Arduino UNO board - based on an ATmega328P Microcontroller.

Parts of Arduino UNO Board

ATmega328/Main IC - This is
the brain of the board in which
the program is stored.

Power and ground pins - All


the pins related to power are
located here. You can use these
pins to run power from your
Arduino to your breadboard
circuit.

PWM - PWM stands for Pulse


Width Modulation, using this
process we can control the speed of the servo motor, DC motor, and brightness of
the LED.

Digital I/O Pins - They are used to either sense the outside world (input) or control
lights, sounds, or motors (output).

Analog Pins - These pins can read the signal from an analog sensor (like a
temperature sensor) and convert it into a digital value that we can read.

AREF/Analog Reference - AREF refers to Analog Reference. The AREF pin is


usually integrated in setting an external reference voltage.

Reset Button - This button will reset the code loaded into the board. This button is
useful when the board hangs up, pressing this button will take the entire board into
an initial state.

USB Interface - This interface is used to connect the board with the computer and to
upload the Arduino sketches (Arduino Program is called a Sketch).

DC Power Jack - This is used to power up the board with a power supply.

Power LED - This is a power LED that lights up when the board is connected with
the power source.

Crystal Oscillator or Ceramic Resonator - A microcontroller like the Arduino board


requires a clock source. The operation of the microcontroller depends on the clock
circuit. The clock frequency determines the instructions per second a microcontroller
will carry out. The Atmega series is usually integrated in Arduino boards. These
microcontrollers can integrate two different clock sources.
Micro SD Card - The UNO board supports a micro SD card that allows the board to
store more information.

3.3V - This pin is used to supply 3.3V power to your projects. Positive Terminal

Built-in LEDs - The LEDS indicate that there is power, and if your Arduino is
sending or receiving data

5V - This pin is used to supply 5V power to your projects. Positive Terminal

VIN - It is the input voltage applied to the UNO board.

GND(Ground) - Users can integrate any of these pins to ground their circuit.
Negative Terminals

Voltage Regulator - The voltage regulator converts power plugged into the power
port (described below) into the 5 volts and 1 amp standard used by the Arduino. BE
CAREFUL! This component gets very hot. Controls the amount of voltage that is let
into the arduino board.

SPI - The SPI stands for Serial Peripheral Interface. Four Pins 10(SS), 11(MOSI),
12(MISO), 13(SCK) are used for this communication.

TX/RX - Pins TX and RX are used for serial communication. The TX is a transmit pin
used to transmit the serial data while RX is a receive pin used to receive serial data.

Breadboard - Has tiny holes on it that are used to insert the wires
of the electronic components, such as LED, resistor, etc.

LED (Bright White, Green, Red, Yellow, Blue, and RGB) - stands
for Light Emitting Diode, which is defined as a semiconductor
light source. The Shorter pin of the LED is Negative while the
Longer pin is positive. The RGB colors are generated by adjusting
the brightness of each of the three colors by using the PWM pin.

LCD Alphanumeric - LCD (Liquid Crystal Display) is a digital


display, which gives information in the form of letters or
numbers.

Wooden base that can be easily assembled - used to assemble the Arduino
board and Breadboard on its base. (Sorry no Picture found).
Jump wires - simply wires that have connector pins at each
end, allowing them to be used to connect two points to each
other without soldering.

9V Battery - Give power to the circuit.

Resistors of 220 Ohms, 560 Ohms, 1kOhms, 4.7kOhms,


10kOhms, 1MOhms, and 10MOhms - manage the current
flow. It controls the current flowing to the other components.
The other functions are dividing voltages, adjusting the
signal levels, etc.

Small DC Motor of 6/9V - containing a metal rod that spins


when connected to power. The spinning rod can then do simple
things like spinning a fan, or running a pulley system that creates
motion

(40 x 1) Male Strip pins - a single row male pin consisting of 40 pin
headers connected to it.

Red, Blue, and Green Transparent Gels - colored gels act as a filter for the
sensors, which allows the specific colored light to pass through that gel. (Sorry no
pictures found)

Diodes (N4007) - The diode is an electronic component that has


two terminals. The diodes can be used as the signal modulators,
and demodulators, switches, voltage regulators, etc.

The Capacitors of 100uF - stores electrical energy. The energy


is stored between the plates of the capacitor in the form of an
electrostatic field.

Optocouplers - The noise from the electrical signals is removed by


the Optocouplers. It is also used to separate the low power circuits
from the high-power circuits and transfers the electrical signals
between these separated circuits.
Servo motor - The rotary servo in the kit contains a DC
motor, potentiometer, and gearing system that can be
used for precision control of the position of its "horn" using
PWM (pulse-width modulation) signals from the Arduino.
Servos may be used in devices such as robotic arms and
steering systems.

Piezo Buzzer - Tiny speaker that can beep in different tones

USB Cable - Universal Serial Bus is a cable that is used to connect the
Arduino board with the computer.

Stepper Motor - A stepper motor is a special type of DC electric motor


used for precise control of position and rotation. Steppers are used in
applications that require accurate positioning and where there is no
need for back-and-forth motion. The stepper motor converts electrical
input signals into discrete steps, each step being a uniform angular
distance. There are two basic types of stepper motors: unipolar and
bipolar stepper motors

5V Relay - A relay is an electrically operated switch that can be turned


on or off, letting the current go through or not, and can be controlled
with low voltages, like the 5V provided by the Arduino pins.

Thermistor - A thermistor is a resistor whose resistance is highly


dependent on temperature, more so than standard resistors. Thermistors
are subdivided into two classes Negative Temperature Coefficient (NTC)
thermistors and Positive Temperature Coefficient (PTC) Resistors. The
resistance of an NTC thermistor decreases with temperature, while that of
a PTC resistor increases.

Photoresistor - also known as a light-dependent resistor (LDR), is an


electronic component that changes its electrical resistance in response
to the intensity of light

7-Segment Display - is an integrated package of LEDs that act as a


digital readout for projects that need a display of numbers. It has a two
version single-digit and four-digit version.

Humiture Sensor - A composite sensor that measures both the relative


humidity and temperature of the surrounding area
Ultra Sonic Sensor - ultrasonic sensors measure distance by using
ultrasonic waves. The sensor head emits an ultrasonic wave and
receives the wave reflected back from the target. Ultrasonic Sensors
measure the distance to the target by measuring the time between the
emission and reception

int redlight=5; = Naming the pin so the code will understand and function well.

void setup(){ = a function created at the beginning of the program, between the
initialization of the variable and the void loop.

pinMode(redlight,OUTPUT); = Configures the specified pin to behave either as


an input (with or without an internal weak pull-up or pull-down resistor), or an
output.

void loop(){ = Repeat the code over and over again.

digitalWrite(redlight,HIGH); = Control the digital pins to either turn it off or on


(HIGH for on and LOW for off).

delay(4000); = Allows you to pause the execution of your Arduino program for a
specified period.

if(digitalRead(2)== HIGH) = Reads the value from a specified digital pin , either
HIGH or LOW. Reads the button voltage (high = not pressed, low= pressed).

{digitalWrite(12,HIGH);}
else
{digitalWrite(12,LOW);} = Tests a condition, then returns a value based on the
result of that condition.

tone(buzzer,289); = Generates a square wave of the specified frequency (and


50% duty cycle) on a pin.

#include <Servo.h> = Include the Servo Library.

Servo Servo1; = Create a Servo object.

Servo1.attach(servoPin); = attach the servo to the used pin number.

Servo1.write(90); = Turn the Servo motor by degrees based on the number


inside ().
const int trig = 9; = Create a constant (variable that the compiler won't let
you change), which is stored in the Arduino's memory).

Serial.begin (9600) ; = sets the baud rate for serial data communication. The
baud rate signifies the data rate in bits per second. The default baud rate in
Arduino is 9600 bps (bits per second).

delayMicroseconds (1000) ; = Pauses the program for the amount of time (in
microseconds) specified by the parameter.

duration = pulseIn (echo , HIGH) = Returns the length of the pulse in


microseconds or gives up and returns 0 if no complete pulse was received
within the timeout.

distance = (duration/2) / 29.1 ; = Calculate the distance

Serial.println (distance); = Prints data to the serial port as human-readable ASCII


text followed by a carriage return character (ASCII 13, or '\r') and a newline
character (ASCII 10, or '\n').

SINGLE LIGHT
int redlight=5;

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

void loop(){
digitalWrite(redlight,HIGH);
delay(4000);
digitalWrite(redlight,LOW);
delay(3000);
}

TRAFFIC LIGHT
//create the variables and assign the pins

int REDLIGHT=13;// set digital pin 13 to redlight


int YELLOWLIGHT=12;// set digital pin 12 to yellowlight
int GREENLIGHT=11;// set digital pin 11 to greenlight

void setup() {
// put your setup code here to run once:

// DECLARE AND IDENTIFY THE MODE OF PINS USING PINMODE


pinMode(REDLIGHT,OUTPUT);
pinMode(YELLOWLIGHT,OUTPUT);
pinMode(GREENLIGHT,OUTPUT);

void loop() {
// put your main code here to run repeatedly:
// SET INSTRUCTIONS CODE INSTRUCTION

// turn on led and turn off yellow and green lights- TURN ON RED STOP BASED
ON TRAFFICLIGHTS
digitalWrite(REDLIGHT,HIGH);
digitalWrite(YELLOWLIGHT,LOW);
digitalWrite(GREENLIGHT,LOW);
delay(5000);

// turn on RED and YELLOW led and turn off green lights- TURN ON RED THEN
YELLOW READY BASED ON TRAFFIC LIGHTS
digitalWrite(REDLIGHT,HIGH);
digitalWrite(YELLOWLIGHT,HIGH);
digitalWrite(GREENLIGHT,LOW);
delay(2000);

//turn on GREEN and turn off YELLOW and RED lights- TURN ON GREEN LED
MEANING GO ON TRAFFIC LIGHTS
digitalWrite(REDLIGHT,LOW);
digitalWrite(YELLOWLIGHT,LOW);
digitalWrite(GREENLIGHT,HIGH);
delay(5000);

//turn on YELLOW led and turn off GREEN and RED lights- TURN ON YELLOW
BASED ON TRAFFIC LIGHTS
digitalWrite(REDLIGHT,LOW);
digitalWrite(YELLOW,HIGH);
digitalWrite(GREENLIGHT,LOW);
delay(2000);
}

BUTTON AND LIGHT


void setup() {
pinMode(12,0UTPUT);
pinMode(2,INPUT);
}

void loop(){
if(digitalRead(2)== HIGH)
{digitalWrite(12,HIGH);}
else
{digitalWrite(12,LOW);}
}

PIEZO BUZZER
int buzzer=6;
void setup()
{
pinMode(buzzer,OUTPUT);
}

void loop()
{
tone(buzzer,289);
delay(3000);
tone(buzzer,320);
delay(3000);
tone(buzzer,198);
delay(3000);
}

SERVO MOTOR
#include <Servo.h>
int servoPin = A1;
Servo Servo1;
void setup() {
Servo1.attach(servoPin);
}
void loop(){
Servo1.write(0);
delay(1000);
Servo1.write(90);
delay(1000);
Servo1.write(180);
delay(1000);
}
ULTRASONIC SENSOR
const int trig = 9;
const int echo = 10;
int duration = 0;
int distance = 0;
void setup () {
pinMode (trig , OUTPUT) ;
pinMode (echo, INPUT) :
Serial. begin (9600) ;
}
void loop () {
digitalWrite (trig, HIGH) ;
delayMicroseconds (1000) ;
digitalWrite(trig, LOW);
duration = pulseIn (echo , HIGH)
distance = (duration/2) / 29.1 ;
Serial.println (distance);
}

You might also like