Print Server Power Control Hack

Power Control Box

A few years a go I built this solid-state relay power control box.

It connects to a parallel port allowing me to turn the power points on and off using software. The parallel port allows for up to 8 outputs by using data 0 through 7 (Pins 2 though 9).

DB25 Connector

I’ve had this box attached to my HTPC for the last few years; I use it to control power to my TV, subwoofer, table lamp etc.

As mentioned in my previous posts I’ve just finished building a new HTPC, and guess what, it has no parallel port! I thought it would be a simple case of using a USB to parallel adaptor but unfortunately these adaptors aren’t seen by windows as standard parallel ports; instead it appears in device manager as a “USB Printing Support” device hence can’t be addressed directly to turn the data pins on and off.

Print Server

After much googling I came across a project by Doktor Andy which uses a network print server to drive external devices. This was perfect since I had a HP JetDirect print server. I wasn’t able to get Doktor Andy’s circuit working with the JetDirect but Boyan Biandov who’s name was on Andy’s site was very helpful and told me how to get the JetDirect working. A single 74LS04 chip is all that is required to invert the strobe output and feed it back into the busy input, I’m not really a wiz with electronics but as I understand it this fools the print server in to thinking that there is a printer attached and everything is “ok”.

* EDIT *

You DON’T need to use the additional chip at all. Fred kindly commented and pointed this out:

I have a trick to remove the 74ls04 chip : told the printserver ignore the busy data
a simple setting with any snmp tool
npPortCentronicsHandshaking OBJECT-TYPE
ACCESS read-write
STATUS optional
β€œThe handshaking to be used in sending data over the parallel port.”
::={ npPort 4 }

Smply change the value to 2

Gerrit and Milan have included some step-by-step instructions and a video below in the comments below on how to set this SNMP option.

Thanks to all have contacted me and contributed!

* EDIT *

Print Server PCB

Printer Server PCB (Bottom)

The IC requires +5Volts and it is also nessecicary to connect +5volts to pins 10, 13 and 15. It wasn’t hard to find a +5v point on the print server board.


Connections; What needs to be connected to what:

Credit goes to Doktor Andy for this great idea and BIG thanks to Boyan who gave me just the right info when I was about to give up!

Control Software

I’ve created a full windows application to control devices attached to print servers, local parallel ports and K8055 USB boards. Download and read about it here.

Here is the simple class which I use to access the print server. Say you wanted to turn on pins 2, 4 and 6. Combine the pin values


Required value to tun on pins 2, 4 and 6 is 1+4+16=21

Call the output method specifying the port as ipaddress:port and the output value:

(Most print servers use tcp port 9100, multi port JetDirects use 9100 for port one, 9101 for port two etc)


using System.Net; using System.Net.Sockets; using System; using System.Collections.Generic; using System.Text; namespace PowerControl { class IpPortAccess { public static void Output(string port,int value) { string[] ipport = port.Split(new char[] { ':' }); string _ip = ipport[0]; int _port = Convert.ToInt32(ipport[1]); Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); soc.Connect(_ip,_port); byte[] sendData = new byte[1]; sendData[0] = Convert.ToByte(value); soc.Send(sendData); soc.Close(); } } } 

, , , , , ,

