Close
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
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".

  • 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...

View project log

Enjoy this project?

Share

Discussions

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

I had exactly the same idea about 12 years ago ;)

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

https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http://www.nedopc.org/forum/viewtopic.php?f=46&t=7583&edit-text=&act=url
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!

The pictures of the sensor made of RJ11 springs is awesome, reminiscent of https://hackaday.io/project/9753-binary-punched-card-reader
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

Just added it ;)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates