+ All Categories
Home > Documents > Lecture 5 - NYU Tandon School of...

Lecture 5 - NYU Tandon School of...

Date post: 02-Feb-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
59
Lecture 5
Transcript
Page 1: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

Lecture 5

Page 2: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Capacitors 1• Store electric charge• Consists of two plates of a conducting material

separated by a space filled by an insulator• Measured in units called farads, F

Page 3: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Capacitors 2

Negative lead (-)Electrolytic

Mylar Ceramic

Page 4: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Capacitor Symbols

Fixed capacitor

Polarized capacitor

Variable capacitor

+

Page 5: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

How to Read Capacitor Value

• The first two figures give us 10, the third figure gives us 0000, and the letter 10%. We normally express this as 0.1µF.

Page 6: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Example: Capacitor Value 1

Page 7: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Example: Capacitor Value 2

Page 8: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Example: Capacitor Value 3

Page 9: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Example: Capacitor Value 4

Page 10: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

Lecture 6

Page 11: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photoresistors

•Light sensitive resistors •Resistance decreases when light intensity increases

Symbol

Page 12: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photoresistor: How It Works

Page 13: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Simple Light Meter

Page 14: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Light Sensitive Voltage Divider

Page 15: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Light Activated Relay

Page 16: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photoresistor with BS2

•Usually connect with a capacitor•Use RCTime command to find out light intensity

Page 17: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

RC CircuitR

C

+

Vo

-

+

Vi

-

11

)()(

+=RCssV

sV

i

o

RC is time constant, τ63.2% of the voltage output

in steady state (VA)

τ

Page 18: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Rctime with BS2

• Software version of analog to digital converter

• Pbasic rctime command– Rctime Pin#, state, variable

• Example code– High 5– Pause 3– Rctime 5,1, tau

Page 19: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photodiode• Transforms light energy to

electric current• Very linear• More sensitive than

photoresistor

Symbol

Page 20: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photodiode: How It Works

Page 21: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photodiode Applications

Page 22: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Photodiode with BS2

• Polarity: cathode connects to the ground

Page 23: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Phototransistor

• The base lead of a BJT is replaced by a light sensitive surface

Phototransistor Photo FET

Page 24: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Phototransistor: How It Works

Page 25: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Phototransistor Applications

Page 26: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Tachometer

Page 27: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Optoisolators 1

Closed Pair

Page 28: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Optoisolators 2

Slotted Pair Reflective Pair

Page 29: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Optoisolators 3

Integrated Optoisolators

Page 30: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Optoelectronic Sensors Experiments

5, 7, and 19StampWorks

Others

Robotics

4 (except DS1620)Earth measurements

8Basic A and DWhat’s micro controller

ChaptersExperiments

Page 31: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

Lecture 7

Page 32: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Rctime with BS2

• Software version of analog to digital converter

• Pbasic rctime command– High 3– Pause 3– Rctime 3,1, tau

P3

Page 33: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Analog to Digital Conversion

• Process of converting an analog signal to a digital number

• Three step procedure– Sampling (sample and hold)– Quantization– Coding

Page 34: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Sampling

Page 35: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Quantization and Coding

10010000

201030114100510161107111

Vo

Vi0 1.25 2.5 3.75 5 6.25 7.5 8.75 10

0V ~ 10V

V25.18

10 =

Page 36: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC

• Analog to digital converter• 8-bit successive analog to

digital converter• 0V to 5V input range• Single 5V power supply

Page 37: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC Pin Description

Regulated 5V (Power supply)Pin 8

Clock signal from BS2Pin 7

8 bit ADC outputPin 6

Span adjustmentPin 5

GroundPin 4

Zero offset adjustmentPin 3

0 to 5V analog input need to be digitizedPin 2

ADC is ready to do conversion when it is lowPin 1

DescriptionPinIdentifier

Page 38: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-1

• 0V to 5V analog input using a potentiometer

• Output is from 0 to 255– 8 bit resolution

Page 39: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Sample Code for ADC 1

adcbits var byte High 0Low 0Low 1Pulsout 1,210Shiftin 2, 1,MSBPOST, [adcbits\8]

Shiftin Data_pin, Clock_pin, mode, [variable\bits]

Serial communication

Page 40: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Sample Code for ADC 2

Q var wordR var wordQ = 13 /5R = 13 // 5Debug ? QDebug ? R

Debug window shows;

Q= 2R= 3

Quotient

Remainder

Page 41: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-2

• 2V to 5V limited analog input using a potentiometer

• Output is from 102 to 255– 8 bits resolution

25525555

10225552

VVVV

Page 42: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-3

• Using two potentiometers zero and span can be adjusted to get full 8 bit resolution

2552553

)25(

02553

)22(

=×−

=×−

VV

VV

Set zero to 2V Set span to 3V

Page 43: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-4

• 0V to 4V limited analog input using a potentiometer

• Output is from 0 to 204– 8 bits resolution

20425554

025550

VVVV

Page 44: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-5

• Using another potentiometer to span can be adjusted to get full 8 bit resolution

Set to 4V255255

44

025540

VVVV

Page 45: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-6

• 2V to 4V limited analog input using a potentiometer

• Output is from 102 to 204– 8 bits resolution

20425554

10225552

VVVV

Page 46: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC with BS2-7

• Using 2 potentiometers zero and span can be adjusted to get full 8 bit resolution

Set zero to 2V Set span to 2V

255255)24()24(

0255)24()22(

=×−−

=×−−

VVVV

Page 47: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

ADC0831 Experiments

27StampWorks

Others

Robotics

Earth measurements

1, 3Basic A and DWhat’s micro controller

ChaptersExperiments

Page 48: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

Lecture 8

Page 49: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Servo Motor• DC motors with feedback

position control • As long as the coded signal

exists on the input line, the servo will maintain the angular position of the shaft

• As the coded signal changes, the angular position of the shaft changes

Page 50: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Servo Motor: How It Work?• Consists of some control circuit

and a potentiometer• This potentiometer allows the

control circuitry to monitor the current angle of the servo motor

• If the shaft is at the correct angle, then the motor shuts off

• If the circuit finds that the angle is not correct, it will turn the motor in the correct direction until the angle is corrected

Page 51: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Servo Motor Wiring

Page 52: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Servo Motor with BS2Only when you use AA battery pack

2 servo motors only Need another capacitor for additional servo motors

Page 53: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Sample CodeX var byteOutput 12

Here:For X = 1 to 100Pulsout 12, 500Pause 10NextPause 500

For X = 1 to 100Pulsout 12, 1000Pause 10NextPause 500

Goto Here

Pulsout Pin #, Duration12 is pin number of BS2500 means 1milisecond

Page 54: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

PWM

• Pulse-Width-Modulation• An efficient method to deliver controlled amount of

power to loads such as motors• Use square voltage pulses• Modulation

– Process of controlling the duty cycle of square wave

• Pulse-width-modulator– The circuit used to achieve modulation tasks

Page 55: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

PWM - Duty Cycle

Amount of power delivered to load depending on duration of each pulse

Page 56: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

The Basic PWM Control

Page 57: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Stepper Motor

•Do not spin freely with just power

•Driven by the interaction (attraction and repulsion) of magnetic fields

•With proper sequence of the on-off pattern of the magnetic fields, the stepper turns (when it’s not, the stepper sits and quivers).

Page 58: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Stepper Motor with BS2

ULN 2803 high-current transistor driver

Page 59: Lecture 5 - NYU Tandon School of Engineeringengineering.nyu.edu/mechatronics/smart/pdf/lectures/LECT5_to_8.pdf · SMART Funded by The National Science Foundation ADC Pin Description

SMART Funded by The National Science SMART Funded by The National Science FoundationFoundation

Motor Experiments

25 and 26StampWorks

Others

Robotics

Earth measurements

Basic A and D3 and 4What’s micro controller

ChaptersExperiments


Recommended