Connect with us

parallel port relay control

Discussion in 'Electronic Design' started by [email protected], Jan 2, 2006.

Scroll to continue with content
  1. Guest

    I am trying to control a relay from a computer's parallel port using
    the circuit labeled Fig B from this webpage The
    circuit works fine and I am able to control it with my software. But, I
    have no control while the computer is booting, where the the data lines
    can be set high or low. I need the relay to remain off until my
    program is running. I have read a suggestion that said to setup a
    hardware tri-state condition and use a second data line to act as
    control valve? Essentially, setup a unique state that is not normally
    produced by the computer or OS during the boot process. Can somebody
    suggest a way to modify the circuit in the above link. I am not a
    electronics expert, so providing a simple schematic would be helpful.
  2. scada

    scada Guest

    The relay is being energized because you choose a circuit that will trigger
    on a logic "1", or a +5V (high). The computer parallel port pin you are
    using will boot to a "high" before it sees your programmed information. You
    could simply use a control "Low" (0 volts) and use either circuit "A" (with
    some modification) or circuit "C" as is. Please note that if your circuit is
    critical, do not rely on this alone! There are safer, better ways to ensure
    the proper decoding is received from the port! I would also like to add the
    fact that direct connecting to an external circuit, such as circuits B & C,
    are not good practice. The circuit "A" diagram offers isolation from the
    computer port, that way if something goes wrong it cannot back into &
    destroy the computer! If you post your requirements in detail, the talent on
    this NG can come up with a solution.
  3. scada

    scada Guest

    A quick answer to this would be to add some gates to your circuit that would
    decode a series of port pins. For instance, if you used all eight data port
    pins (D0 - D7), that would give you a 1 of 256 decoder. That output (high)
    would then input to your existing relay circuit. The way you wire the gates,
    would reflect the code number, which would be from 0-255. I suck at ASCII
    art, so I won't attempt to draw a circuit here. Perhaps someone else will do
    that, or I can email you a scanned pdf if needed.
  4. Guest

    Thanks for the reply. The unknown for this problem is what parallel
    port state is set by BIOS and OS during the boot process. Its not
    consistent from among computers, so some kind of unique coded control
    is needed to control the relay. I just saw the second reply about
    using a gate and that appears to be the answer to my problem. About
    the isolation.. I am hoping the diode across the coil is good enough to
    stop any back voltage from blowing up the port.
  5. Guest

    I never thought about using gates and that would solve my problem. Do
    you have any suggestions about which chips I should be using? If you
    can send that scanned circuit, I would appreciate it. Thanks!
  6. Guest

    i understood your problem. you can do one simple thing . use nomally
    open switch for off state, instead of normally closed. Now logic 1 will
    appear at the printer port while computer is booting.

    Pravin Falcao
  7. ehsjr

    ehsjr Guest

    If you do not know what appears on the port during boot, it
    is impossible to design a circuit using that port that is
    *guaranteed* to avoid operation during boot. Therefore, go
    to a manual solution. Use a toggle switch to switch the relay
    out of circuit during boot. After boot, flip the switch to on.

    To do it without needing manual intervention, you will
    have to discover some condition that occurs *only*
    after boot is completed - which implies knowing what
    happens during boot.


    I just saw the second reply about
  8. budgie

    budgie Guest

    or institute some form of hardware time delay on the relay board, assuming the
    board has another way of sensing that the PC is turned on.

    (I cheat - all my PC's have the internal +12V and gnd brought out to the rear of
    the case, for use on add-ons. Perfect for driving a time delay).
  9. Guest

    This is quite true if the OP needs a guaranteed error free situation.
    OTOH if all s/he wants is something with 99.6% chance of doing what its
    told, which is enough for some apps, the OP could use the code 10101010
    to turn that relay on.

    This can be done with discrete gates. Put your 4x 0 lines thru a hex
    invertor. Now all you need is to AND your 8 lines. Not rocket science.

    If you're working with critical apps, eg life support, military, safety
    critical etc, dont even think about using this approach.

    Also I dont know whether you could put something in bootup files to set
    the port before the PC gets into windows/etc. Doable with DOS but with
    NT I really woudnt know.

    With a little more complication, one could add a timer triggered by any
    line going high. Once a line goes high, the timer waits for long enough
    for bootup, then starts listening for that 10101010. Now you've got a
    very low error rate with cold boots, warm reboots will give you that
    99.6% again.

  10. Fred Bloggs

    Fred Bloggs Guest

    I am trying to control a relay from a computer's parallel port using
    That cannot be done reliably. The only reliable way would be to add a
    PIC or Basic Stamp that holds the relay driver off until it is unlocked
    by a 32-bit code shifted out a data line by your program.
  11. Sjouke Burry

    Sjouke Burry Guest

    What I did is just check port pins during bootup, and find one
    which stayed in a stable condition, Then i used that one,as
    power reset on my electronics. After you start your program,
    invert that pin, to start the fun.
  12. Bob Monsen

    Bob Monsen Guest

    I'm assuming you have an external supply which powers the relay.

    Use a counter with an active low reset. The port will try to pull down to
    gnd when the computer is off (you probably want to have a pull down
    resistor of like 10k in case it doesn't). If the counter comes out of
    reset because the pin connecting it is high, it'll still be reset to its
    initial state.

    So, the process of turning on the relay is to bring the counter out of
    reset, and then to clock it using another data pin which is connected to
    the clock input. To add to the fun, you can have a feedback pin at the
    output, connected to a status pin, that tells you when the count is
    complete. Any binary 4 bit counter should work. You could use the Q3
    output, and then it would take 8 clocks to make it turn on. When you want
    it off, just reset the counter. A '163 should work.

    This will be safe unless some other program tries to flip bits on the port
    before you get to it.

    Bob Monsen

    "Nothing before had ever made me thoroughly realise, though I had read
    various scientific books, that science consists in grouping facts so
    that general laws or conclusions may be drawn from them."
    -- Charles Darwin
  13. scada

    scada Guest

    I posted a schematic to Alt.binaries.schematics.electronics, for your

    Good Luck!
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day