We make a camera from a flatbed scanner. New life for an old scanner DIY from an old scanner

And, and even other agricultural waste.

It turns out that, as an option, you can get free electricity from the engine of an unnecessary scanner. We will talk about how to make a wind generator from a stepper motor in this article.

Here, the most interesting is the way the blades are made. Below is a guide that will help you "recycle" an old scanner into an impressive electricity generator. We will need:

  • Old scanner;
  • Rectifier diodes (8 1N4007 diodes were used in the project);
  • Capacitor 1000uF;
  • Stabilizer LM7805;
  • PVC pipe;
  • Plastic parts (see below);
  • Aluminum plates (you can use any others).

In addition to the fluorescent tube and electronic components, the scanner has a stepper motor, which is what we need. The photo shows a four-phase stepper motor.

Now that we have all the necessary components, we can start assembling the rectifier.

For each phase, we need 2 diodes, i.e. only 8 diodes. The output voltage will be hard-stabilized using the LM7805 IC and a 1000uF capacitor.

This generator can freely generate a voltage of more than 5 volts, however, as part of this project, 5 volts was enough to charge mobile devices.

USB charging requires two 15 kΩ resistors on both data buses. See the USB bus specification for technical details.


Collecting blades.

It's all!

Now it remains to wait for a windy day and try out the device, as you can see in the photo - the device generates a stable voltage of 4.95 V.

Thus, now you can charge your MP3 player or phone for free.


An article about how to make a homemade camera from an old flatbed scanner.

There is an article on Wired.com describing how to
make a digital camera out of an ordinary Canon scanner.
The guy talks (and shows the process in photos) about what he has done
in the end, I received such a camera not quite what I expected -
an ugly smeared glare of light on a black background, instead of a photograph (on
photo below).

Brief principles of manufacturing and operation of such a camera.

Principle of operation.

The camera works just like any other camera. Lens
projects an image onto a photosensitive element. you can find
tons of information on this topic. In this version, one difference is the role
photosensitive element is played by a conventional flatbed scanner.
The simplest and super-cheap camera, as it turned out, is assembled from black
foam board, cardboard tube, plastic lens, and actually any
scanner.

But this option is not ideal - it has a lot of disadvantages.
expressed in a small viewing angle, fixed focus, poor
depth of field and all the disadvantages associated with unmodified
scanner (for good results, the scanner needs to be modified).

Shot from such a super-cheap camera.

How to improve quality.

Alternatively, you can purchase and modify an ancient camera
30s, turning it into a wild hybrid of vintage and modern
technologies.


Such a camera, as they say, differs sharply in its quality for the better from more primitive options.


"Digital camera" that you can never buy in "Eldorado" 🙂


A picture from such a hybrid is much better than from a primitive version.


Such
cameras you can get a lot easier than the junk of the 30s. cameras
almost no need to modify, they are the easiest way
turn into a digital camera 🙂


Shot from such a camera type "brownie".

Modern scanner-photo-camera construction.

A video showing the creation of a homemade camera.

About how the scanner sees time.

The flatbed scanner does not immediately capture the whole picture of the scene. Scanner
gets the image by reading it line by line. To scan
one photo usually takes from 15 seconds to 5 minutes, this is the time
depends on the selected resolution. Each line of the image is
scanner in milliseconds.

Here's an example that makes it even easier to understand. For example, we need
scan an image that is a square image
consisting of 15,000 pixels in width (respectively in the picture
contains only 225,000,000 pixels). Scan takes 90
seconds. Each line of the image is read one after the other, approximately 6
milliseconds each. This happens 15,000 times while the scanner head
moves from the beginning of the picture to its end. But while the scanner reads
image, it can move. So the object can
move, and the scanner, leaving the previously captured image of the object
will continue to capture its new position (moreover, every 6
milliseconds).

The picture shows how the scanner sees the scene at each interval of scanning time.


And here is the picture that is obtained at the end of the scan.

Such an effect is simply impossible to create using traditional
instruments. In principle, this can be done using the usual
camcorder (the image will consist of about 750 lines and will
low resolution), but the image will not even come close to
"scanned".

How about color?