46 Responses to Print Server Power Control Hack

  1. erco July 8, 2015 at 4:45 pm #

    I’m wrapping up my project, thought I’d follow up with a schematic I ended up using.

    I figured out the problem with Port #1 on my HP Jetdirect 510x’s — it didn’t like the 7404 trick; the STROBE pulse was too quick for it to detect.

    So I used a 555 as a “one shot” to more precisely emulate the printer’s BUSY and ACK signals:

    With this, all three of my Jetdirect 510x’s ports work normally. The 555 does a better job of simulating the timing diagram of what a printer does, holding BUSY and ACK. In my case I chose values that holds these states for about 100 microseconds.. much longer than the STROBE. The 510x seems to like this better, esp. on port #1.

    No SNMP settings needed, and this works /regardless/ of the “handshake” value being 2 or 3.

    In this circuit the 555 is rigged as a “monostable multivibrator”, also known as a “one-shot”; a short pulse input (from the -STROBE) gives a slightly longer pulse out (100 us). You can control the rate of data this way; adjust the R/C values (Resistor/Capacitor) to control data rate to whatever speed you want. Just change the 10k resistor and .01uF capacitor as needed. Google around, and you’ll find tables of R/C values for the 555 monostable multivibrator circuit to precisely choose specific pulse widths.

    I think fred spoke of doing this with a 555 in his Dec 1 2010 post (ne555 == 555); I’m sure he was talking about using it the same way. It’s a little bit more circuitry, but probably worth the trouble, as it’s surely better to emulate the printer as precisely as possible.

    BTW, beware: the wikipedia page on the parallel port seems to show the wrong active states for ACK, BUSY, ERROR and RESET. Here’s their diagram:
    To date it shows ACK being active hi, BUSY active low, etc. which I think are wrong. In the above 555 circuit diagram, I used their diagram but made the appropriate corrections; -ACK being active low, +BUSY as active high, etc.

    • RhysGoodwin July 8, 2015 at 9:34 pm #

      Hi Erco,

      Thanks again for all the info. Great work!


  2. Milan April 14, 2014 at 5:31 am #

    Just an update … I got me some cheap stepper motors and driver board … and then I remembered the JetDirect still sitting in a box since the video I posted earlier… turns out it’s easy peasy to connect ….

    one thing i dont get though is why it doesn’t work at anything above 4 bytes per second ! >:\

    • RhysGoodwin April 21, 2014 at 7:14 pm #

      Hi Milan, Thanks for stopping by. Very cool idea. Although I can’t seem to see the video (says it’s private).

    • erco June 29, 2015 at 9:37 pm #

      Be sure to set TCP_NODELAY for your TCP connection. Above a certain rate, TCP will cache the bytes you send, presumably to be more efficient for building up large blocks of data and sending them in one packet, instead of sending individual bytes as separate packets.

      In our case (sending bytes realtime), it works best to disable this “optimization” so we can have a “realtime” conversation with the device.

      Here’s some python code I’m using now during testing which shows how to set TCP_NODELAY:

      — snip
      import socket,time,os,sys
      ip = “”
      port = 9100
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
      print “connecting to %s on port %d” % (ip, port)
      server = (ip,port)
      while (1):
      print “ON”

      print “OFF”
      —- snip

      Without the TCP_NODELAY line, my sleep()s can’t be faster than .2 secs; the bytes get buffered and are pushed out all at once after enough bytes are cached.

      When I /set/ TCP_NODELAY (as shown above), I can go faster without trouble.

      I don’t know what the max rate is; I imagine if you send a byte stream, instead of a byte-at-a-time, you can send at the fastest rate the HP can handle.

      • erco June 29, 2015 at 9:40 pm #

        ..and as I knew it would, the blog website deleted the leading spaces from my python snippet above, which would make the code un-runnable as shown. All the lines following ‘while (1):’ should be indented 4 spaces for the above code to work.

        • RhysGoodwin June 29, 2015 at 9:49 pm #

          Hi Erco,

          Thanks for all the info. Much appreciated. I’m sure a lot of people will benefit. Sorry about WordPress messing with the code! I need a code-formatting plug-in for comments.


          • erco July 2, 2015 at 10:48 am #

            Thanks for the 7404 circuit, that worked great, as I’m using the jetdirect to control some TTL circuitry.

            I found with a lower power “LS” version of the 7404 (74LS04 = low power/schottky) I could power the chip with the +5v from pin #16 (the “RESET” line which should always be high). It seems to handle the current just fine. (Not the case with a regular 7404 — that needs too much current).

            For me, I can’t get the SNMP handshaking hack to bypass the Busy checking on my Jetdirect 510x ports (it has 3 parallel ports), I /have/ to use 7404 inverter trick. And I have two of these devices; both act the same.

            I know Fred mentioned that OIDs ending .0, .1 and .2 are a way to access the handshaking for the 3 different ports respectively, but it doesn’t seem to work for my 510x device; when I try to access the .1 and .2 versions of the OID, it complains with the errors shown below. I even upgraded to the latest firmware to date (from 08.60 -> 08.67), still no good. Example:
            $ snmpset -v1 -c jetdirect i 2 <– TRY .0 OF HANDSHAKE OID
            SNMPv2-SMI::enterprises. = INTEGER: 2 <– WORKS

            $ snmpset -v1 -c jetdirect i 2 <– TRY .1 OID
            Error in packet.
            Reason: (noSuchName) There is no such variable name in this MIB. <– FAILS

            $ snmpset -v1 -c jetdirect i 2 <– TRY .2 OID
            Error in packet.
            Reason: (noSuchName) There is no such variable name in this MIB. <– FAILS

            Perhaps this is a problem with my snmpset's internal MIB database.. but I'm thinking in this case it might be the /device/ that is responding with these errors. (I can't tell.. anyone know?)

            To complicate matters, I can only seem to use port#2 and #3 on these Jetdirect 510x's I have.. I could never get port #1 to work. I send bytes to it, but I can't see data on pins #2 – #9. Same on both of my Jetdirects, with or without the firmware upgrade. Maybe port #1 got blown up by a previous owner.. I know I didn't break em. But definitely port#1 acts differently than the other two.

  3. March 23, 2014 at 12:36 am #

    Nice wweblog right here! Also your site loads up fast!

    What web host arre you the use of? Can I am getting your affiliate link for your host?
    I wish my website loaded upp as quickly as yours lol

  4. POP cardboard displays March 22, 2014 at 12:42 pm #

    Hello there, I found your site by means of Google while searching for a comparable matter, your website came up,
    it appears great. I have bookmarked it in my google bookmarks.

    Hi there, simply was alert to your weblog via Google,
    and located that it is really informative. I’m going
    to be careful for brussels. I will be grateful should you proceed this in future.
    Many folks will likely be benefited from your writing.

  5. certification ceh April 19, 2013 at 9:08 pm #

    Every weekend i used to go to see this website, as i want enjoyment, since
    this this web page conations actually pleasant
    funny data too.

  6. Milan November 27, 2012 at 11:03 pm #

    OK, so yesterday I thought I’d have another go, and this time I was able to figure it out no problem. I think that my problem was the SNMP community name: it was set and thus needed to change the necessary value on the JD170x. So the solution was to reset the print server, set the community name and then use that new name when setting the value.

    I also made a little video tutorial for people of my skill level:

    Next step would be to try and connect this to a Velleman K8056 relay board I have lying around. Or maybe a cheaper relay board like this:

    • Gerrit November 30, 2012 at 4:36 am #

      Hi Milan (and all),

      I also made a step by step instruction on how to setup the Jetdirect in order to control it from PHP or a user application.

      Look at:


      • RhysGoodwin January 14, 2013 at 4:50 pm #

        Thanks so much for your input guys and apologies Gerrit for not getting around to loading your excellent content into the post. Anyway It’s all here now which is good and I’ll make a note above.

        Thanks Again,


  7. jefpeeters63 August 9, 2012 at 10:12 am #

    Yes the printserver is always powered,in trigger mode, in the morning the pc with the powercontrol soft is restarting and then the printserver gets one trigger.

    • RhysGoodwin August 9, 2012 at 10:16 am #

      Does the same thing occur when you restart the power control service with the windows services tool? Or only when the computer is starting?

  8. jefpeeters August 8, 2012 at 9:29 pm #

    Hi Rhys,

    Got everything working (with a few mods) but got one question , the power control server is not allways on , i mean , in the morning it’ starting and works until 18.OO .
    It works perfectly except while it is starting the power control server software it is triggering my port 5 for a short period , it’s like someone is triggering the contact.
    Is this something i can change ?
    Because it is triggering my garageport , , you understand it is not advisable that when i powerup the server my garageport is opening ….
    I hope you understand my problem here

    • RhysGoodwin August 9, 2012 at 9:39 am #

      Hey, are you using trigger mode with a print server? Does the print server remain on 24×7? Does the problem occur if you restart the powercontrol service from the services tool in Windows or does it only occur when you restart the computer?

  9. jefpeeters June 14, 2012 at 7:11 pm #

    Hello, i would like to use this to control a relais for 1 second’i mean just like i push a button to open an garagedoor’is this possible ?
    Who can help me plz?

  10. Milan December 26, 2011 at 1:02 pm #

    i’ve been cracking my brain about the setting the “” value to 2 with an SMTP tool and I just can’t figure it out πŸ™ Could someone help me with this part, step by step. (from a Windows machine). Thanks in advance.

    By the way: great job on the application.


  11. Andre Marthin Sinaga February 26, 2011 at 11:04 pm #

    I just found this web and very interested with it. I have some question. Is it possible to use the print server parallel port like LPT port? What I mean is: will I be able to read the status port, write the control port freely like in the LPT?


    • RhysGoodwin February 26, 2011 at 11:27 pm #

      Hi Andre,

      I haven’t done anything except for output so far. But take a look through Fred’s comments below and you should find the info you need.

      Thanks for visiting.


      • Andre Marthin Sinaga February 27, 2011 at 7:19 pm #

        Hi Rhys,
        Thanks for the reply. I see Fred uses the Status line as input. And you use Data line as output. What I didnt see is using the Control Line as output. Is it possible? Has anyone tried it?



        • RhysGoodwin February 28, 2011 at 3:15 pm #

          Yeah not sure sorry Andre. I guess you’ll just have to give it a go and let us know how you get on πŸ™‚


  12. fred December 19, 2010 at 11:39 pm #

    this week my garagedoor remotecontrol was broken, so i implement printer server to remot open trought cellphone
    i have tested the busy line as input but when this line whas up the outputs where locked then i tryed the paper out line and it works great with that i can know on my cellphone if the door is open or closed

    with this php code:

    $state = snmpget(“192.168.x.x”, “public”, “”);
    if ($status & 64) echo “”; else echo “”;

  13. fred December 1, 2010 at 9:01 am #

    if you want use the printserver as input you can ask snmp too with this register
    npPortStatusLines OBJECT-TYPE
    ACCESS read-only
    STATUS optional
    “The state of the centronics status lines from the peripheral. The
    value is a bit mask.
    Bit Value Signal
    0 0x01 nACK
    1 0x02
    2 0x04
    3 0x08
    4 0x10 nFAULT
    5 0x20 SELECT
    6 0x40 PERROR
    7 0x80 BUSY”
    ::={ npPort 5 }
    i have tested the inputs respond correctly with snmp client software but i wans’t able to install apache snmp layer on my debian for this time
    be carefull by using inputs and outputs while some channels are locking the outputs (select, error and aknowledgement) the others are free i think but i have not tested this configuration)
    the next step for me is to add a ne555 on the busy line to have timebase for exemple with 1second timebase if i want to have the 1 bit high for 4 seconds i send 4 bytes and a zero byte
    it’s better for automation i need this for my windows shutters
    another thing with 3 ports jetdirect

    the last zero of snmp adrress ist the port number 0:first 1:second 2:thirdt
    (for changing the handshake and asking inputs too)

    • Rhys December 2, 2010 at 8:24 am #

      Hi Fred.

      Thanks again for your comments. This is really great information. The question about inputs has been asked before but I haven’t been able to answer it. I’m planning to add input support to PowerControl for the K8055 so I will try to add input support for Jet Direct too.


  14. fred November 16, 2010 at 9:54 am #

    sorry for my english i’m french, snmp mean simple network management procol
    i have used a snmp client softare to change the value of register to 2
    this setting would be stored after powerloss

    look at google: snmp client , download , give the ip adress of the server and change the value
    make only the briges (10 13 15 all connected to 1) on the db25 connector no needs to open the printserver
    works great a command the printserver trought asterisk pbx software with my phone by calling a php page so i can switch things simply…

    • Rhys November 17, 2010 at 8:52 am #

      Thanks Fred, I’m going to give this a go on the weekend.

    • erco June 29, 2015 at 6:40 pm #

      On linux, if you have the “snmpwalk” command installed (which includes the “snmpget” + “snmpset” commands used below), you can get/set this value.

      To get and set this value, the following shows a screen history where I (a) check the current value and (b) change the value to “2”.

      $ snmpget -v1 -c jetdirect
      SNMPv2-SMI::enterprises. = INTEGER: 3

      $ snmpset -v1 -c jetdirect i 2
      SNMPv2-SMI::enterprises. = INTEGER: 2

      Note in the above: “$” is the shell prompt, “jetdirect” is the community name I set for the device (in the telnet menu with the “set-cmty-name:” command), and its IP address is The lines that start with “SNMPv2…” are the responses. It shows “3” was the default value before I changed it to “2”.

      In linux you can use the netcat command (‘nc’) to send a raw hex FF byte value to the port with e.g.

      $ print “\xFF” | nc 9100

      ..where \xFF is the byte to send, and 9100 is the TCP port# of the HP Jetdirect’s raw port.

      In my case I have an HP Jetdirect 510x which has 3 parallel ports, so port#1 is TCP port 9100, port#2 is 9101, and port#3 is port 9102.

  15. Milan November 10, 2010 at 3:46 am #

    Could you elaborate on the “a simple setting with any snmp tool”-part. What exactly is it that you need to do?

    • Rhys November 10, 2010 at 6:15 pm #

      Yeah it’s a bit vague. I’ll give this a go and see what I can come up with then I’ll update the post.

  16. Rhys October 20, 2010 at 10:23 am #

    Hey Fred,

    Thanks a lot. Great stuff. This really makes things easier! I’ve edited the post to include your tip.


  17. fred October 20, 2010 at 5:15 am #

    i have a trick to remove the 74ls04 chip : told the printserver ignore the busy data
    a simple setting with any snmp tool
    npPortCentronicsHandshaking OBJECT-TYPE
    ACCESS read-write
    STATUS optional
    “The handshaking to be used in sending data over the parallel port.”
    ::={ npPort 4 }

    simply change the value to 2
    sorry for my english i’m french

  18. george July 23, 2010 at 4:10 am #

    Brian > try using curl to po or some php in linux to connect and post 1 byte

  19. Brian June 8, 2010 at 2:45 am #

    I haven’t got that chip yet however i’ve connected up the status pin and it outputs ‘online’ i’ve put an led on 3&21 and it’s lit?

    • Rhys June 8, 2010 at 12:07 pm #

      Yea, you’ll just have to see how you go but I couldn’t get it working without inverting strobe line with the chip.

  20. Rhys June 8, 2010 at 2:35 am #

    The 74LS04 chip should fool the print server into thinking that everything is “ok” and ready to receive data.

  21. Brian June 8, 2010 at 2:30 am #

    Ah i’m with you, does the print server need to ‘think’ it’s online before the outputs can be controlled?

  22. Brian June 7, 2010 at 9:22 pm #

    Hi Rhys

    Do you have a diagram or list of the 8 outputs connections? in order to control the outputs do you merly need to call the ip address, port and output value? ie could it be done via a browser for example?

    • Rhys June 7, 2010 at 11:28 pm #

      Right, so the outputs you need to use are data0 – data7 of the parallel port, can’t remember the pins but it will be easy to find. Yes you just need the ip and port. The pins are addressed in 8 bits. data0=1, data1=2, data2=4, data3=8 etc so if you wanted to turn on data0 and data3 you would need to send a value of 9 (8+1). As for a web interface you should be able to do what you need with PHP.

  23. Rhys June 7, 2010 at 7:32 pm #

    Hi Brian,

    You can control 8 outputs without additional circuitry. I guess you might be able to use some thing like a shift register chip to get more outputs but I don’t have any experience with that. The other way to get more outputs is to use a print server which with 3 parallel ports each port is accessible on different tcp port e.g. 9100,9101,9102 etc.

    As for Linux, I’ve never done it but I’m sure it’s very easy. You may be able to do something with /dev/tcp I suspect.


  24. Brian June 7, 2010 at 9:22 am #


    I’ve been working on a similar project and will be doing another one with the 170x, can you tell me how many outputs can be controlled and also is it possible to do it via linux using command line? ie can the url,21 be called and the pinouts changed?



  1. Uhm goodie goodie. « computothought - March 13, 2012

    […] that started it all off was probably from Doktor Andy. Later it was expanded on from this article: Print server power control hack. I am even working on one of my own. Have another article about interfacing the parallel port […]

  2. PowerControl Home Automation - November 10, 2010

    […] Network Print Server (See my print server page) […]

Leave a Reply