Tom Klepl <tk@enterprise.ca> wrote:
>I want to build an interface between a model car (2 motors) and the
>computer paralell port, which will allow me to control the model car
>with the computer.  I have been able to toggle the state of each pin of
>the paralell port, but I don't know how to build the electronics to
>control the motors.  I believe I need transistors to be used as
>switches, but I don't know which ones to get and how to build the
>circuit.


  A couple questios, do you need speed control?  Do you need to reverse the
motor?  I give a couple very basic circuits below to control a power circuit
from a digital signal for simple on/off...


                                 5 to 20VDC
                                    |
                                   _|_          This circuit is a basic way
                                  |   |      to turn on relays. LED's or 
                                  |   |Load  lamps with a digital line.  It
                                  |   |      is good for about 0.5A depending
                                  |___|      on the transistor.  Use a  
                                    |        2N2222 for starters.
                                    |
                                   /
                     10K        |/
 Digital Out  ------/\/\/-------|     NPN transistor
                           |    |\|
                           |       \
                           /        |
                       10K \        |
                           /       Gnd
                           \       
                           /
                           |
                           |
                          Gnd


  If you are powering an inductive load you need to protect the circuit
against the inductive kick that can be generated when turning the load off.
Inductive loads are generally anything that has a coil of wire, including
relays or DC motors.  A diode across the load is the usual solution...


                   +DC
                    |
                    |________
                    |        |
                    |        |
                  __|__      |
                 |     |     |
                 |     |   __|__
            Load |     |    / \   diode
                 |     |   /___\  1N4148 for small relays
                 |     |     |    1N4001 for larger stuff
                 |_____|     |
                    |        |
                    |        |
                    |________|
                    |
                    |
            to transistor switch


  For more current use a power MOSFET in place of the transistor.  MOSFET's 
have a lower 'on resistance'.  This means it will run cooler at higher current
levels than a bipolar transistor.

                                  5 to 20VDC
                                    |
                                   _|_      
                                  |   |      
                                  |   |Load 
                                  |   |      
                                  |___|     
                                    |      
                                    |
                                    |D
                     10K        |---
 Digital Out  ------/\/\/-------|     MOSFET
                                |->-
                                    |S
                                    |
                                    |
                                   Gnd
                   

  If you want to completely isolate and protect the computer port against
accidental damage an opto-isolator is a good idea...

                                    +5V
                                     |
                                     |
                                     /
                                     \ R2
                                     / 470
              R1                     \
              470                    |_________  Isolated digital out
  Digital ---\/\/\-------            |           to transistor switch.
                         |          /
                        _|_      |/
                        \ / ->   |       The LED and transistor are sold in      
                        ---      |\|     a single package as a opto-isolator.
                         |          \    Higher voltages than 5V can be used 
                         |           |   on the output, but R2 must be raised
      Gnd ---------------            |   to keep the current down.
                                    Gnd


  Just a couple ideas to play with...   Have fun.


--------------------------------------<>--------------------------------------
Andrew Cooper             Embedded Systems Designer    mailto:acooper@pcc1.com
Power Convertibles Corporation     Tucson, AZ              "http://www.pcc1.com"                 
          

A man whose only tool is a hammer, sees every problem as a nail.  -Unknown

It is only myself who is reponsible for the above drivel, any opinion is mine,
any dissagreement is with me, don't bother to bring the corporation into it. 
--------------------------------------<>--------------------------------------


Date: 18 Mar 1996 17:09:30 GMT

Original Subject: Re: Parallel port interface


Comment on this article


Comments on this article


This article is referenced in the following indexes: