[go: up one dir, main page]

0% found this document useful (0 votes)
90 views42 pages

Interfacing Techniques: Sa'id Ibrahim Engineering Department Palestine Technical College Deir El-Balah

This document discusses interfacing techniques for connecting computers to peripheral devices. It covers topics like data acquisition, interfacing hardware through voltage, current and resistance measurements, higher-level interfacing using protocols like USB and Ethernet, and examples of interfacing technologies like Raspberry Pi and programming interfaces using Java. The document is a lecture on computer interfacing technologies and methods.

Uploaded by

fade
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)
90 views42 pages

Interfacing Techniques: Sa'id Ibrahim Engineering Department Palestine Technical College Deir El-Balah

This document discusses interfacing techniques for connecting computers to peripheral devices. It covers topics like data acquisition, interfacing hardware through voltage, current and resistance measurements, higher-level interfacing using protocols like USB and Ethernet, and examples of interfacing technologies like Raspberry Pi and programming interfaces using Java. The document is a lecture on computer interfacing technologies and methods.

Uploaded by

fade
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/ 42

Interfacing Techniques

Lecture 2

Sa’id Ibrahim
Engineering Department
Palestine Technical College
Deir El-Balah
Eng. Sa’id Ibrahim Abu Al-Roos 1
Interfacing Technology

Frequency

Eng. Sa’id Ibrahim Abu Al-Roos 2


Eng. Sa’id Ibrahim Abu Al-Roos 3
Interfacing Overview

Computer Interface Peripheral


•Wires •LEDs
•ICs •Sensors
•Resistors •Motors
•Capacitors •Lights
•Transistors •Robots
•Connectors •Joystick
•Music Box
•Touch Device

Eng. Sa’id Ibrahim Abu Al-Roos 4


Data Acquisition

Data Acquisition (DAQ) is the process that involves receiving signals


from events that occur in the real world. This includes analog values
such as temperature, vibrations, pressure and other physical measu
rements, as well as digital signals such as push-buttons or switches.

Data Acquisition is the process of :

• Acquiring signals from real-world phenomena


• Digitizing the signals
• Analyzing, presenting and saving the data

Eng. Sa’id Ibrahim Abu Al-Roos 5


Data Acquisition and Control Systems

Eng. Sa’id Ibrahim Abu Al-Roos 6


Typical data acquisition and control system

Timer
Digital control
circuit

Sensor Sample
Op-amp filter A/D
&
Hold
Computer
Mechanical Power
D/A
device circuit

Eng. Sa’id Ibrahim Abu Al-Roos 7


PC Based Interfacing

Eng. Sa’id Ibrahim Abu Al-Roos 8


Eng. Sa’id Ibrahim Abu Al-Roos 9
Eng. Sa’id Ibrahim Abu Al-Roos 10
constant pressure pump

Eng. Sa’id Ibrahim Abu Al-Roos 11


Computer and Interfacing
• What is a computer?
– Stores, Processes, Translates Information
– Digital Signal Processor
• Number Cruncher, I/O Processor
• Computer Architecture
– ALU, Control, Memory, I/O
– Interface - Computer(I/O) and Real World
• Why Interface?
– Electric Compatibility
– Protocol Compatibility (Language, Synchro, Timing)
– Time Buffering
• Instrument Control and Data Acquisition

Eng. Sa’id Ibrahim Abu Al-Roos 12


Interfacing - Hardware
• How can we interface each of these types of signals to a
computer?
– Voltage
• Compare to a reference voltage
– Current
• Pass it through a reference resistor, measure the voltage acr
oss the resistor
– Resistance
• Use a fixed resistor to make a voltage divider, measure the
voltage across one of the resistors

Eng. Sa’id Ibrahim Abu Al-Roos 13


Interfacing - Hardware
• Voltage
– Compare to a reference voltage

– Most microcontroller boards have 0-5V input lines. The 5V


reference is internal to the board.

– If your device outputs a voltage higher than the input range,


use a voltage divider to measure a fraction of it.

Eng. Sa’id Ibrahim Abu Al-Roos 14


Interfacing - Hardware
• Voltage divider:

Vout R2

V1 R1  R2 

Figure from http://hyperphysics.phy-astr.gsu.edu/hbase/electric/voldiv.html

Eng. Sa’id Ibrahim Abu Al-Roos 15


Interfacing - Hardware
• Current:
– Pass it through a reference resistor, measure the voltage across the
resistor

V  IR

Figure from http://digital.ni.com/public.nsf/allkb/82508CD693197EA68625629700677B70

Eng. Sa’id Ibrahim Abu Al-Roos 16


Interfacing - Hardware
• Resistance:
– Use a fixed resistor to make a voltage divider, measure the voltage
across one of the resistors

Eng. Sa’id Ibrahim Abu Al-Roos 17


