Introductory Interfacing & Electronics Peter Beens peter@beens.org Presented at Durham College November, 2004 Overview This presentation covers a basic introduction to interfacing with the parallel port and just enough electronics to keep you from damaging your computer.
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only.Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
Overview • This presentation covers a basic introduction to interfacing with the parallel port and just enough electronics to keep you from damaging your computer.
What Ports Can We Interface? • Parallel Port (AKA Printer Port) • Serial Port (AKA RS232) • Keyboard Port • USB??? (Hopefully soon…) We will concentrate on the Parallel Port
Three Main Invisible Electrical Properties • Voltage, V, Volts • Provides the “push” • Current, I, Amperes (Amps) • Flow of Electrons • Amount of Current is dependent on Voltage and Resistance • Resistance, R, Ohms (S) • Limits the amount of current
Safe Current & Voltage Levels • Voltage: 30 V • Voltages inside a computer do not exceed 12 V, except at the power supply and power switch on older computers, which are at 120 V.Be careful in these areas! • Current: 5 mA (0.005 Amperes)
Current • Is the flow of electrons • Direction depends on convention
Ohm’s Law “Current (I) is proportional to Voltage (V) and inversely proportional to Resistance (R)”
Ohm’s Law & Power Wheel Reproduced by permission of Tony van Roon, 2002http://www.uoguelph.ca/~antoon
Kirchhoff’s Laws • Kirchhoff’s Voltage Law • “The sum of the voltage drops equals the applied voltage”, or… • “The sum of the voltage drops around a closed loop equals zero” • Used in series circuits • Kirchhoff’s Current Law • “The current entering a junction must equal the current leaving the junction” • Use in parallel circuits.
Light Emitting Diodes (LEDs) • A type of diode designed toemit light • Can be visible or IR • 2 V voltage drop • Typically draws 20 mA (0.020 A) • Schematic Symbol…
Resistors • Can be rated by… • Resistance (Ohms, S) • Tolerance (% of nominal value) • Power Rating (Watts) • Schematic Symbol…
Parallel Port Specifications • Output Voltage • 0V for “low” • 5V for “high” • TTL (Transistor-Transistor Logic) • Output Current Limitation • 10-15 mA (careful!)
Understanding the LED Circuit • The parallel port output is 5V • A standard red LED needs ~20 mA and drops about 2 V • A resistor is needed to “drop” the excess voltage
Doing the Math From Kirchhoff’s Voltage Law From Ohm’s Law Currents equal in a series cct
2N3904 TIP31 Motor Control (A stepper motor would require more outputs)
Turing: LED Walking loop % loops up for i : 0 .. 7 parallelput (2 ** i) delay (500) end for % loops down for decreasing i : 6 .. 1 parallelput (2 ** i) delay (500) end for end loop
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);
Java: Output ParallelPort lpt1 = new ParallelPort(0x378); int byteVal = 255; lpt1.write(byteVal); System.out.println("Output to port: " + byteVal);
Java: Input ParallelPort portIn = newParallelPort (0x378); int in; in = portIn.read (); System.out.println (in + " is currently being input.");