LAB · FUNCTION · VOLTAGE/CURRENT RANGE · OUTPUT

LAB PRACTICAL
REPORT: SENSORS AND ARDUINO UNO BOARD

 

Submitted by:
AKHIB PASHA
16035944
 

 

 
 
 

SECTION A

CONTENTS

 
ARDUINO UNO BOARD

 
 
 
2-3

1.
 
 
 
 
 
2.
 
 
 
 
 
 
3.
 
 
 
 
 
 
4.
 
 
 
 
 
5.

ATMEGA328P MICROCONTROLLER
·        
FUNCTION
·        
VOLTAGE/CURRENT RANGE
·        
OUTPUT VALUE(S)
·        
APPLICATIONS
 
IN-CIRCUIT SERIAL PROGRAMMER (ATMEGA328P MICROCONTROLLER)
·        
FUNCTION
·        
VOLTAGE/CURRENT RANGE
·        
OUTPUT VALUE(S)
·        
APPLICATIONS
 
5V VOLTAGE-REGULATOR
·        
FUNCTION
·        
VOLTAGE/CURRENT RANGE
·        
OUTPUT VALUE(S)
·        
APPLICATIONS
 
16MHz RESONATOR
·        
FUNCTION
·        
VOLTAGE/CURRENT RANGE
·        
OUTPUT VALUE(S)
·        
APPLICATIONS
 
P-CHANNEL MOSFET
·        
FUNCTION
·        
VOLTAGE/CURRENT RANGE
·        
OUTPUT VALUE(S)
·        
APPLICATIONS
 

2
 
 
 
 
 
2
 
 
 
 
 
 
 
3
 
 
 
 
 
3
 
 
 
 
 
3

 
SECTION B

 
WIRING DIAGRAM

 
3-4

 
 
 
 
SECTION C

 
Informal wiring diagram of a Servo-Actuator-Potentiometer setup with
Arduino Uno board
 
SENSORS

 
 
 
 
4-5

1.
 
 
 
 
 
2.
 
 
 
 
SECTION D

ULTRASONIC SENSOR (HC-SR04)
·        
OPERATINGRANGE (VOLTAGE/CURRENT)
·        
AUTOMOTIVE APPLICATIONS
·        
POSSIBLE INACCURACIES
 
POTENTIOMETER
·        
OPERATINGRANGE(VOLTAGE/CURRENT)
·        
AUTOMOTIVE APPLICATIONS
·        
POSSIBLE INACCURACIES
 
CODING FOR SERVO-SENSOR
SETUP WITH POTENTIOMETER.

4-5
 
 
 
 
5-6
 
 
 
 
 
6

SECTION A: ARDUINO BOARD

Fig 1.
Arduino Uno board

1. ATMEGA328P
MICROCONTROLLER

FUNCTION: ATMEGA328P
is a microcontroller from the AVR family; it is an 8-bit device, which means
that its data-bus architecture and internal registers are designed to handle 8
parallel data signals.

It has 3 types of memory:

·        
FLASH
MEMORY: It is used for storing application, which explains
why you don’t need to upload your application every time you unplug Arduino
from its power source.

·        
SRAM
MEMORY: Storing variables used by the application while it’s
running.

·        
EEPROM
MEMORY: It is used to store data that must be available even
after the board is powered down and then powered up again.

VOLTAGE/CURRENT RANGE:

·        
ATMEGA 328P microcontroller accepts supply voltages
from 1.8V to 5.5V.

·        
Current range: +40mA

·        
Operating frequency:16MHz

OUTPUT VALUE(S): Current: -40mA

APPLICATIONS:

This product helps the automotive OEM’s develop vehicles that are safer,
cleaner, more fuel efficient and more reliable.

·        
APS control system,

·        
Camera vision system,

·        
Controller area network (CAN),

·        
Capacitive discharge ignition,

·        
LED Lighting,

·        
Remote keyless entry,

·        
Smart actuators,

·        
Wiper controller systems.

2. IN-CIRCUIT
SERIAL PROGRAMMER (ATMEGA328P MICROCONTROLLER)

FUNCTION: In-System
Programming (ISP) is a technique where a programmable device is programmed
after the device is placed in a circuit board. ICSP is an enhanced ISP
technique implemented in microchips one-time programmable (OTP) and FLASH RISC
microcontroller unit. Use of only two I/O pins to serially input and output
data makes ICSP easy to use and less intrusive on the normal operation of the
microcontroller unit.