Interfacing – Hardware
• Higher-level interfacing.
– Complicated sensors (cameras, GPS, INS, etc.) usually inclu
de processing electronics and provide a high-level output (U
SB, firewire, RS-232, RS-485, ethernet, etc.)

Eng. Sa’id Ibrahim Abu Al-Roos 18


Eng. Sa’id Ibrahim Abu Al-Roos 19
Raspberry PI Interfacing

Eng. Sa’id Ibrahim Abu Al-Roos 20


Eng. Sa’id Ibrahim Abu Al-Roos 21
For Raspberry PI Interfacing Visit http://exploringrpi.com

Eng. Sa’id Ibrahim Abu Al-Roos 22


Doing the Math
From Kirchhoff’s Voltage Law
VR  VT  VLED
VT  VR  VLED
 52
From Ohm’s Law

VR
R  3V
IR VR
R
IR
IR  ILED  20 mA 3V

Currents equal in a series cct 0.020 A
 150 
Eng. Sa’id Ibrahim Abu Al-Roos 31
Eng. Sa’id Ibrahim Abu Al-Roos 32
Motor Control
9V 2N3904
C
B
D0
E

M TIP31

(A stepper motor would require more outputs)

Eng. Sa’id Ibrahim Abu Al-Roos 33


The Programming

Eng. Sa’id Ibrahim Abu Al-Roos 34


Turning On the LEDs

Eng. Sa’id Ibrahim Abu Al-Roos 35


Turning Off the LED
• Outportb(0x378,0);

Eng. Sa’id Ibrahim Abu Al-Roos 36


Java: Preparing for Interfacing
• Download http://www.geocities.com/Juanga69
/parport/parport-win32.zip
• Extract the parport folder to your classes folder
• Copy parport.dll to you bin folder
• import parport.ParallelPort;
• ParallelPort lpt1 = new ParallelPort (0x378);

Eng. Sa’id Ibrahim Abu Al-Roos 37


Java: Output
ParallelPort lpt1 = new ParallelPort
(0x378);
int byteVal = 255;
lpt1.write(byteVal);
System.out.println("Output to port: "
+ byteVal);

Eng. Sa’id Ibrahim Abu Al-Roos 38


Java: Input
ParallelPort portIn = new ParallelPort
(0x378);
int in;
in = portIn.read ();
System.out.println (in + " is currentl
y being input.");

Eng. Sa’id Ibrahim Abu Al-Roos 39


Java Delay Method
private static void delay (int mS)
{
try {
Thread.sleep (mS);
}
catch (Exception e) {
;
}
}

Eng. Sa’id Ibrahim Abu Al-Roos 40


Delphi: Preparing for Interfacing
• Download io.dll from http://geekhideout.
com/downloads/io.dll
• Copy into project folder

Eng. Sa’id Ibrahim Abu Al-Roos 41


Delphi: Output
procedure PortOut(Port : Word; Data : Byte);
stdcall; external 'io.dll';

procedure TForm1.Button1Click(Sender: TObject


);
begin
PortOut(888,1);
end;

Eng. Sa’id Ibrahim Abu Al-Roos 42


Delphi: Input
function PortIn(Port:Word):Byte; stdcall; exte
rnal 'io.dll';

procedure TForm1.Button3Click(Sender: TObject)


;
var
InValue : Byte;
begin
InValue := PortIn(889);
label1.Caption := IntToStr(InValue);
end;

Eng. Sa’id Ibrahim Abu Al-Roos 43


Delphi Delay Procedure
procedure xSleep(milliseconds: LongIn
t);
var iTemp : Longint;
Begin
iTemp:= GetTickCount + milliseconds
;
while GetTickCount < iTemp
do
Application.ProcessMessages
End;
Eng. Sa’id Ibrahim Abu Al-Roos 44
Assembler: Output
MOV DX,0378H
MOV AL,n
OUT DX,AL

Where n is the value you want to output.

Eng. Sa’id Ibrahim Abu Al-Roos 45


Eng. Sa’id Ibrahim Abu Al-Roos 46
Matlab Interface code

Eng. Sa’id Ibrahim Abu Al-Roos 47


Resources

Eng. Sa’id Ibrahim Abu Al-Roos 48


Web Resources
• http://www.epanorama.net/circuits/parall
el_output.html
• http://www.lvr.com/jansfaq.htm
• http://www.doc.ic.ac.uk/~ih/doc/par/
• http://www.southwest.com.au/~jfuller/d
elphi/delphi1.htm

Eng. Sa’id Ibrahim Abu Al-Roos 49


Textbook References
• Practical Data Acquisition for Instrumentati
on and Control
• Signal Conditioning & Pc Based Data Acqui
sition Handbook
• Interfacing with C++
• Interfacing Sensors To The PC
• Digital.Interface.Handbook
• Analog_Interfacing_to_Embedded_Micropro
cessors
Eng. Sa’id Ibrahim Abu Al-Roos 50

You might also like