The main question that is asked on the topic “camera from a scanner” is
it’s “where have the colors gone, and why are all the photos only black and white?”.
The answer to this question is related to the scanner capture procedure itself.
color image. To capture a color image,
the scanner divides the image into three channels - red, green and blue,
these channels are obtained by illuminating the image with a lamp, a scanner
captures each line of each channel separately using
photosensitive sensor that perceives only shades of gray, and
then combines these three channels into one color image.
The camera assembled from the scanner does not use this lamp, it
uses the light projected by the lens, respectively, all three channels
are identical and the final image is black and white (grayscale).
There is indeed an exception when the camera scans a scene in which the colors
change faster than the scan occurs, this refers to fast
updating the television screen or monitor screen, it turns out a sort of
color splash on black and white image.


color
the flash in this picture is created by a high screen refresh rate
computer monitor. The display changes colors faster than the scanner
reads the line of the image, so the monitor ripples with colors.

Photo gallery.

The pictures shown here were taken mainly with such a scanner camera:

This camera is based on the Canon Lide 20 scanner using
CIS sensor. The maximum resolution of this camera is 115,200,000 pixels
per picture, which is equivalent to 115.2 megapixels. 🙂


Here
Reanna Walker turned out to be unusual, pay attention to her eyes - she
blinked during the scanning process (ugh, photographing :)).


Concert from the point of view of a scanner camera.

Christian Nold yawns most of the shot 🙂

Cars passing on the road behind the bus stop.


Notting Hill.

Shot from the roof of the Royal College of Art, showing the movement of traffic below.

An enlarged part of the image showing how moving cars are distorted.


Another picture from the same roof, cars traveling at a higher speed are more distorted in the picture.


The bus is the best in the picture 🙂


The camera gave the double-decker bus an almost architectural form.

Three shots from the college art studio.


The girl in the picture turned out with two faces. The photo was pre-directed.

How to use the old scanner along with a Debian server to scan at the click of a button, and even with automatic sorting.
Why is this needed?
This is suitable for anyone who is not satisfied with the heaps of paper in the workplace. For example:
  • Schoolchildren and students, those who have a relevant topic of piles of accumulated handouts at school, college or university.
  • Employees in the office who have a great many of the same papers and letters
  • Ordinary people - to scan all incoming letters, bills and checks (as you know, checks tend to fade, this is exactly my problem - you will need to scan a large number of checks, and this is not very convenient)
How do I imagine it?
Yes, very simple. I put the paper in the scanner, pressed the button, waited for the sound signal about the end of scanning and processing, took out the paper, if necessary - GOTO 10.
And what did I get?
An uninterruptedly working system that also allows batch scanning and automatic sorting into folders, logging and other troubles - what you write into the script will be.

They gave me an Epson Perfection 1200U scanner. A simple USB-connected scanner is quite old, but with good resolution. I wanted to connect it to my computer - and then an ambush, it is designed for 110 volts. Okay, later I took out the transformer, connected it. It works, but only under Windows XP - there are no drivers for Windows 7 and are not expected. On a working Windows 7 x64 computer - and here I was, like a fool, running a virtual machine every time I needed to scan something, and there was no other scanner nearby.
*A place for bitter regrets about unscrupulous manufacturers*

As time went on, the working computer changed at the behest of a careless mug of tea, mother her by the leg. I decided to install Debian on a new computer, because it's more familiar. And then again the moment came when it was necessary to scan something, and urgently. I connect the scanner - and it works, albeit some kind of tension with ICM profiles. Apparently, someone was greedy to donate them for open source, or it was enough for me to just find them and install them - I didn’t understand, I was too sleepy. Most importantly, it became possible to conveniently scan anything. Wait, what if you connect to a server without a GUI and run scanimage? Hm, it works. Class!

So, there is a button on the scanner body. She has never been able to use Windows, zero emotions. Here, however, too. A Google search found two projects, scanbuttond and scanbd. The first one is old, the last commit was in 2006, but was immediately found in the repositories. I decided to leave the second one for later, the reason is simple - when compiling, some problems of various kinds constantly got out, and, although each of them was solved in a couple of lines in the console, there were quite a lot of them, so I scored, and I wanted to sleep. I will use scanbuttond, but if it is relevant, I think that all scripts are not a problem to slightly finish under scanbd. The question, of course, is how not a problem ... But for now - scanbuttond.

