Sunteți pe pagina 1din 13

PART 1

LCD

- is an electronic display module and find a wide range of applications.

pins

RS- selects command register = low

data register = high

R/W - write the register = low

read the register = high

E- sends data to data pins when hogh to low pulse is given

Program

<LiquidCrystal.h>

- Library that allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi
HD44780

LiquidCrystal(). A constructor function use creates or instantiate an object type of LiquidCrystal.

begin()

-LCD function that specifies the dimensions (width and height) of the display.

clear()

LCD function that clears the LCD screen and positions the cursor in the upper-left corner
home()

LCD function that positions the cursor in the upper-left of the LCD.

lcd-myLCD.setCursor(col_pos, row_pos);

- LCD function that position the LCD cursor; that is, set the location at which subsequent text written to
the LCD will be displayed.

lcd-myLCD.print(data); - Prints text to the LCD.

lcd-name.scrollDisplayLeft(); - Scrolls the contents of the display (text and cursor) one space to the left.

lcd-name.leftToRight() - Set the direction for text written to the LCD to left-to-right, the default

lcd-name.createChar(num, data) - Create a custom character (glyph) for use on the LCD. Up to eight
characters of 5x8 pixels are supported (numbered 0 to 7).

KEYPAD

is a contributed library that supports programming for matrix style keypads with the Arduino

keypad-name = Keypad(makeKeymap(user-key-map), row-pins, cols-pins, rows, cols);- A constructor


function use to instantiates a Keypad object.

makeKeymap(user-key-map)- A keypad function use to initializes the internal keymap to be equal to user-
defined keypad map

keypad-name.getKey(); - A keypad function use to returns the key that is pressed, if any. This function is
non-blocking.
getState(). A keypad function that returns the current state of any of the keys.

keyStateChanged(). A keypad function use to determine when the key has changed from one state to
another.

setHoldTime(). A keypad function that sets the amount of milliseconds the user will have to hold a button
until the HOLD state is triggered.

setDebounceTime(). A keypad function use set the amount of milliseconds the keypad will wait until it
accepts a new keypress/keyEvent.

addEventListener(Keypad-Event). A keypad function that Trigger an event if the keypad is used

PASSWORD

Password(). A constructor function use to instantiate password object.

set(). A password function use to set the target password equal to user-password.

is(). A password function use to test if the target password is equal to user-password.

append(). A password function use to append a character to the currently guessed password.

reset(). A password function use to reset the currently guessed password.

evaluate(). A password function use to guessed user-password is equal to the target password.
RTC

DS1307 RTC

RTC_DS1307. A RTC constructor function use to instantiate RTC object or variable.

DateTime. A RTC constructor function use to instantiate date and time object or variable.

begin(). A RTC function use to start RTC object.

Syntax: rtc-name.begin();

now(). A RTC function use extract the current date and time from DS1307 chip.

month(). A RTC function use extract the current month in integer format.

day(). A RTC function use extract the current day in integer format.

year(). A RTC function use extract the current year in integer format.

hour(). A RTC function use extract the current hour in integer format.

minute(). A RTC function use extract the current minute in integer format.

second(). A RTC function use extract the current second in integer format.
PART 2

Servo Motors

-internal gear-based transmissio

-0 to 180 degrees.

-closed loop

-small size

-large angular force (torque)

-internal control circuit

-electrically efficient

-require physical and electrical modification to move in 360 degrees

-Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega.

-On the Mega, up to 12 servos can be used without interfering with PWM functionality;

-(0-degree = 544 PWM)

- (180-degree= 2400 PWM)

1ms pulsed square wave = 0 degrees

1.5ms = 90 degrees

2ms = 180 degrees.


PROGRAM

attach(). A Servo function use to attach the Servo variable to a pin.

write(). A servo function use writes a value (angle) to the Servo, controlling the shaft accordingly.

writeMicroseconds(). A Servo function use writes a value in microseconds (us) to the servo, controlling
the shaft accordingly.

attached(). A Servo function use to check whether the Servo variable is attached to a pin.

detach(). A Servo function use to detach the Servo variable from its pin.

SoftPWM Library

- An Arduino and Wiring Library to produce PWM signals on any arbitrary pin.

-uses a single hardware timer (Timer 2)

-generate up to 20 PWM channels

SoftPWMBegin(). A SoftPWM function use to initializes the library and sets up the timer and other tasks

SoftPWMSet(). A SoftPWM function use to set pin use as PWM output pin and value between 0 and 255

SoftPWMSetPercent(). A SoftPWM function use to write duty cycle percentage between 0 and 100
(inclusive) in clone-pwm-pin.
SoftPWMSetFadeTime(). A SoftPWM function use configure fade up and fade down time in a clone-pwm-
pin.

fade-up-time is the time in milliseconds that it will take the channel to fade from 0 to 255 having a range
of 0 to 4000 ms

Stepper Motor

-offer precise rotation control .

-an turn in about 0.9 to 1.8 degrees in each direction

-high rotational speed.

-open-loop operation

360/ DEG PER STEP = NUMBER OF STEPS

(e.g. 360 / 3.6 gives 100 steps)

-TYPES

-Unipolar stepper motor -simplified control

-Bipolar stepper motor - greater torque

Stepping sequence - is a controlled switching of the motors coils.

-Full Stepping

-turning on a single electromagnet every time

-sequence requires the least amount of energy

-generates the smoothest movement.


