Parallel port trigger tells me when I’m transcoding

I decided to finish up my Cylon Eye (Larson Scanner) project by adding it as a status indicator for my computer. I record over the air programming and transcode it to DVD quality. Since things can be a bit slower when FFmpeg is running, I set it up for the Eye to scan to let me know it’s processing a video file in the background. All the details after the break but here’s the gist of the system:

  • Python script started by the FFmpeg transcoding script
  • It controls the Parallel port, driving pin 1 high to turn on the cylon eye
  • the ‘pidof’ command is called every minute for FFmpeg. When it is not found, the cylon eye is turned off and the script exits

Continue reading

Python parallel port control

 

Looking for a really easy way to control your project from a computer? If you have a parallel port which isn’t used you’re in luck. Python has a module that makes it easy to toggle the pins on the parallel port

First install the pyParallel module. It’s in the Ubuntu repositories:

sudo apt-get install python-parallel

To use the module just import it, instantiate an object, then write or read from that object.

import parallel
parPort = parallel.Parallel()
parPort.setData(0x01)

Now, this threw a permission error for me. But a bit of searching led me to find that you need to remove the lp module and insert the ppdev module:

sudo rmmod lp
sudo modprobe ppdev

This module will load again next time you reboot. Consider blacklisting it if you are using automated Python scripts that need parallel port access.

That’s it! Don’t you love Python? Of course there are some additional functions availalbe for this module so check the documentation to see what else can be done.