Getting started with scanbuttond
I install scanbuttond from the repositories, run scanbuttond, look in /var/log/daemon.log, press the button, sleepbuttond happily notifies that the button is pressed and then released. Cool!
And then what? Further everything is simple. First of all, edit /etc/default/scanbuttond and enable the daemon to start with the system, and start it with the service scanbuttond start command. What scripts will be called?
The first one is initscanner.sh.example (rename, citizens, feel free to remove this.example), it is called every time any scanner is connected, and basically (as far as I can tell) is an interface for connecting various crutches, well and sometimes - notifications and logging.
The second script is more interesting, it is already called directly when the button is pressed. It is called buttonpressed.sh.example, and the last part of the name is redundant here again. This script is called every time the button is clicked. It is in it that you need to put all these different scanning commands and so on.
Well, I made two scripts in order to process the button click. The first one is in BASH. When a button is pressed, scanbuttond passes control to this script, specifying the button number and scanner name as $1 and $2. There is only one scanner, one button - I can ignore the arguments (I still want to sleep), but I remembered it for later. The first script, buttonpressed.sh, calls scanimage with predefined parameters, transfers the finished TIFF image to a folder in the home directory, converts the tiff to jpg, and then calls the second script. The second Python script chooses a name for the image based on the names taken.

First script - buttonpressed.sh

#!/bin/sh #Most of the script is impudently stolen from someone #However, on the drum, # daemon"s name DAEMON=scanbuttond # securely create temporary file to avoid race condition attacks and to get some sleep TMPFILE=`mktemp / tmp/$DAEMON.XXXXXX` # lock file LOCKFILE="/tmp/$DAEMON.lock" # destination of the final image file (modify to match your setup) DESTFOLDER="/home/user/Scans/" DESTINATION=$DESFOLDER "image.tiff" # remove temporary file on abort trap "rm -f $TMPFILE" 0 1 15 # function: create lock file with scanbuttond"s PID mk_lock() ( pidof $DAEMON > $LOCKFILE ) # function: remove temporary and lock files clean_up () ( test -e $LOCKFILE && rm -f $LOCKFILE rm -f $TMPFILE ) # function: check if lock file exists and print an error message using logger chk_lock() ( if [ -e $LOCKFILE ]; then #Another scanning operation in progress logger "scanbuttond: trying to start scanning operation while another is in progress " exit 1 fi ) # function: the actual scan command (modify to match your sleep) scan() ( #parameters for scanning are selected by me for my scanner by typing in order to better scan black and white documents scanimage --format=tiff --resolution 300 --mode Gray --gamma-correction "High contrast printing " > $DESTINATION convert $DESTINATION $DESTFOLDER"image.jpg" logger "Filename: " `python /etc/scanbuttond/convert_scan.py` rm $DESTINATION ) chk_lock mk_lock scan clean_up


The second script is convert_scan.py

import os filename = "image.jpg" directory = "/home/user/Scans" os.chdir(directory) try: filenames = except KeyError: filenames = counter = 1 new_filename = "scan_000.jpg" while new_filename in filenames: new_filename = "scan_"+str(counter).zfill(3)+".jpg" counter += 1 print new_filename os.rename(filename, new_filename)


To use it, we change the DESTFOLDER variable in the first script and directory in the second one.
Started running it all. Manual start of the first script fulfills with a bang. But if the button - then figs with oil. I didn’t immediately realize to my sleepy head that it was a matter of permissions, apparently, the fact is that the output of the scripts was not shown anywhere, and I guessed to run scanbuttond in the foreground and see the output only by 5 in the morning. In short, the problem is that in daemon mode, all scripts are run as the saned user, just like the daemon itself, in general. What steps need to be taken?
Let's assume that scanbuttond is run as the user saned, the folder for storing photos is /home/user/Scans, and the user must, among other things, have access to the folder.
usermod -aG saned user #add user to an existing group saned chown -R user:saned /home/user/Scans #Assign the owner of the folder to the saned group chmod -R 770 /home/user/Scans# Set the necessary permissions on the folder
The result - the scanner works on the button, puts all the photos in the home directory, but what needed to be scanned was not scanned. In short, as always, instead of solving the problem, I wrote an automatic solution tool. As always, I want to sleep.
But want something more!

Namely:
Automatic sorting of scans by directories. How do I imagine it?

>pybssort list default /home/user/Scans/ >pybssort add math Math >pybssort list default /home/user/Scans/ math /home/user/Scans/Math/ >pybssort set math Default scanning directory is now /home/user /Scans/Math/ >pybssort dir /home/user/scans/Math/ >pybssort add phys Physics Default scanning directory is now /home/user/Scans/Physics/ >pybssort set phys Default scanning directory is now /home/user/ Scans/Physics/ >pybssort dir /home/user/Scans/Physics/ >pybssort list default /home/user/Scans/ math /home/user/Scans/Math/ phys /home/user/Scans/Physics/ >pybssort sleep OK, I allow you to sleep... No, wait, finish your article! >pybssort del math OK >pybssort list default /home/user/Scans/ phys /home/user/Scans/Physics/

