0%
0%

# Low-resolution scanner for cheap data input

Or "let's revive the idea of the punched cards" for our kids' delight, but without the holes

Similar projects worth following
749 views
For the #TTLers crowd and those curious about computer science, this subproject is about a convenient way to input a block of bytes in a similar way to the old punched cards.
The convenience dictates that punching holes is avoided, everyday paper must be used, bits are represented by black and white squares on a 5mm pitch grid.
An optical reader is necessary. The optoelectronic parts are easy but optics and mechanics are tricky and I don't have enough experience in these fields...

A "card" is a sheet of paper with a 5mm square grid (like you can find in any office supplies shop). You can create your own cards by hand with a black marker. You can also print the "cards" with a toner printer or inkjet printer.

There are (so far) 10 tracks :

• 1 "clock"
• 8 data
• 1 parity

Each track is 5mm wide and the center is considered (a few mm²) to reduce manual alignment problems.

The "clock" is "shifted" so its edges correspond to the middle of the data and parity squares.

Each data and parity track starts with a little preamble (4 or 5 bits), then 32 data bits, then 7 bits of Hamming code (more reliable and useful than plain CRC) and a repeat of preamble (to ensure data are inserted in the right direction).

The preamble is also used to calibrate the black and white levels, which are necessary to discriminate the bits. Some analog circuitry generates the mean value that is fed to the analog comparators.Since there are a total of 5+32+7+5=49 bits, a "card" is about 25cm long by 5cm wide. There can be 4 "cards" in a A4 paper sheet, on both long edges and both sides.

The following image is a not faithful illustration of the idea:

Parity is easy to compute by hand : if the number of black bits is odd, mark the parity bit black. The total number of black bits of a line/row is even.

Hamming coding is less easy but not too hard to code in assembly language.

Each "card" is 32*8=256 bits (only). Multiple cards can be chained, the encoded data must take care of the serial numbers etc.

Optoelectronics :

A red LED focuses its light to the center of the square. The reflected light is picked up by a BPW34 photodiode (which is less than 5mm wide). A trimmer finely adjusts sensitivity between all the 10 channels. The output of each track goes to a comparator (LMC7221) then to logic processing (the parity detection is just a couple of 74HC84).

The other input of the analog comparator comes from the filtered mean value of all the channels.

The "card" should be readable with varying sliding speeds... the average would then be updated at each "clock edge".

Logs
1. Photosensor

• ### Phototransistors

Yann Guidon / YGDES08/02/2017 at 22:24 2 comments

@jaromir.sukuba sent me some KPX80

http://www.teslakatalog.cz/KPX81.html

The title of datasheet reads: "silicon planar phototransistor NPN, for photoeletric sensors of punch tapes or positional sensors".

The pitch is 2.54mm, not 2.5, but it's still good for a 5mm pitch.

The remaining question is : what is the spectral response and what type of light should I use ?

The only mention I find is a 2400°C temperature, which might be understood as "warm white"... Some incandescent light would do, it seems. This begs tests !

• ### Photosensor

Yann Guidon / YGDES04/21/2017 at 22:05 2 comments

I just got a few CNY70.

Unfortunately they are a bit too large... 6mm instead of 5mm wide, so I can't use regular 5mm paper...

I still have to see what I can do with the BPW34.
If I can find them in my workshop, since I got them before the renovation...

Share

## Discussions

Dylan Brophy wrote 08/17/2018 at 15:51 point

*claps*  This is cool!  I was working on  something like this a few moths back, but I dropped the project.  I am excited to see how it goes :D

Are you sure? yes | no

Yann Guidon / YGDES wrote 08/17/2018 at 16:10 point

It will take a little while because right now I'm still at the relay epoch ;-) but I have received the linear sensors from @jaromir.sukuba so it's only a matter of time ;-)

Are you sure? yes | no

Dylan Brophy wrote 08/17/2018 at 16:50 point

Alright XD well good luck, have fun :D

Are you sure? yes | no

Clara Hobbs wrote 08/07/2017 at 01:50 point

How the heck does this project have more followers than views?  As of now, it has 422 views and 535 followers, and I'm very confused by that.

Are you sure? yes | no

Yann Guidon / YGDES wrote 08/07/2017 at 01:53 point

The counters might have been reset every now and then, or new filters have been applied.

