09/02/2016 at 02:06 •
It wasn't until a couple of days ago that I realized that I haven't updated this project in nearly two months! Quite a bit has progressed with this project, but I haven't had time to sit and document it until recently.
This is it: SPUD v2.
Internally, it is very much similar to SPUD v.1, using the same TSL1406RS sensor array and Teensy 3.2 uC. The biggest changes are mostly superficial - changing the body from hand-sawn (and not in an artesanal way), chunky 1/4" basswood to mostly laser-cut 1/8" bamboo plywood (1/16" and 1/4" also used).
I know - the direction of the grain is screwed up.
The body is also now the minimum size to house all of the components - the old one was rather cavernous inside.
To me, this is the most important feature of the new camera - a much bigger, brighter TFT LCD with a resistive touchscreen. The old screen was so small (only 1.8" diagonal, 160 x 128) and dim that it was nearly impossible to judge composition or focus. The new screen (3.5", 480 x 320, from Adafruit) is much much better to use.
I haven't totally finished the GUI yet - it's still a work in progress. It's been fun to make it a lot more colorful than the old version (Lenna even makes a cameo in the bottom left). The code is a mess, by the way. Complete spaghetti.
I'll show the composition and focus aids later - no point in showing photos of it not in action. Here are some photos, one taken of St. John's bridge (in black and white, I might add).
And here's one with... a color histogram!?!? What is this sorcery? It turns out you can make color photos (trichromes) by stacking three black and white photos, each taken with a red, green, and blue filters. Here's a rather poor example. haven't gotten the white balance quite right yet.
USB and microSD is accessed behind a small door held in with a thumb screw and a dowel pin.
Here's another difference from the original - the lens board pops off! The lens can be swapped out (provided another lens already mounted on a lens board is available) or put away for storage.
One last one to show the difference in size from the original. I'll update with actual numbers soon- but it is a big difference.
See the difference in screen size too? Also, no exposed electronics :)
PCB's were made this time by OSH Park - but I goofed up the sensor board and had that one redone on thinner FR4 (0.8mm vs 1.6mm) by Seeedstudio. With the smaller body comes less clearance - so that had to get thinned down. The black cardstock cover unscrews and pops off easily, as you can see.
Main board has a lot of connections (all removable) - a variety of JST PH and FFC for the sensor, stepper motor, power switch, battery, and LCD.
Now for some photos! It's much the same as the old camera, for the most part. Contrast is better, I think, since I blacked out more of the interior.
One of the first tricolors I took - a lot of banding from the cards driving by on the street. Also, without an IR filter, and with the TSL's sensitivity extending well outside of visible light - the foliage turns a weird shade of reddish -gray! Weird.
Indoor photos of static object turn out pretty well using this trichrome method.
Outdoor scenes are a mixed bag. Clouds, foliage - all moving stuff - gets weird color shifts as they move. Again, the issue with IR sensitivity rears its ugly head. May have to invest in a UV-IR cut filter soon, but they are a pretty penny.
07/11/2016 at 23:53 •
This weekend I had the chance to take the SPUD cam to the Oregon coast. I had hoped to take a bunch of photos during a hike, but I found midway through that it was making a loud clunking noise when rotating it side to side. I was worried that the image sensor had popped off its mountings and was now banging around inside the camera, tethered only by the fragile FFC ribbon.
Luckily, I was able to open it up back at the campground with a multitool, and found that it was merely the battery that had come loose from its pocket. It was easily secured by what else but a few pieces of Hello Kitty duct tape that my wife insisted we bring on our trip.
After that it worked great, but some dust or dirt landed on the image sensor during the repair, so don't mind the minor streaking.
f/2.8, 1/60s - at Ft. Stevens State Park
f/4, 1/30s - at Ft. Stevens State Park
f/4, 1/250s - at Ft. Stevens State Park
f/2.8, 1/30s - at Ft. Stevens State Park
f/8, 1/1000s (or maybe 1/500s) - at wreck of the Peter Iredale
f/8, 1/500s - at wreck of the Peter Iredale
07/08/2016 at 08:43 •
After having the camera in a working state for several days, I've had enough time to form some thoughts on it. For one thing, I am pretty pleasantly surprised by the image quality and its overall usability. Images tend to come out fairly crisp (if low-resolution) and I would be happy to print them on a 4x6 (but no bigger). If you deliberately underexpose, a lot of detail can be pushed out of the shadows in post. Composition, and to a lesser extent, focusing, is still a challenge. I've added some functions to do quick previews by undersampling the image, and other routines for focusing. I hope to post a few short videos on those bits too.
Of all the SPUD's quirks, these are my main qualms:
- The screen is beyond useless in outdoor light. I made the mistake of tying the backlight to the 3v3 pin instead of directly to the battery.
- It makes a pretty awful noise. The buzzing of the stepper motor is I think somehow amplified by the hollow wooden body, especially at high step rates.
- It's a lot bigger and uglier than it needs to be. Just needs a redesign.
- No vertical tripod mount, and its size prevents it from being turned vertical on smaller tripods.
- Battery life seems... meh. Haven't actually tested it, but I expect 20 or so photos before the battery will poop out. LiPo's range from 4.2 to 3ish volts from charged to fully discharged, but the Teensy requires at least 3.7v for things to work correctly.
- Resolution is not very good. This limits the usefulness of the photos it produces beyond web use. Could switch to a higher resolution sensor, but the TSL seems like the easiest to drive, with good image characteristics so far.
I'm definitely not ruling out a successor to this camera to fix some of these issues, though.
A few more sample photos, with annotation:
Part of my lab space at UW. Not a very interesting photo, but I think it shows that the tonality produced by the TSL is pretty good! The shadows have a lot of range, and the highlights actually withstand a little bit of abuse.
Contrast was pushed in this one in post, and this highlights a few of the challenges. I'm not using any dark frames or masking, so smudges and dust on the sensor shows up (streak on center right). Weird artifacts like the dark band on the left show up sometimes, too. I'm not sure exactly why those happen.
At faster integration times, the scan can take as little as 5 seconds or so to complete. That means that slow moving targets like people walking in the distance show up OK! I was personally pretty surprised by this fact.
This one is kind of cool - the movement of the waves results in a bumpy-looking Lake Union - and the bobbing of the kayaks turns them into worm-like objects. Less an issue with the camera and more of an artifact of scanner cameras in general.
07/02/2016 at 19:22 •
Had some more time to take some photos this morning (just from the top of the apartment complex). I think the sensitivity of the sensor is somewhere around ISO 400-800.
Seattle skyline, f/2.8, 1/15000s: Lots of vignetting around the edges. The lens (which by the way, is very cheap), is meant to cover about a 56 x 42mm frame. Here the frame is 65 x 48mm. It improves as you stop down, however.
Some construction on Stone Way, f/8, 1/2000s: Not particularly exciting, but you can see the moire patterns in the crane. Expected, as the pixel count is pretty low and there is no low pass filter. The dynamic range is OK, around 10-11 stops (according to the datasheet) - but everything tends to take on kind of a film noir look - heavy shadows and somewhat limited highlight detail. The datasheet, again, suggests that the response is pretty linear. However, it also notes that the "white" level is somewhere around halfway between 0 and VCC, while saturation is closer to VCC. I'm not sure what the response between "white" and "saturation" is, but to me the highlight rolloff is pretty sharp.
To draw a parallel to film, the sensor has a "short toe" and a "long shoulder" - lots of shadow detail, but limited highlight.
f/2.8, 1/4000s: Some photos of foliage shows another weird quirk of the TSL, namely that its sensitivity extends pretty far into NIR. Plants tend to reflect a lot of IR light, so they show up as gray/white, as shown below. You can but UV/IR combo filters, but they tend to be pretty expensive.
f/2.8, 1/2000s: The thing is pretty hard to compose with! For now it's mostly guess-and-check. I'm working on a few methods to make focusing easier. As far as viewing I may just tack on a 35mm viewfinder. Not the prettiest or most elegant solution in the world but it could work.
07/02/2016 at 03:47 •
The last SMD components took a little longer than I had hoped to come in (this past Monday). With that order in, I had all the parts to start populating the Main PCB, constituent parts shown below (SMD resistors omitted).
- Adafruit 1.8" TFT (160 x 128 px)
- Pololu DRV8834 Stepper driver
- 5-way joystick (Sparkfun COM-10063), 6 x 6 x 5mm tact
- Teensy 3.1
- 8-contact FFC connector, 1mm pitch (Wurth)
- Red LED
- MCB73831 LiPo charge IC
- 2P, 4P JST-PH male receptacles
- Assorted 0805 SMD resistors (not shown)
All soldered up, minus the limit switches, which will have to be added later. I'm not a big fan of soldering SMD stuff, even the 0805's. Especially after a cup of coffee in the morning.
Here's all of the electronic bits and pieces. I put a piece of Kapton tape on the image sensor to avoid it getting dirty and scratched for now.
At this point I considered ordering the 3D printed parts - but then I looked at the total cost, and again at my wallet. Nope. Considering my nonexistent budget, I instead went to the university book store, and picked up several planks of basswood ($20) and decided to use parts on hand as much as possible. I had a few 1/8" steel shafts and brass bushings from previous projects, and those worked just fine to make a linear stage. It wobbles a bit, but it will do.
This part I'm pretty proud of! The original plan (for the 3D printed version, which may be a ways off now) was to use a belt and pulleys to drive the linear stage. But those cost $$$ and would take a week or so to come in - so instead I'm using silamide thread (waxed nylon filament used by beaders - it's resilient and pretty slippery, not to mention cheap!) run through the eyes of several sewing needles. Each end is attached to the stepper shaft so that they wind or unwind, making a push-pull sort of arrangement. Tension can be adjusted by the block to the lower left, increasing or decreasing the track of the string.
I'm skipping a few steps here - just a lot of cursing and gluing things together when they weren't supposed to be - but here's the finished first prototype. Yeah, it's pretty chunky, and missing a few of the key functionalities of the final product (namely the ground glass viewing screen). But it works! For now.
The Main PCB is exposed, as I couldn't think of a good way to cover it up and still access the buttons and USB port without routing (something I routinely try to avoid). Works for now, but later I would like to put a piece of clear acrylic over it to protect things.
The next photos show how chunky the darned thing is - about 75 x 120 x 210 mm (without lens). The 3D printed one would have been a lot more svelte, but you get what you pay for, right?
Pop the top (just some black card stock) and you'll see that it's just a basswood skeleton with the electrical bits tacked on inside. A bit of open-cell foam is used to seal out extraneous light and improve contrast.
I left a LOT of room inside to avoid backing myself into a corner. That explains why it's so big and bulky.
The electrical components are just held in by screws or tacked on by some Elmer's glue-all, so they can be easily recycled. The lens is held on by screws and bent-up paper clips, but hey, it works.
Last but not least, there's a small pocket for the LiPo.
Finally - here are some photos straight out of the camera (well, imported to Photoshop as 16-bit PGM, and exported as JPEGs - but absolutely nothing changed in between).
From my apartment window (f/8, 1/500s integration time)
Making dinner (f/2.8, 1/15s integration time)
A rare selfie (f/2.8, 1/60s integration time) - this one has some levels adjustments in PS
Contrast looks way, way better now that there are fewer light leaks, but that is to be expected. I'm happy with the dynamic range and sharpness for now.
Still quite a few things to improve - like the lack of an easy way to focus and compose, and there are quite a few bugs to squash with the firmware.
06/23/2016 at 05:22 •
The PCBs have arrived! They arrived a lot sooner than I thought (purchased from Seeedstudio last week, shipped on Monday, and arrived Wednesday), so some of the electronics bits haven't arrived yet. Here they are, with the main board on the left, and sensor board on right.
Despite some of the parts not arriving yet, I did have the components to populate the sensor board: one TSL1406RS, one 0805 0.1 uF capacitor, and one 1 mm pitch, 8-pin ribbon connector.
The TSL1406RS has really small holes for a male header, so I just soldered some thin solid core wire between it and the PCB so that it sits flush.
Here's the back, with the FFC (ribbon) connector and decoupling cap soldered on.
Dunno why I hadn't thought to do this earlier, but I took out the macro lens and tried for a close-up of the sensor. Pixel "#1" is located on the far bottom of the photo - here you can see each of the individual pixels! The 768-pixel 1406RS consists of 6 128-pixel dies spliced together. The pixel pitch is pretty big - 65 um or so. There are the black squares just left of center. Neat!
I hope the rest of the SMD components will show up tomorrow or Friday so I can finish populating the main board - just did a few parts here and there for now. Fingers crossed that it all works out when it's all together. Until then, here's a few glamour shots of the pieces I have tacked down so far.
Behold my ugly soldering of a SOT-23 MCP73831 - I'll try to sop up some of the stray flux with some IPA later.
Detail of the 8-pin FFC connector. These are easier to solder than I thought! :)
06/16/2016 at 05:42 •
Here it is in all its chunky, wired-up glory! I've written some basic code to take measurements from the linear array, and scan it across an image. In addition to saving images to the SD card, they can also be previewed and magnified on the TFT screen. I forgot to show this in the video, but there's also an autoexposure option which cycles through a range of integration times, and chooses the one corresponding to a specified gray value (here 22% gray).
I am very anxious to get the PCB's in the mail from Seeedstudio (despite some billing issues). Then the fun can really begin :)
06/13/2016 at 22:23 •
After a bit of idling, I got off my butt and did something. The two PCBs required for this project were ordered from Seeedstudio. Nothing too fancy, but here's what they'll look like (this was my first attempt at using EAGLE - don't judge me too harshly).
The sensor board holds the sensing array (TSL1406RS), a decoupling cap, and a FFC connector. Pretty simple. This part is what gets scanned across the image plane.
The main board holds everything else: Teensy 3.2, stepper driver, battery charger, TFT screen, etc, etc. The ground fill is hidden here for the sake of clarity.
After a week or so of having things on the breadboard, I'm pretty confident that it should work (fingers crossed!). Now, onto the next fun part - mechanical design of the camera itself! I've already shown more or less what the camera will look like, but I've had to add a bit of polish and make some renderings.
Rear view, with the viewing cover closed. The black rectangle on the upper right is the TFT screen. There are navigational buttons below that, and on the right corner, there's a small door covering the micro-USB connector of the Teensy. That will be accessible for charging the battery, and programming. Above the TFT screen is another door for the uSD card, and the power switch.
Rear view, with the viewing cover open. It's hard to see here, but opening the viewing cover swings a piece of ground glass onto the image plane. This can be used for composing the image.
The earlier photos obfuscate the seam line, but the case is composed of a front and a rear portion. The rear portion really holds all of the goodies, and the front portion is a standoff for the lens.
Here's looking closer at the rear case and its contents. The main components are the main PCB, shown here populated with its various parts, and the image scanning stage. You may recognize the tiny NEMA 8 motor mounted on the right side of the stage - this is driving a timing belt which moves the image sensor.
One aspect that I'm pretty proud of is the system for image viewing. When the viewing cover is closed, the ground glass is swung out of the way of the image sensor.
Then, when the viewing cover is fully open, the ground glass holder swings into the plane of the image, so that the image can be composed. Of course, there has to be some way to check that the viewing cover is closed before moving the image sensor (or else, it would crash - yikes). This will be done with a magnet and a reed switch (not visible here).
All in all, pretty simple. Most of the custom parts will be 3D printed by Shapeways in either White Strong & Flexible, or Metallic Plastic. I removed as much volume as possible to reduce the printing cost to about $250, which I think is pretty dang good (if I do say so myself).
Next time, I hope to post some video of the breadboarded system doing its thing, with the menu structure I've developed.
06/07/2016 at 04:19 •
This weekend I got to adding the stepper motor and controller to the whole setup (below). Here I'm using a NEMA 8 stepper and a DRV8834 low-voltage stepper driver from Pololu. I hadn't really realized that the NEMA 8 would have so little "oomph" (read: torque). It takes some careful timing of the stepper and control of the current limit to avoid skipping steps, without browning out the rest of the system. I
I've also programmed it to show a helpful menu system on the TFT screen, to control capture, integration times, image preview, etc. More on that later. But to heck with all that for now - let's take some photos! I kludged together this setup with an actual lens this time - a Super Horseman 105mm f/4.5, which covers 4x5. It's my go-to test lens since it covers 4x5", press shutter, and good sharpness. The breadboard is pulled along an Ikea shelf (which recently fell off of my wall taking some paint with it - RIP safety deposit) by a piece of dental floss (the minty kind) tied around the shaft of the stepper.
To top it all off, a Safeway grocery bag is used to provide some semblance of a dark chamber for the sensor. Take a look at this masterpiece.
Look below and you can see the stepper (lower left) clamped to the Ikea shelf, with a thin strand of floss pulling a ruler, with the breadboard in tow.
Using the stepper instead of simply sliding the breadboard along by hand of course yields much better scans, with less distortion. There are still some light leaks here (surprisingly, the paper bag isn't completely light-tight), but hey, not bad. It's hard to focus and compose without ground glass or any sort of viewfinder, though. But that will be addressed soon enough, hopefully.
Plastic measuring cups. Super Horseman 105mm f/4.5, at f/4.5. Integration time was 1/250s. Minor contrast adjustment in PS.
06/03/2016 at 03:26 •
This is my first attempt at building a digital camera. When I set about to do this, I had a few requirements in mind:
- Portability: It should not be tethered to a laptop or power supply, easily stuffed in a backpack
- Large frame size: Simply put, none of this small format 1/1.8" sensor BS. Big frame and fast(ish) lens for slim depth of field.
- (Relatively) Inexpensive: Less than $1000 all told (fingers crossed on this one).
- (Relatively) Good image quality: It should produce images that you won't be ashamed to print on a postcard.
- Mostly open-source: Should contain very few parts that have to be ripped out of something else - making an exception for the lens here, because optical design is not in my wheelhouse
Considering these requirements, I settled on the "scanner camera" design, which true to its name, "scans" a linear photodiode or CCD array across an image plane to produce a 2D image. There's really no other cost-effective way to produce medium-format digital images, unless you have a silicon nanofabrication facility in your backyard. So, over the course of a few weeks I whipped up an initial concept for what I'm calling "SPUD" (which refers to the "potato-like" quality of the images it will produce) and it also stands for the "superfluous perpetually useless device").
It will be based around the (grayscale!) TSL1406RS linear photodiode array, which consists of 768 light-sensitive pixels with 63.5 micron pitch. The linear array is scanned across the image surface using a linear stage and a stepper motor. The viewfinder is basically a piece of ground glass that swings into place. All of the motion control, image processing, etc, will be driven by a Teensy 3.2.
I am definitely skipping a few steps here (and I would like to elaborate on the mechanical design at a later date!), but earlier this week I received the TSL and Teensy in the mail, and took to breadboarding the thing to see how it would tick.
Here's what it looks like on a breadboard. I'm also using an Adafruit 1.8" TFT screen to display the imaging parameters, image preview, and to store the image data as a PGM (portable gray map) file on a microSD card. Going on a tangent here, I decided to use the PGM format because - well, I'm too lazy to write up the complicated BMP header. Also, BMP's don't handle 16 bit grayscale values. JPEG and PNG compression is not something I would like to attempt either.
So far, the stuff on the breadboard can:
- Capture a progression of line-scan images, and save them to a PGM file on the uSD card.
- Produce a small preview of the image on the LCD.
I haven't yet put everything on a linear stage, so there's no way to "scan" the sensor across an image plane. However, leave it to an impatient engineer to figure out a way to make it work (temporarily, and rather poorly). By scanning the sensor across the image projected by a simple double-convex lens (f = 40mm), I can make a wobbly-looking image with a lot of spherical aberration (from the simple lens).
Not bad! But also, not good. Still you can kind of tell what's going on in the image. The contrast is pretty poor, because of significant light leakage. It can only get better from here!