Sunday, September 13, 2009

Notes on reading a switch position


Notes on reading a switch position (a physical switch in the real world) using pin 10:
Shorting pin 10 to pin 25 (with a resistor preferably) will change a signal from True (in python) to False. In python using i=getInAcknowledge() I can get i, a variable, to be true or false as I stick a wire between pins 25 and 10 (but use a resistor). Using a variable resistor I determined that about 3500 to 4000 ohms should work. This fits the circuits you see on the web that recommend - usually 3.7 K ohms. Would using no resistor burn out the port? Hmmm, well pin 11 went a bit flakey when I tried it. I may have damaged the pin 11 line because now it always reads False. I did try pin 10 with no resistor for just an instant and no damage was done. I'll install a resistor, though.


Pin 10 is nACK and in not inverted according to web sources


The link to python info is here:
http://pyserial.sourceforge.net/pyparallel.html#examples.
Here is some of the info:

setData(value)
Apply the given byte to the data pins of the parallel port.

setDataStrobe(level)
Set the “data strobe” line to the given state.

setAutoFeed(level)
Set “auto feed” line to given state.

setInitOut(level)
Set “initialize” line to given state.

getInSelected()
Read level of “select” line.

getInPaperOut()
Read level of “paper out” line.

getInAcknowledge()
Read level of “Acknowledge” line. - so this is my pin 10.


Here is a pinout:







. .

The pinout came from http://www.probotix.com/manuals/PBX-2_manual.htm

And it looks like they sell a Breakout Board solution so you would not need to fool around with much electronics when interfacing the parallel port. I wanted to learn more about electronics, so I built my own circuits.

Model: PBX-2
Breakout Board Specs:

* DB25 Female
* All Pins Brought Out
* Jumper Enabled Input Pull-up Resistors
* Integrated 5V Logic Supply Regulator
* PROBOTIX Pinheader & Screw Clamp Terminals
* Experimental USB Powered Logic Supply

Movie showing transport system working

This little movie shows the white leader film being pulled along by the pin, which is probably impossible to see. Using a spring, the pin rises up into a sprocket hole when the solenoid is not fired. Firing the solenoid lowers the pin so that the pin assembly can move backwards without dragging the film back with it. This cycle ultimately will drag an entire reel of film over my scanner bed. The copper tab presses the film down so the pin can reach through the plane of the film. (Since there is too much slop in my improvised film rails built from windshield wiper blade spines.) When the metal pins touches the copper I will read this as "pin engaged" through the parallel port and that would mean that it is okay to start advancing the film. Otherwise, the pin might be stuck when it hits the film where there is no sprocket hole. By determining whether the pin is "engaged" I can ascertain a start position (call it zero) so that by using the stepper steps I can precisely advance the film a known distance (eg., 500 steps distant from the zero position.) Then I can back up the film a few steps if need be. The metal parts are mainly Erector set parts that had lying around the house. Erector sets are perfect for prototyping robots. The pin assembly is attached to the metal bed where there was once a scanner assembly. As I built this I was wondering if the motor could really pull a strip of film along, and it can. But if the film hangs up, the entire bed gets pulled upwards as it tries to drag the stuck film. The film was only hanging here because I didn't have a spacer to keep the scanner lid fully away from the film. I guess it is time to add a take-up reel!

Here is the url of the movie, posted to photobucket:

http://smg.photobucket.com/albums/v241/pixhopwow/?action=view&current=MOV07480.flv