Please help me with building a paper tape reader (punched tape)

Hi,
I was in desperate search for a circuit diagram, to build a paper tape reader until I thought, the best way to do it was with the Arduino.
I need to read a paper tape of 8+1 holes(I'll explain in a minute).
I have been experimenting with my Arduino Diecimila, but nothing serious.
My problem is, that I need to decode this paper tape, that is around 980 characters long, to enter the program in a CNC machine via a laptop; actually I need to have a text document with the decoded text.
The Arduino needs to read the 8 holes (coded character) and has one more hole, that could show the stability of the data while reading it,
I mean if you read it (via light) you have data if the sensor is between two holes, these being close to each other.
This means that the algorithm has to verify if the data is stable, then decode the bits into letters, and write it in the serial monitor.
I really don't know how I should read the bits from the paper tape, and how to read the characters, if i pull the tape through the reader.
If it checks for the last letter not to be the same as the read one, it will ignore the repeated characters in the program.
Thank you!

Are you connecting to a reader or building a reader.
Have you a picture of the tape? How wide is the tape.

Would it be possible just to scan the tape and write a picture decode?

8+1 I guess the +1 is the timing key on the tape and the other 8 holes are the 8bit data with a hole = 1

Could do an optical reader, with 8+1 sensors (Or 1 that moves).

What is this tape from/for? You mention CNC - is it a CNC program tape? Do you know what machine it was for? Do you have the manual or other information for that original machine? Do you have scan or a picture of the first foot or so of holes on the tape?

Your first goal should be in identifying this information if possible; if it is an old CNC program tape, talking to some old-timers who used/programmed such machines might be helpful (if you can locate one). Otherwise, you might find something regarding the coding online, or in a book (I might have some information in my personal library, if I knew more about the tape).

Without seeing the tape, the 9th hole could be a parity-check hole, it could be a timing hole, or it could be an indexing hole for an advancing cog (or a combination of the last two); it could be that the data is encoded in 7 bit ASCII with the 8th bit being parity. It might be in EBCDIC or Baudot code for all anyone knows.

Once you know the encoding, then you can think about decoding it. Building something with an Arduino is possible, but it might be simpler to scan it and decode it that way, as already mentioned (heck - have you looked to see if maybe somebody has already done all the hard work of this?). Either way, before thinking about the hardware, you need to get a grasp of what the information on the tape in encoded in first if you can.

I use to work on paper tape readers why back then. The newest I worked on in the 70s used IR light emitters and detectors looking through the 8 data channels and one sprocket channel. They were pretty simple as the data was all parallel. The timing was done by using the small middle sprocket holes as the data ready strobe to tell the receiving device that the other 8 output channels held valid data. As the sprocket hole is smaller in diameter then the other eight data holes that method worked well and made the data integrity independent to tape speed variations.

Lefty

Used to do a bit of paper tape for cnc machines waaaaay back. If I recall the spacing is .10 " so that would make your tape about 8 ft long. The smaller hole (I seem to recall that it is offset from the center so there are 3on one side and 5 on the other side of it so to know which side of the tape goes against the reader) was used for moving the tape thru the reader or the punch. Blank tape would already have this hole.

If this is just a one time read of the tape see if there is a local machine shop that still has a cnc with a tape reader or a stand alone punch reader. I used to have a bunch of teletypes that could read the tape or punch the tape as you typed. I still have a bridgeport cnc that can read the tape. The cnc usually has an rs232 port also so the program that is read can also be sent out.

If you are reading a bunch of these tapes then maybe look for a used reader or a generous cnc machine shop owner. I did see that when this was a commom storage medium that there were homemade ones made because the readers were expensive at the time.

kevindorner:
If it checks for the last letter not to be the same as the read one, it will ignore the repeated characters in the program.

Not a good idea if indeed there was a repeated character.

Where are you located? Maybe someone is close by that knows a cnc shop.

Hi,
I once worked on a midi to paper tape coder (for a paper tape controlled pipe organ)
I got stuck when thinking about the mechanics.

So your main obstacles are the code of the tape (which as I read the thread is not the problem) but the mechanics like how and how fast and stable can you move the tape.

Since I don't know the kind of tape as some of the oldtimers do(sorry guys :slight_smile: i am only able to estimate a possible solution.
As a detector there is

  • the IR or VisLight bridge (LED and Photodetetctor)
  • or a real probe (sensor) (metall surface and a metall probe which connects through a hole or not)

You could use printer mechanics to move the tape.
Older matrix pin printer have an easily accessible roll which is controlled by a stepper motor.
You could controll the advance speed of the tape by stepping the motor via the ATMega (or whatever µC) you are using.
This should give a quite stable speed and movement
This might not necessarily fast so the data reading has ample of time to stabilize.
Then "only" the sensor is left as a çhallenge

rgds

Martin

Paper tape, brings back memories.

I suppose you only want a one off reader and don't want to spend too much on it.
If it were me I would rig up a video camera feeding into processing and write a sketch to read the image and convert into bytes. You should be able to find the sprocket hole, then all the other holes will be in alignment.

Here's the picture, sorry for the quality, but I couldn't find my camera.

@hellonearthis
Yes, the 9th hole is the timing hole, the tape is 2,5cm wide
I want to build a reader.
I could scan the tape, but I don't know how to decode the picture.

@cr0sh
It's a CNC programm tape.
I think, the data is encoded in 7 bit ASCII with the 8th bit being parity, based on my small research about punched tapes, however I don't really understand the encoding until now, I will have to search for it.
The problem with scanning is the same thing: how?
I found somebody who has built a paper tape reader, but he is selling it quite expensive:
http://retropcdesign.com/forums/showthread.php?threadid=6
I have asked some people who worked with tapes, what they are encoded in but they haven't replied yet.
Until then, I would want to build the hardware.

@retrolefty
It is a way to do it, but I think it is overcomplicated, to use IR diodes, because of the need to pulsate IR diodes.

@justone
Yes, it is a one-time read, and used readers are expensive too.
I do not know any cnc shop located nearby.
I live in Satu Mare, Romania: http://g.co/maps/z2x24
Every Company that used paper tape readers, has either sold them or they were thrown away.

@MartinH
It is a possibility to make it via metal surface contact, but I don't know how to write the code, so that It reads characters indifferent from speed, because I want to move it by hand.
Buying a used printer would cost...

@Grumpy_Mike
It would be really great to make it as cheap as possible, because I need only a one-time scan.
I don't know how I could decode the video feed.

Thanks guys for the quick answers :slight_smile:

@retrolefty
It is a way to do it, but I think it is overcomplicated, to use IR diodes, because of the need to pulsate IR diodes.

No need to 'pulsate' IR diode, in fact the IR diode emitter(s) should be turned on continuously, and the 9 IR sensors will either see the IR light or not depending on if they are covered by the tape or exposed through a data hole as the tape passes by. The sprocket hole sensor will be the 'new data avalible'.

As far as the data format, that is something you will have to find out and it's not just the encoding method (either binary or ASCII) but also the whole software protocol being used.

Lefty

I don't know how I could decode the video feed.

Use Processing:-

It's free, runs on any platform and has an extensive video library.

Scanning it might be a little tedious, but possible:

  1. Lay the strip on the scanner, along the "long edge", and scan.
  2. Note the "bottom" holes of the tape; advance the tape so that bottom row of holes is the first "top" row for the new scan (note, you may want to use two rows).
  3. Scan again.
  4. Keep doing this until you run out of tape.

You'll end up with a set of files that you'll then want to crop and stitch together - using the "duplicate" holes as reference markers to align things up. You may want to scan in color, and put bits of colored cellophane to mark these holes and such (then later crop/edit out the color in the final image).

If you have a way to count/number the rows of holes (there's going to be a fixed number per inch or something like that), you can know where each set of holes are for the scan; basically you want to have duplicate holes for the alignment needs when you stitch them together in the editing software - but you want to avoid leaving duplicate rows, for obvious reasons.

Once you have the final scan (as a very tall, or very wide "image"), reduce it to black and white, then use that with Processing or some other programming language to "scan the holes" and produce an ASCII text file (maybe as a long string of 1's and 0's?). You might want to do some error checking too with the scan and ASCII file (to verify both are the same) - some kind of parity check or CRC would suffice. Something else to keep in mind (before scanning - or after the scan is complete) is the bit order (ie - which side is bit 0 vs bit 8); so you may want to make two ASCII files, or something similar (also - which end of the tape is the "start?" - that could be important if it is unknown).

Once you have it in some ASCII form (even if the order isn't completely correct), then you can more easily attack it...

  • Take a board slightly wider than the tape and approximately 1" thick, and long enough to manageably slide the paper tape across it (the long way).
  • Attach a second board against the thickness to make a fence for the paper to slide against and stay in alignment.
  • Drill 9 holes across the width of the board with the same spacing as the holes in the tape; mount IR transistors or photoresistors in them pointing upwards.
  • Do what retrolefty said, except I think a bright lamp pointing down on the board would be sufficient.
  • Calibrate your reader by sliding the paper tape across the board while watching the analogRead values and make sure you get decent variance in the reading as to when the detector sees a hole or not.
  • Write your program to take a reading each time the sprocket hole passes over your 4th detector.

Really doesn't seem like that hard of a problem.

I think thats a very cool project, to build the hardware for scanning the tape. You have to decide between an optical or mechanical detection. I prefer an optical solution, you only need a light source an 9 sensors. The size of the sensor could be a little problem, because you need 9 of them in a row. Maybe that your tape is round about 1 inch, so the distance of two holes in the tape is 2,54mm, thats exactly the grid of breadboards or hole grid pcb. At first I thought about light dependent resistors (LDRs) but it should be possible to use a LED as well:
http://hackedgadgets.com/2006/04/14/led-touch-sensor/
So you could arrange 9 LEDs in a row as a good light source and 9 LEDs as sensor.

I've done a scan by hand, so it's not very aligned, but if I decide to do it via image decoding, I will build some kind of rail to scan it alligned.
This is the scanned image,
http://cdn.anonfiles.com/1332518421172.jpg
although I still don't understand how to decode images with processing after I read through the site.

Please tell me guys, how would it be easier to write the program, via the arduino or via processing?
Even if I do it with the arduino, I think that the mechanical way is easier, because I read digital input, without the need to multiplex the analog inputs.

I don't think that you need an analog input pin. Why don't you use a Schmitt trigger?

kevindorner:
I've done a scan by hand, so it's not very aligned, but if I decide to do it via image decoding, I will build some kind of rail to scan it alligned.

Now that you have it scanned, you don't really need to re-scan it; just convert it to black and white, then write a program to move the pixels from the first "black" pixel to the last right-hand pixel to the left; ie - write software to align it.

kevindorner:
This is the scanned image,
http://cdn.anonfiles.com/1332518421172.jpg
although I still don't understand how to decode images with processing after I read through the site.

Please tell me guys, how would it be easier to write the program, via the arduino or via processing?

Personally, I think it would be easier to write the software; once you have everything aligned, you can use the indexing hole as your "trigger"; the idea would be to:

  1. Scan the image top to bottom
  2. On each line of pixels, look for the color white at the horizontal "center" pixel location for the index hole.
  3. When found, this is the "top edge" of the hole.
  4. Continue to scan until you hit "black" - now you know the height of the hole, so back up half that height (center of hole), and scan that line of pixels.
  5. Check the "horizontal" pixel locations for each of the remaining holes. If the color is white, then its a hole, if black, then no hole
  6. Build a string of 1's (holes) and 0's (no holes) - 8 characters, terminated by a CR/LF (carriage return/line feed), and stuff that into buffer
  7. Starting where you left off in step 4, continue scanning until you hit the color white again (that is, start at the last vertical position of step 4, continuing with step 2)
  8. Scan until you hit the bottom of the image
  9. When you are done, dump the buffer of strings to a text file - DONE.

I don't know what the processing code to do the above would be, but the above is the basic algorithm to use; the basic algorithm to align the images would be:

  1. Scan the image from top to bottom
  2. For each line, scan left to right looking for black
  3. When black is found, copy from that horizontal pixel to the right-most edge (the width) of the image; copy that line of pixels to horizontal pixel position 0
  4. Note the horizontal pixel position you found; create a white line from the right-most edge (minus that length) to the right-most edge (to blank out the extra pixels you moved)
  5. Continue with step 2-4 until you reach the bottom of the image

although I still don't understand how to decode images with processing after I read through the site.

When you have an image in processing you can access any pixel in that image just by specifying the x & y co-ordinates.
So all you have to do is to look at one small line of pixels. Identify where the index hole is. Using the mouse down function to print out X & Y on a mouse click is great for finding where you are on an image, to get it all aligned. So you know the place of the middle of the index hole. By looking at the pixel brightness at that point you can tell if the tape is in just the right place so that the other holes are aligned. When this happens just look at the co-ordinates where you know the other holes are and from the brightness you know if they are zero or one.
Processing is fast so you can do this on a frame by frame basis. Treat the index hole just like you would a push button looking for an edge not a level so you don't read the same row of holes in twice.

Somewhere, I have a dozen or so photodiodes intended as spares for a optical paper tape readers.
Hmm.