things i build

Long exposure machine

Using a 3D printer with a LED attached to the extruder to create long exposure photos.

Tech: Python, Raspberry Pi, 3D printer
Tags: <1k lines of code
Source: https://github.com/dsonyy/light-printer

What is it?

Light Printer is a small project developed with love for long exposure photos. The program originally works on Raspberry Pi, which sends G-code commands directly to the Anet A8 3D-printer. The printer doesn’t print anything, but it is used as some kind of vertical plotter. There is a RGB LED on the front part of the extruder, which is also controlled by Raspberry. The camera captures every blink of light with a long exposure in a very dark room. Everything works closely together in an effort to produce a correct picture.

How to run it?

Please note that this code is written only for Anet A8 3D printer. I haven’t tested it for any other printers, so it would have to be adjusted a little bit.

Requirements

First run

  1. Install Python requirements from requirements.txton your Raspberry Pi.
  2. Connect the printer to your Raspberry Pi using USB.
  3. Run sudo pigpiod to initialize GPIO ports (if you reboot RPi you will need repeat this step again).
  4. Run lightprinter.py.
  5. There should be a list of available serial ports. If you see your printer’s one, type its name.
  6. Follow the instructions to “draw” an image.

Input images

Input images should be located inside the input directory. They may not contain transparent pixels. To speed up printing empty pixels should be black #000000, so they will be skipped.

Constants

If you have a look inside lightprinter.py there are some constants which are suitable for my setup:

* If the program sends move command to the printer, it takes some time to physically move the extruder. So that, we need to wait a bit until the extruder is in the right place. The final delay time equals to X_STEP * X_SLEEP_PER_MM for horizontal movement and Z_STEP * Z_SLEEP_PER_MM for vertical.

Camera settings

Long exposure time depends on the image size. Every input image row adds additional seconds, so it usually takes a few minutes to make a whole picture. The most importat thing is there must be a fully dark room because every single light may be visible on the final picture.

To create the pictures from the gallery section I used F3.2 and F3.5 shutter, ISO 100 and manual exposure time.