eInk Camera
Dec 13 2024Arduino/Adafruit Grand Central (C++)
Github: https://github.com/davidjihwan/eInk_Camera
This installation was exhibited at the Elinor Bunin Munroe Center in Lincoln Center.
Installation view:
Taking a picture:
Here’s a closer view:
Ideation & Vision
This project was created as a final project for my “Creative Embedded Systems” and “New Media Art” classes. The final project theme of my Media Art class was “surveillance”. I wanted to create a piece that explored our greatly placated reactions to being observed and having pictures taken of ourselves in the advent of communication and social media technologies. I settled on the idea of an eink camera, where the user could take a picture of themselves, becoming the main subject of observation in the piece until the next person took a picture.
Here’s a quick sketch I came up with:
Although I had been accustomed to working with the ESP-32, I realized that I wouldn’t have enough pins to interface with both the ESP-32 and eink screen, so I used an Adafruit Grand Central for the project.
Here are the initial componenets laid out:
As you might notice in the picture, I initially used a Adafruit OV5640 Camera Breakout, and was planning to code in CircuitPython. I soon discovered that the Grand Central specifically tended to freeze up when using this camera module in CircuitPython. As the OV5640 didn’t have an Arduino library written for it, I opted to use the OV7670 camera modules instead, which are far cheaper and have an Arduino library written for them.
The OV7670 did also have its fair share of issues, mainly having to do with the messy soldering job that it needed in order to interface with the Grand Central:
This connection ended up being pretty fragile, especially as I had to clip part of the ends of the wires in order to make them fit into the holes that were shared with resistors. I would highly recommending soldering a couple of these at once, as well as finding thinner wires (only cut them as I did as a last resort).
Here’s my first test of the eink display (using the Adafruit example).
Debugging
I was stuck for quite a while on an issue I had where the eink display wouldn’t respond to any input, even though it could print to serial output. At one point, it somehow flashed the error message that I ran into, and then wouldn’t respond again.
After a lot of trial and error, I discovered that taking out the camera from the board allowed the display to start working as expected. Of course, having the camera in shouldn’t normally be an issue, which meant that I was using a subpar data cable. Please make sure to check that you are using a proper data cable!
After getting the display and camera working, I had to figure out how to process the image.
An image test from the camera:
I started by trying to implement a basic thresholded image, where pixel values below a certain threshold would be black, and pixels above that threshold would be white. Even getting to the point where I was outputting nonsense images took a while, as I had to figure out how to format 24-bit BMP images correctly (as Adafruit eink displays require this format). After a while, I was outputting images like this:
Nonsense output:
Messing around with some inputs, I started to get a couple more distinct shapes in the image, but still nothing coherent.
Garbled output (a little better):
Noticig the seemingly tiling patterns, I realized that I was probably indexing the rows incorrectly. After rewriting how I was accessing the rows and columns of the image, I finally started to get a recognizable image.
Getting somewhere:
Almost there:
If you look closely, both of the images above have some sort of vertical banding going on. I realized after debugging for a while that I was accidentally indexing the UV byte of the YUV pixel, instead of the Y byte which corresponds to the greyscale information. Correcting this finally gave me the output I wanted.
Fixed!:
On the display:
I wanted to implement some form of dithering in order to have more detail in the final image. From here, it was relatively painless to get Floyd-Steinberg dithering working.
Dithered image:
On the display:
Enclosure
I initially built an enclosure out of cardboard for the camera, as I wanted to create a relatively large and complex structure, and cardboard allowed me to quickly interate and build the enclosure.
Progress pictures:
The finished build:
In the middle of building the enclosure, I realized that I couldn’t get the camera to work using wires to connect it to the board, meaning that I wouldn’t be able to install my camera in the enclosure. I finished building it anyway as a proof of concept, and moved on to designing an enclosure for the eink display instead.
The 3D model:
I also couldn’t find any M2 screws at any nearby hardware stores, but here’s what it should look like when installed: