Fully functional 3D-printed M12 lens mount for PS3Eye camera hacking
While working on the Eyewriter 2.1 open-source eye-tracking system, I knew I wanted to find ways to save cost as much as possible to make the end project / kit more affordable and accessible to people. The most expensive and potentially annoying aspect of the whole system is the optics assembly, so I’ve been looking pretty hard for ways to make it a little easier.
The heart of the Eyewriter 2.1 system is a PS3Eye camera that is modified to be sensitive only to infrared light. In order to do this, the camera itself must be taken apart and it’s factory-installed lens replaced with a standard M12 lens. Typically a band-pass or high-pass filter is installed between the camera’s sensor and the new lens, which does the actual work of blocking all “visible” light, allowing only infrared light to hit the sensor.
How it was made
This part was entirely created in OpenSCAD, a sweet text-based 3D modelling program that allows users to construct ready-to-print 3D models by writing simple code. Using dimensioned drawings I found on the web, I constructed the part to be as close as possible to the “real deal” that you’d find for sale elsewhere.
The script is almost completely parametric, meaning if you don’t like something about the design (the diameter of the holes, the pitch of the threads, etc.) you can change it very easily! I’ve tweaked and tested the parameters to work with the M12 lenses I had on hand, so just grab the STL and print it out!
I went through several iterations to find the perfect diameter for the threaded hole. It is actually a tiny bit more than 12mm in diameter (12.5mm or so), to account for ABS shrinking a little bit and to make a nice fit.