The list, add, del, set commands are for changing the scan folder. The dir command is for displaying a folder, used directly in scripts.

What's the point?
At any time, you can change the folder for scanning with a single command in the console. Moreover, any user can do this - if this is undesirable, you just need to change the permissions on the database folder. You can create contexts, view them - and all with one command.
  • First, we sorted the papers into piles on the floor by topic, we take archives with records on physics.
  • In the console we type pybssort add phys Physics.
  • We put a piece of paper, press the button, wait for the end of the scan, throw out the scanned piece of paper and put the next one.
  • All scans are in the /home/user/Scans/Physics folder.
  • We get to the math records, type pybssort add math Math, scan further - and all subsequent scans in /home/user/Scans/Math.
  • We found another leaflet with a record on physics, we type pybssort set phys - and again everything flies to /home/user/Scans/Physics.

Hmm, how to call all these default, phys, math? I've decided to call them contexts, since a scan of an algebra test only makes sense in a folder called Math, articles about healthy sleep are best slept in the context of the Sleep folder, and so on.

What happened in the end?

A simple python program. The bottom line is that all contexts are stored in the SQLite database, and the program can retrieve them from there if necessary. The currently active context is generally stored in a separate file in plain text, it was somehow stupid, in my opinion, to create a table with one column and mess with it. There is a basic set of functions for working with these contexts, a function to start working from scratch (creates a table and folders), you can rob cows ... you can finally sleep ... I take the functions for working with the database from the web.py framework, on which I develop my own small projects.
Why not use the sqlite3 built-in sleeplite3 module? Why am I taking a whole web framework just to take only web.database from it? The answer is simple - it's banal laziness. I'm writing a program with a focus on the essentials, and I don't want to delve into SQLite queries and write insert into contexts values(name, folder); concatenation, I want to db.insert("contexts", name=name, folder=folder) and sleep. Yes, that's why my program requires python-webpy, if anyone can suggest something as easy to use (I'm talking about working with databases), I'll be grateful.

What needs to be done to install?
wget https://gist.github.com/CRImier/7330722/raw/pybssort.py #Change start directory for scanning nano pybssort.py chmod +x pybssort.py mv pybssort.py /usr/local/bin/pybssort

I note - it must be run as root the first time, since this is necessary to create folders in /var/lib to store the database there. After the first launch, root is not required. You can edit the path to the folder at the beginning of the script, but watch out for permissions - poor saned will cry bitter tears from being unable to access your folder. You don't want to upset him, do you?

And how to connect it with already existing scripts? Yes, just in the first script you need to insert "pybssort dir" instead of the hardcoded DESTINATION, and pass the same variable as a command line argument to the second script.
Something like this:

First script

... # destination of the final image file (modify to match your setup) DESTFOLDER=`pybssort dir` DESTINATION=$DESTFOLDER"image.tiff" ... # function: the actual scan command (modify to match your setup) scan () ( scanimage --format=tiff --resolution 300 --mode Gray --gamma-correction "High contrast printing" > $DESTINATION convert $DESTINATION $DESFOLDER"image.jpg" logger "Filename: " `python /etc/ scanbuttond/convert_scan.py $DESTFOLDER` rm $DESTINATION ) ...


Second script

import os import sys #needed to get the argument... directory = sys.argv

To debug your own scripts, I advise you to run the following sequence of commands in the working environment: service scanbuttond stop sudo -u saned scanbuttond -f & tail -f /var/log/messages & tail -f /var/log/daemon.log &
And use in scripts echo, logger and print (for Python).

Criticism about all three scripts, execution, code beauty, indentation, spelling, topic design, bad practices in code and logic, the relevance of the solution, possible additions, the adequacy of the author, and other things are welcome.

After some time, this BASH script got me in the order - I could not enter normal error handling in any way. Spat, rewrote the script in Python. It works even better in the end. Of the pluses - error handling + normal logs, audio alerts and kind of like a beautiful code =) Available The readme contains information on installation. Everything works smoothly for me ... Well, if something does not work, please let me know =)

Tags:

  • scanner
  • environmental friendliness
  • debian
Add tags

An article about how to make a homemade camera from an old flatbed scanner.

There is an article on Wired.com describing how to make a digital camera out of an ordinary Canon scanner at home. The guy says (and shows the process in photos) that having made such a camera in the end he got not quite what he expected - an ugly smeared glare of light on a black background, instead of a photograph (pictured below).

Brief principles of manufacturing and operation of such a camera.

Principle of operation.

The camera works just like any other camera. The lens projects an image onto a photosensitive element. You can find tons of information on this topic. In this version, there is one difference - the role of a photosensitive element is played by a conventional flatbed scanner. The simplest and super-cheap camera, as it turned out, is assembled from black foam board, a cardboard tube, a plastic lens, and actually any scanner.


But this option is not ideal - it has a lot of disadvantages expressed in a small viewing angle, fixed focus, poor depth of field and all the disadvantages associated with an unmodified scanner (for good results, the scanner needs to be modified).

Shot from such a super-cheap camera.

How to improve quality.

Alternatively, you can buy and modify an ancient camera from the 30s, turning it into a wild hybrid of old and modern technology.


Such a camera, as they say, differs sharply in its quality for the better from more primitive options.


"Digital camera" that you can never buy in "Eldorado" :)


A picture from such a hybrid is much better than from a primitive version.


You can get these cameras much easier than junk from the 30s. Cameras almost do not need to be modified, they are the easiest way to turn into a digital camera :)


Shot from such a camera type "brownie".

Modern scanner-photo-camera construction.

A video showing the creation of a homemade camera.

About how the scanner sees time.

The flatbed scanner does not immediately capture the whole picture of the scene. The scanner receives the image by reading it line by line. To scan one photo, you usually spend from 15 seconds to 5 minutes, this time depends on the selected resolution. Each line of the image is obtained by the scanner in a matter of milliseconds.

Here's an example that makes it even easier to understand. For example, we need to scan an image that is a square image of 15,000 pixels in width (respectively, the image contains only 225,000,000 pixels). Scanning takes 90 seconds. Each line of the image is read one after the other, approximately 6 milliseconds each. This happens 15,000 times as the scanner head moves from the beginning of the picture to the end. But while the scanner is reading the image, it can move. Thus, the object can move, and the scanner, leaving the previously captured image of the object, will continue to capture its new position (moreover, every 6 milliseconds).

The picture shows how the scanner sees the scene at each interval of scanning time.


And here is the picture that is obtained at the end of the scan.

Such an effect is simply impossible to create using traditional tools. In principle, this can be done using a conventional video camera (the image will consist of about 750 lines and will be of low resolution), but the image will not even come close to being “scanned”.

How about color?

The main question that is asked on the topic “camera from a scanner” is “where did the colors go, and why are all the photos only black and white?”. The answer to this question is related to the very procedure for capturing a color image by a scanner. In order to capture a color image, the scanner divides the image into three channels - red, green and blue, these channels are obtained by illuminating the image with a lamp, the scanner captures each line of each channel separately using a light-sensitive sensor that perceives only shades of gray, and then combines these three channels into one color image. The camera assembled from the scanner does not use this lamp, it uses the light projected by the lens, respectively, all three channels are identical and the final image is black and white (grayscale). There is an exception, though, when the camera scans a scene in which the colors change faster than the scan occurs, this refers to the rapid refresh of a television or monitor screen, resulting in a kind of color splash on a black and white image.


The color burst in this picture is created by the high refresh rate of a computer monitor screen. The display changes colors faster than the scanner can read the line of the image, so the monitor ripples with colors.

Photo gallery.

The pictures shown here were taken mainly with such a scanner camera:

This camera is based on the Canon Lide 20 scanner using a CIS sensor. The maximum resolution of this camera is 115,200,000 pixels per shot, which is equivalent to 115.2 megapixels. :)


Here Reanna Walker turned out to be unusual, pay attention to her eyes - she blinked during the scanning process (ugh, photographing :)).


Concert from the point of view of a scanner camera.

Christian Nold yawns most of the picture :)

Cars passing on the road behind the bus stop.


Notting Hill.

Shot from the roof of the Royal College of Art, showing the movement of traffic below.

An enlarged part of the image showing how moving cars are distorted.


Another picture from the same roof, cars traveling at a higher speed are more distorted in the picture.


The bus is the best in the picture :)


The camera gave the double-decker bus an almost architectural form.

Three shots from the college art studio.


The girl in the picture turned out with two faces. The photo was pre-directed.