Ink and Paper MCU programmer. - Page 1
Forum section: electronics / projects

author: Jaunedeau
author_rank: Regular Contributor
timestamp: November 27, 2016, 12:59:10 pm
content: Hi,I have this (admitedly stupid) idea to make an mcu programmer (a serial protocol bitbanger if you prefer) which, instead of using an MCU, reads some black bands printed on a strip of paper.I currently have something that might work (at least, it work to bitbang the protocol of the APA102 led strip I use for my tests for now). It only needs two leds, two phototransistors, 10 resistors, an opamp and a 5V psu.I might need some help to :-Find proper naming for the parts I use (should I speak of "paper bands", "paper strips" ? How should I call the complete printed thing ? A barcode ? a printed protocol ? I'm not native english speaker)-Get some ideas to improve the thing (the easyer /cheaper to rebuild, the better)I opened a project block on HaDhere.fabien.

author: amyk
author_rank: Super Contributor
timestamp: November 28, 2016, 04:16:09 am
content: https://en.wikipedia.org/wiki/Punched_tapeWhat you have made is basically a paper tape reader.

author: Jaunedeau
author_rank: Regular Contributor
timestamp: November 28, 2016, 11:48:25 am
content: Yes, but I need optic detection (because more people have a printer than computer controled hole puncher), and high density (because I go for cheap and easy to build, so having 9 tracks + some parallel to serial converter + some X8 clock multiplier is unwanted)The problem I need to solve becomes rather different than the one involved in a punched tape reader, so I could not find much usefull informatino looking at how they were made

author: Ian.M
author_rank: Super Contributor
timestamp: November 28, 2016, 12:20:39 pm
content: A typical barcode encodes approx 1.5 bits/mm. A4 paper is 297mm long. That gives you 450 bits for a page length track.The crappiest smallest memory PIC on the market (PIC10F200) has 256 12 bit words of program memory. That's nearly 7 times more than will fit on one page length track without the overheads of bit-banging the ICSP protocol without using another MCU.Then you have the alignment issue - it doesn't take much skew across the width of a page to put your tracks out of sync at that sort of data density.

author: mariush
author_rank: Super Contributor
timestamp: November 28, 2016, 07:09:32 pm
content: I'm thinking stepper motor to move strip of paper through the reader, and two pairs infrared led (emitter) + infrared sensor (receiver) ... both with very narrow windows like 1-3mm wide or something like that. One pair would be used for data, one pair would be used for clock (alternate between white and black squares, if the stepper motor is not accurate enough (you can adjust stepper motor speed and go back and forth at various speeds to set the tape at the right positionA full black square on the strip would block the narrow infrared led beam so you get a "1", an empty square would get you "0"Paper with holes in it would be easier, a row of tiny holes on the edges to keep the paper tape centered as it goes through the machine, holes in the tape for each "1" bit, 0 if tape is not punched. A metal V or U at the bottom, at the end of a pin with a spring that pushes down on the paper. If there's a hole, the spring pushes the U or V shape down through the hole in the paper and touches a metal contact and you have the connection which tells you have a "1". You can put as many square holes in a single row on the tape.If you get more complex, you may as well just use magnetic tape.

author: rfeecs
author_rank: Frequent Contributor
timestamp: November 28, 2016, 07:49:53 pm
content: I seem to recall that this was proposed back in the early days of personal computers. Write a magazine article about a program and include the barcode in the magazine. Just scan it with your barcode wand to try out the program. Of course programs were a lot smaller back then.

author: ChristofferB
author_rank: Frequent Contributor
timestamp: November 28, 2016, 08:32:21 pm
content: For your paper tape, I'd recommend using thermographic rolls from receit printers. Some receit printers has customizable character sets, too, likely barcode and image support. Your stored data would decay under UV, though.

author: rfeecs
author_rank: Frequent Contributor
timestamp: November 28, 2016, 09:55:39 pm
content: Quote from: rfeecs on November 28, 2016, 07:49:53 pmHere's something like it:http://www.insentricity.com/a.cl/265/encoding-software-in-barcodes-the-eight-bit-magazine-way

author: jwm_
author_rank: Frequent Contributor
timestamp: November 29, 2016, 12:01:54 am
content: That sounds fun, I think you are on the right track. I'd use one of the sensors commonly sold for 'line following robots. They can be found with break out boards easily. I'd get it working with a manual feed first (such as using your hand to manually slide the sensor over the paper) and make sure you can get patterns out then work from there on the mechanics. Heck, don't move the paper, actually mount the MCU on a little robot that drives across the paper reading as it goes,

author: salbayeng
author_rank: Frequent Contributor
timestamp: November 29, 2016, 12:57:02 am
content: I'd really suggest a self clocking code, barcodes are a variant of this.One of the simplest is used in UHF and IR remote controls where e.g. a one is 3ms high followed by 1ms low ; and a zero is 1ms high followed by 3ms of lowthis is a one 111_ this a zero 1___The positive edge always occurs every 4ms , and decoding is trivial, either (a) measure at 2ms after positive edge or (b) compare widths of hightime vs low time, with an Atmel MCU feed this into the ICP pin, and save the value of the TCCR at every interrupt.You can double (or more) the density with interleaving (as generally more zeros than ones in ASCII text)Basically a 1 is a long mark or a long space (or long black or long white) and a zero is a short intervalSo if B is black, and w is white, you can encode 11110011 as sssBBBwwwBBBwwwBwBwBBBwwwSSSssssss are start and stop bit, you could throw in parity tooYou can also tokenize your program : use, as normal, ASCII characters from 0-128 then use characters from 127-255 to represent the reserved words e.g. 140 = "do" ,141 = "while", 142 = "next" etc etc , and do primitive RLE for duplicate spaces and tabs 150 = 2 tabs, 151=3 tabs etc., and also use a simple RLE , eg 162 = 2 copies of the character following, 163=3 copies , 164 = 4 copies.----as an alternative look at Manchester codinghttps://en.wikipedia.org/wiki/Manchester_codethis has the advantage it can be AC coupled (and you can recover the data using an analog data slicer) although it has a lower density that the interleaved method above.You should also be packetising your data, eg use the STX and ETX characters to delineate the text, and put a header in front, containing as a minimum the sequence number of the block and then a checksum or CRC in the trailer.see also intel hex format (for saving executable code)https://en.wikipedia.org/wiki/Intel_HEX(still used today!!)and the motorola S1 S9 format (used this 45 yrs ago!!)https://en.wikipedia.org/wiki/SREC_(file_format)

author: apelly
author_rank: Unknown
timestamp: November 29, 2016, 12:57:46 am
content: RPGedit: Maybe I should elaborate a little. RPG is some IBM thing that's a hangover from punched cards. It uses a columnar layout where you write an x in a box on a card that is divided up into a grid where rows are lines and columns are commands and it gets interpreted from that. By the time I got involved, many years ago, this was all done on a screen though.

author: salbayeng
author_rank: Frequent Contributor
timestamp: November 29, 2016, 04:23:48 am
content: Back in 77 at UQ, we used the miditran cards seehttps://en.wikipedia.org/wiki/Punched_card#IBM_Port-A-Punch.You could punch most of your deck on the punch machine, and take a handful of these back for homework, (i.e. to fix bugs).Later I joined the computer club, this gave you a proper account, and you could enter your assignments on a VDU or teletype.