VOLTAGE/CURRENT RANGE:

·        
Voltage range: 5V

·        
Current: +40mA.

APPLICATIONS:

·        
Serial communication without PC or laptop.

·        
It is also used to update Arduino software.

·        
It is a protocol used to programme Arduino.

3. 5V
VOLTAGE-REGULATOR

FUNCTION: A
voltage regulator generates a fixed output voltage of a pre-set magnitude that
remains constant irrespective of changes in its input voltage or load
conditions.

VOLTAGE/CURRENT RANGE:

Max
input voltage ranges from 7V-35V and
standby current 5 mA.

OUTPUT VALUES:

This is the basic L7805 voltage regulator, a 3-terminal positive
regulator with a 5Vfixed output voltage. This fixed regulator provides a local
regulation, internal current limiting, thermal shut-down control, and safe area
protection. Each one of these voltage regulators can output a max current of
1.5A.

APPLICATIONS:

·        
Internal combustion engine,

·        
Current regulator,

·        
Regulated dual supply,

·        
Building circuits for phone charger,

·        
Ups power supply circuits,

·        
Portable CD player etc.

4. 16MHz
RESONATOR

FUNCTION: It
is use to generate clock signals.

It is an electronic component consisting of a piece of piezoelectric
ceramic material with two or more metal electrodes attached. When connected in
an electronic oscillator circuit, resonant mechanical vibrations in the device
generates an oscillating signal of a specific frequency.

VOLTAGE/CURRENT RANGE:

·        
Voltage: 5V

·        
Current: 40mA

 

APPLICATIONS:

·        
It can used as a source of the clock signals for
digital circuits.

·        
It is used in circuitry in TV’S, automotive electronic
devices, telephones etc.

·        
It can be used as a signal generator in an electronic
circuitry.

5. P-CHANNEL
MOSFET

FUNCTION: How
to drive P-channel MOSFET with ATMEGA328P MICROCONTROLLER?

P-channel MOSFETs are useful for switching positive supply of a target
circuit ON and OFF. Particular attention must be placed to the target circuit
ensuring that the supply voltage is greater than the microcontroller’s logic
voltages.

VOLTAGE/CURRENT RANGE:

Voltage:
-5V

Current:
-4amps.

APPLICATIONS:

·        
MOSFET can be used as a switch to operate a DC motor.

·        
Controlling the intensity of an array of LEDS

·        
Switching lamp.

·        
Switch mode power supplies, variables frequency
drives.

·        
Radio systems use MOSFETs as oscillators or mixers to
convert frequencies.

SECTION
B: WIRING DIAGRAM

Informal wiring diagram of a
Servo-Actuator-Potentiometer setup with Arduino Uno board:

 

Fig2. Wiring
diagram

The potentiometer terminals are wired so that its middle pin(
green)  is connected to analog input 0 on
the Arduino Uno board, and its two outer pins( orange and blue)  are connected to power +5V and ground.

The
servo motors have 3-wires: yellow (SIGNAL), blue (POWER) and red (GROUND).

The signal pin wire (yellow) is connected to a digital pin 9 on the digital
output, the power wire (blue) is connected to the 5V pin on Arduino board and
the ground wire (red) is connected a ground pin on the Arduino Uno board.

WHY
HAVE YOU CONNECTED IT TO A DIGITAL/ANALOGUE PIN?

1. The 10 k? potentiometer’s centre pin is connected
to the analog input pin.

When the shaft of the potentiometer is rotate in a circular direction, the
amount of resistance changes on either side of the wiper which is attached to
the signal pin of the potentiometer. This gives the different analog input and
changes the relative closeness of the pin to 5volts and ground. When the
potentiometer’s shaft is rotated in circular direction up to 360deg, we read 0
as there is supply of 0volts to the pin. When the shaft is rotated all the way
in the other circular direction up to 360deg, we read 1023 as there is supply
of 5volts to the pin. In between, analogRead() returns a number between 0 and
1023 that is proportional to the amount of voltage being applied to the pin.

2.  The signal
pin wire (yellow) is connected to a digital pin 9 on the digital output.

The
amount of time the servo will be OFF and ON depends on the value obtained by
analogRead().

Digital
pins configured as OUTPUT with Pinmode() are said to be in a low-impedance
state. Output digital pins can provide a substantial amount of current to
servo. Arduino pins can source +40mA or sink -40mA of current to servo. This
current is enough to run servo motor.

IS IT
NECESSARY FOR A RESISTOR TO BE INCLUDED AND WHY?

RESISTOR: “A
resistor is a passive electrical component with the primary function to limit
the flow of electric current”.

The potentiometer is an electric instrument that is used for measuring
voltage by comparison of an unknown voltage with a known reference voltage. A
fraction of a known voltage from a resistive slide wire is compared with an
unknown voltage by means of a galvanometer.

SECTION
C: SENSORS

1.ULTRASONIC
SENSOR (HC-SR04)

An ultrasonic sensor transmits ultrasonic waves into the air and detects
reflected waves from an object. The sensor head emits an ultrasonic wave and
receives the wave reflected back from the target. This sensor provides 2 cm to
400 cm of non-contact measurement functionality with a ranging accuracy that
can reach up to 3 mm.

Ultrasonic sensors are driven by intermittent waves called burst waves.

It includes an ultrasonic transmitter, a receiver and a control unit.

Fig3. Working of ultrasonic sensor

The transmitter transmits the ultrasonic waves towards the object to be
detected. The receiver receives the echo from the target and determines its
distance.

Fig4. 4-pin ultrasonic sensor

OPERATING RANGE (VOLTAGE/CURRENT):

·        
Voltage: DC 5V

·        
Current: 15mA

·        
Frequency: 40Hz

·        
Measuring angle: 15º

·        
Ranging distance: 2 – 4 cm.

AUTOMOTIVE APPLICATIONS:

·        
Ultrasonic sensors for parking cars- parking sensors
use a type of SONAR

·        
Car detection sensor

·        
Near-distance obstacle detection

·        
Fuel level

POSSIBLE INACCURACIES:

·        
It is very sensitive to variation in the temperature.

·        
It has more difficulties in reading reflections from
soft, curved, thin and small objects.

2.
POTENTIOMETER

A potentiometer is a 3 terminal resistor with a sliding or rotating
contact that forms an adjustable voltage divider. The potentiometer is an
electric instrument that is used for measuring voltage by comparison of an
unknown voltage with a known reference voltage. A fraction of a known voltage
from a resistive slide wire is compared with an unknown voltage by means of
a galvanometer. The sliding contact or wiper of the potentiometer is
adjusted and the galvanometer is briefly connected between the sliding contact
and the unknown voltage. The deflection of the galvanometer is observed and the
sliding tap is adjusted until the galvanometer no longer deflects from zero. At
that point the galvanometer draws no current from the unknown source, and the
magnitude of voltage can be calculated from the position of the sliding
contact.

The
potentiometer terminals are wired so that its middle pin is connected to analog
input 0 on the Arduino Uno board, and its two outer pins are connected to power
+5V and ground.

Fig5. 3pin Potentiometer

OPERATING RANGE (VOLTAGE/CURRENT):

·        
Length of stroke: <1" to 29" or more ·         Voltage : 0 to VCC ·         Resistive value:10 k? ·         Current: 50V AC ·         Sensor value ranging: 0 to 4095. AUTOMOTIVE APPLICATIONS: ·         Car stereos, dimmers, equalizers. ·         Crankshaft and camshaft rotational control of spark and fuel injection timing. ·         In electronically controlled gear shifting to detect transmission input and output shaft speeds. ·         Applied to detect wheel speed, playing a major role in Electronic braking system, Traction control and stability systems. ·         Potentiometer constitute a key element in "Brake-by-wire" technology, "Drive-by-wire technology", Active suspension, Automatic headlight levelling, as well as in wiper, mirror and seat positioning. POSSIBLE INACCURACIES: Total resistance on the resistive track because the temperature fluctuations only have effect on the resistance. SECTION D: CODING FOR SERVO-SENSOR SETUP WITH POTENTIOMETER. #include //include the
servo library

//variables
for the servo motor

int pos; //declare variable for servo
position

int servoPin = 9; //declare the
pin where the servo is connected

int servoDelay =15; //delay to allow
the servo to reach position and settle down

//variables
for the potentiometer

int potRead; //declare
variable for the value read from the potentiometer

int potPin = A0; //declare the
pin where the potentiometer is connected

Servo myServo; // create a
servo object called myServo

void setup() {

  myServo.attach(servoPin);
//declare to which pin is the servo connected

}

void loop() {

  potRead
= analogRead(potPin); //read the potentiometer

  pos =
(170./1023.)*potRead+5; // calculate the position from the potentiometer
reading

  myServo.write(pos);  //write the position on the servo

  delay(servoDelay);

}