Honestly what surprises me the most is the number of followers. Are they even real ? I see the same behaviour on some other projects...

Are you sure? yes | no

Ted Yapo wrote 08/07/2017 at 16:40 point

If you follow Yann, you see all his posts even if you haven't followed each project.  In the feed, there are follow/like buttons you can click without going to the project to "view it".  I will instinctively click them right in the feed for a project I want to follow/like without accessing any of the project  My guess is that clicking them there does not increase the views counter.

Then again, Yann *is* a self-identified "hacker" just by being associated with this site and all of the individuals on it...

Are you sure? yes | no

davedarko wrote 08/08/2017 at 08:04 point

There is also the auto boarding process when registering, where you click together stuff you like and categories - after that you auto-follow projects without having seen them before (I've recently verified that with a test account). There also have been glitches in the counters indeed.

Are you sure? yes | no

jaromir.sukuba wrote 06/28/2017 at 09:19 point

Decades ago, Tesla in Czechoslovakia manufactured phototransistor arrays like this one http://www.teslakatalog.cz/KPX81.html

Despite the datasheet being written in Czech, you are probably able to parse required information. I have a few KPX80 parts (10 phototransistors in single package) I obtained from local supplier. They have a still a "few" of them for cheap, just saying... ;-)

Are you sure? yes | no

Yann Guidon / YGDES wrote 06/28/2017 at 11:18 point

KRX80 looks great ! I'd be glad to try some :-) How much does that cost ?

Only issue : the pitch is pretty fine, this one has 2.54mm pitch, 5mm is ideal (you can use existing 5mm paper).

Are you sure? yes | no

jaromir.sukuba wrote 06/28/2017 at 11:29 point

Well, you can use two KPX80 in longer row - this way you get two sensors per pixel, good for high-definition scanner ;-)

I can buy it locally for something like 15-20 cents/piece at 50-100 pieces.

Are you sure? yes | no

Yann Guidon / YGDES wrote 06/28/2017 at 11:57 point

Yes I thought about doubling but the dot pitch would be 5.08mm and not 5mm...

But the phototransistors can be paralleled for increased sensitivity.

If you can find a fistful of KPX80s I'd reimburse you :-)

Are you sure? yes | no

jaromir.sukuba wrote 06/30/2017 at 12:53 point

OK, we will arrange details by personal messages.

Are you sure? yes | no

Yann Guidon / YGDES wrote 04/12/2016 at 03:28 point

Hey ! I just (re)discovered http://www.northdownfarm.co.uk/rory/tim/gallery.htm
His relay computer apparently uses an optical tape reader :-D

Are you sure? yes | no

SHAOS wrote 02/28/2016 at 22:15 point

So do you have working circuit?

P.S. I did a few experiments with LDRs - with daylight it may have resistance about 1 kOhm (and about 1 MOhm in complete dark), with direct red LED light it's about 5 kOhm, but in case of LED light reflected from paper it's 50 kOhm for white spot on paper vs about 150 kOhm for black spot on paper. So technically it's doable with LDRs and red LEDs plus some circuitry to convert it to logical levels...

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/28/2016 at 23:23 point

Unfortunately I have not had time to start playing with the LDR... for this application at least :-) #Yet Another Electronic Lampyridae

Seeing the rebound in interest in this sub-project and the several potential contributors, it will change though, but I have some priorities to manage first :-/

Are you sure? yes | no

SHAOS wrote 02/28/2016 at 23:32 point

See my testing setup ;)

I think it may work without comparator - LDR may be connected as a half of voltage divider and 100k resistor will be on second half - TTL-gate (as on the picture) was not able to recognize the change of voltage from 4V to 2V, but CMOS-gate I think will catch it...

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/29/2016 at 00:02 point

I hope to design a self-calibrating system to increase the reliability but prototyping will refine the design :-)

I also have to design how the data stream will enter the "computer"

Are you sure? yes | no

SHAOS wrote 02/29/2016 at 03:10 point

I don't think that self-calibrating based on average will help

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/29/2016 at 03:48 point

At least, LED will provide visual feedback to help troubleshooting.

Are you sure? yes | no

SHAOS wrote 02/29/2016 at 04:16 point

Another idea - it may be not only black square and white square, but also gray (or 2 shades of gray)

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/29/2016 at 04:26 point

yeah but no... How will kid find the right pen with the exact shade ? B&W is so much easier.
Now, I suppose you'd like to make a ternary reader ;-)

Are you sure? yes | no

SHAOS wrote 02/29/2016 at 05:25 point

I think it's ok to have intermediate shade even if create pattern manually - just use a pencil instead of a marker - easy ;)
And even if code is ternary it still may hold binary data - 6 ternary squares will have 729 variations and it's 2.8 times wider than 1 byte so we have redundancy already that may protect against wrong recognition instead of parity :)

P.S. Actually it may be true ternary - with green and red instead of white! We may use the same LDR to read, but highlight by 2 different LEDs - read and green...

Are you sure? yes | no

SHAOS wrote 02/24/2016 at 03:47 point

And it was LITERALLY the same - 1 clock, 8 data, 1 parity :)

I even bought printer that can print on paper tapes, but I didn't finish hardware design of the reader...

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/24/2016 at 04:06 point

Welcome on board then !

Let's hope the idea can be brought further and into the hands of all the eager n00bz!

However I chose optical sensing for several practical reasons (what do you do with all the paper cuts ? the main page is more fragile as well).

I'd love to store small programs, routines etc. on "scannable" pages in a book of programming lessons for the #Discrete YASEP :-)

Are you sure? yes | no

SHAOS wrote 02/24/2016 at 04:12 point

Actually RJ11s were for different project - ternary punchcard ;)
http://www.nedopc.org/forum/viewtopic.php?f=62&t=122&hilit=punchcard

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/24/2016 at 04:23 point

I see :-)

However, the YASEP being a natural binary machine, I'll stick to dark blots on white paper ;-)

Are you sure? yes | no

SHAOS wrote 02/24/2016 at 04:36 point

Yes, I like paper approach with printed squares on it :)
I see this as a perfect way to share programs for small computers for example through paper magazines...

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/24/2016 at 04:42 point

More than 20 years ago, handheld B&W scanners were the rage.

I remember seeing "programs" printed as fine 2D barcodes in german magazines.

Actually, the "showerhead" format would be handy too... But alignment would be difficult. I prefer to use the edge/border of a page.

I bought LDRs and PIN diodes to try stuff :-D (but i'm busy on 42 ideas at the same time :-( )

All your feedback is welcome, guys !

Are you sure? yes | no

SHAOS wrote 02/24/2016 at 04:55 point

> I bought LDRs and PIN diodes to try stuff :-D

I had LED bar (with 10 lights) and LDRs to try ;)

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/24/2016 at 04:59 point

LEDs are so easy to get !
Do you think that such a scanner would be also interesting for #NEDONAND homebrew computer ?

Are you sure? yes | no

SHAOS wrote 02/24/2016 at 05:08 point

> Do you think that such a scanner would be also interesting for #NEDONAND

Probably
(but in later stage when I'll have RAM)

Actually it could be useful for bunch of other small computers even now...

Are you sure? yes | no

matseng wrote 02/24/2016 at 03:18 point

I started off with a similar design last summer.  Mocked up one using the back from an old picture frame and small LDR's.   And it worked quite well reading blobs printed on a thermal receipt printer.

Since then I did a new design in acrylics and using ancient 1960's-era OCP71 photodiodes that I bought from ebay.

Are you sure? yes | no

Yann Guidon / YGDES wrote 02/24/2016 at 03:21 point

Awesome :-)

You therefore qualify as contributor of this project ;-)

Are you sure? yes | no

esot.eric wrote 12/24/2015 at 11:33 point

I recently discovered in my collection a small stack of 11x17 paper that apparently was used for calculating(?) and creating punch-cards... I haven't looked into the details yet, but it's pretty wild. Been meaning to take a photo... 70 rows by 150 columns. IBM GX20-1818-1

Was working as a student-tech at the time, and my buddy and I each took a stack intending to play a *long* game of Battle-Ship. 'Spose this stuff is pretty rare these days, should probably stop using it as graph paper ;)

Are you sure? yes | no

esot.eric wrote 12/25/2015 at 03:59 point

Are you sure? yes | no

## Similar Projects

Project Owner Contributor

### Digital Dial Indicator CNC Surface Probe

Justin R.

Project Owner Contributor

### KCS tape viewer

matseng

Project Owner Contributor