-Double Stepping

-turning on two coils simultaneously.

- method does not generate a smooth movement

-requires double the current

-generates double the torque.

-Half Stepping

-0.9 degrees/step.

-double the current is required

-Micro Stepping

The controller has 5 inputs and 6 outputs:

2 inputs for logic voltage source (5V, ground)

2 inputs for the motors voltage source (up to 50v, 10A, ground)

2 inputs for controlling the step and direction

5 outputs for connecting the step motors


Stepper Library

-control unipolar or bipolar stepper motors.

PROGRAM

Stepper(). A function that creates a new instance of the Stepper class that represents a particular stepper
motor attached to Arduino board.

setSpeed(). A function use to set the stepper motor speed in rotations per minute (RPMs)

step(). A function use to turn the motor a specific number of steps, at a speed determined by the most
recent call to setSpeed().

For better control, keep the speed high and only go a few steps with each call to step().

PART 3

Passive InfraRed (PIR) Sensor

- measures infrared light emitted from objects that generate heat

-are small, inexpensive, low power, rugged, have a wide lens range

Ultrasonic Sensor

FORMULAS

- speed of sound = 0.334 us

- time = distance/ speed = 294 us


- distance = (time * 0.034)/2

S=Vxt

s= distance

V= velocity

T= time

speed of sound in air = 343m/s in dry air at 20ºC.

reciprocal

0.0343cm/us = 1/0.0343 = 29.15 us/cm

29.15us, sound travel distance of 1cm

-are defined as electronic devices that emit an acoustic wave beyond the upper range of human hearing
- called the audible range

-determine the distance between the sensor and an object based on the time it takes to send the signal
and receive the echo

-use a vibrating device known as a transducer to emit ultrasonic pulses

-cone shaped beam

- range of an ultrasonic sensor is determined by the frequency of vibration of the transducer.

-frequency increases the sound waves transmit for progressively shorter distances.

-long-range ultrasonic sensors = lower frequencies

-utilizes the sound waves to measure the distance of the object

APPLICATIONS

-parking assistance sensors in cars

-alarms

-medical ultrasounds
-distance measurement

-commercial fish finders

GPS

-TinyGPS

-is a compact Arduino library for GPS/NMEA parser.

- is designed to provide most of the NMEA GPS functionality with Arduino to determine the current
position, date, time, altitude

-does not handle retrieving serial data from a GPS unit. When encode() returns “true”, a valid sentence
has just changed the TinyGPS object’s internal state.

NMEA-National Marine Electronics Association

PROGRAM

encode(). A function use to feed the object serial NMEA data one character at a time.

get_position(). A function use to extract or query the GPS longitude, latitude, and altitude.

get_datetime(). A function use to extract or query the GPS current date and time.

get_datetime(). A function use to extract or query the GPS current date and time.

TinyGPS gps-name; - A contructor function use to create an instance of TinyGPS of an object.

course(). A function use to returns course in 100th of a degree.

stats(). A function use to provides statistics that help with troubleshooting with GPS.
chars - the number of characters fed to the object

sentences - the number of valid $GPGGA and $GPRMC sentences processed

failed_checksum - the number of sentences that failed the chaecksum test

library_version(). A function use to retrieve the version of the TinyGPS library.

For applications which are not resource constrained, it may be more convenient to use floating-point
numbers.

Three things must happen to get valid position and time/date:

1.You must feed the object serial NMEA data.

2.The NMEA sentences must pass the checksum test.

3.The NMEA sentences must report valid data. If the $GPRMC sentence reports a validity of “V” (void)
instead of “A” (active), or if the $GPGGA sentence reports fix type “0? (no fix) then those sentences are
discarded.

To test whether the TinyGPS object contains valid fix data pass the address of an unsigned long variable
for the “fix_age” parameter in the methods that support it.

To know the object has never received a valid fix use TinyGPS::GPS_INVALID_AGE.

To know the object has never received a valid fix use TinyGPS::GPS_INVALID_AGE.

If your NMEA data is coming from a serial GPS unit, connect it to Arduino’s hardware:

1.Hardware serial port ex. pin 0 & pin 1 in UNO

2.Software serial port


NewSofSerial Library

-is the latest of three Arduino libraries providing “soft” serial port support. It’s the direct descendant of
ladyada’s

-AFSoftSerial-which introduced interrupt-driven receives

In this example, we assume that read_gps_data() uses the gps object and read_thermometer_data() uses
the therm object. Any time you call the listen() method, it becomes the “active” object, and the previously
active object is deactivated and its RX buffer discarded. An important point here is that object.available()
always returns 0 unless object is already active.

Commands in SIM900 GSM module

AT+CMGF=1. Set SMS text mode format

AT+CMGF=0. Set SMS for PDU format

AT+CMGR=1. To read the first SMS from the inbox

AT+CMGR=2. To read the second SMS from the inbox.

AT+CMGL=ALL. To read all the SMS messages from the inbox.

AT+CMGS=mobile-number. To send SMS from SIM900.

AT+CMGD=1. To delete the first message from the inbox.

AT+CMGD=2. To delete the second message from the inbox.

ATDmobile-number\r\n. Calling to a number using SIM900.

ATHmobile-number\r\n.Hanging up a call in SIM900.

ATA\r\n. Receiving a call in SIM900.

AT+CLIP=1\r\n. Finding the number of the incoming call in SIM900.

S-ar putea să vă placă și