DIY Image Sensor and Digital Camera
by seanhodgins in Circuits > Electronics
64525 Views, 181 Favorites, 0 Comments
DIY Image Sensor and Digital Camera
There are many tutorials online about building your own film camera, but I don't think there are any about building your own image sensor! Off the shelf image sensors are available from a lot of companies online, and using them would make designing your own digital camera not super difficult(but still very hard!). I wanted to take it to the next level and use only simple components, break it down to the most basic parts, so that you're controlling every aspect of the design and programming.
I'm calling the project the "DigiObscura".
If you watch the video below you will see that the original plan was to use a pin hole. However that idea is shelved for now, due to the nature of these sensors. I'm sure there is a way to make it work, but I'm extremely happy with the solution I came up with.
Check it out!
Watch the Video!
I explain a majority of the project in detail in the video, it should set you in the right direction.
Gather the Parts!
This project isn't really cheap, or easy. But if you're looking for a challenge and a way to learn about how digital cameras work, this is definitely for you!
You will need to be able to 3D print parts, solder circuit boards, program Arduinos, and have a basic understanding of how cameras work.
If you order the parts through the PCBWay link I get a percentage of the sale!
Parts
- Microcontroller Circuit Board (PCBWay (Affiliate Link) or GitHub)
- Image Sensor Circuit Board (PCBWay or GitHub) - Don't forget to order a stencil!
- BOM for Micrcocontroller PCB and Image Sensor (FindChips)
- Heat Set Threaded Inserts M3 (McMaster-Carr)
- Button
- M3 Screws
- Magnifying Glass
- OLED Screen (Optional)
- SD Card
- 18650 Battery (Optional)
Start the 3D Prints
If you have the boards and parts already, its time to start the 3D prints. Head on over to thingiverse and download the files. If you need to modify them you can get the Fusion 360 files from the GitHub.
Thingiverse Files: https://www.thingiverse.com/thing:4070769
The prints will take a while. You can print at 0.2mm layer height and 5% infill as these parts don't need a lot of strength.
My lens mount will only work if you use the old Canon 35-105 as I mentioned in the video. You can find them pretty cheap used or even broken, since you're only using the outer glass.
Populate the Image Sensor
I like to do the hardest things first, and this is definitely the most challenging part of the build. The image sensor has 1024 light sensors. If you don't own your own pick and place machine, you're going to be doing this for awhile. I think it took me about 2.5hrs non-stop to place all of the components and I considering myself pretty good at it(done a lot of assembly). So if you're new, definitely practice a lot before trying this. My neck was hurting pretty bad after. You can also order them pre-assembled from a lot of PCB fab houses now. I haven't done it for this board, but it should be easy if you have done it before. If you make a mistake on this board, debugging could be challenging, make sure you at least place all of the components in the same direction.
Spread out the solder paste and get populating...
Populate the Microcontroller Board
The microcontroller board is a lot simpler compared to the image sensor. If you completed the image sensor without fail, this should be a breeze. There aren't a lot of components so just follow the schematic and board files on KiCad and it shouldn't take long.
Once you solder on the surface mount components, do the through hole components. The headers for the image sensor will go on the back of the board(opposite to the surface mount components).
Program the Bootloader
The Microcontroller will now need the bootloader. You can choose either the "Feather M0" in the Adafruit collection of boards, or the "SAMD Dev Breakout" by Sparkfun. Either will work, and I suggest you use what is more familiar to you.
I have done other videos that show this process, and will not describe it in detail in this instructable, there is already a lot going on in this one.
Put in Threaded Inserts
Hopefully your prints have finished by this point.
The 3D prints are designed to accept heated brass threaded inserts. Take your time to install them all straight. There are 4 for the image sensor, 4 for the arduino board, 4 for the lens mount, and 3 for the tripod mount.
You could probably get away with 2 instead of 4 for each of the PCB mounts, there isn't a lot of stress on any of these parts. Your call.
Assemble the Camera Body
There are not a lot of parts. Follow the assembly in the image above. Use M3 screws where needed.
The button will be installed in the upper hole in the camera body, and attached to the arduino PCB via the JST connector.
Finding a Lens
I originally planned on making this a pinhole camera, but that didn't really work out. In my case I decided to take apart an old broken Canon 35-105 lens and use the front glass. The front glass is basically a magnifying glass but produces less distortion on the image. If you can't find a broken lens to use, a regular magnifying glass would work fine. Try to find something with only a 2x or 3x magnification otherwise the distance to the image sensor will be too big. You will likely need to modify the lens mount 3D print file to suit your needs. When making a new file you will need to find the focal plane distance, which is the distance from the lens to the image sensor where things are in focus. I explain this in better detail in the video.
Programming and Testing the Arduino
I have included two different programs in the GitHub. Both are equally useful but the "Webcam" firmware is better for debugging, so I recommend starting with that.
Upload the firmware to the Arduino.
Now its time to see if everything is soldered properly. If you don't have it already, get the "Processing" program. There are two parts to the Webcam firmware. One runs on the camera, the other runs on your computer in Processing.
When you have the firmware uploaded to the camera, open processing and run the program. Make sure you choose the correct COM port. If you're going to test it out make sure you point it at something with a lot of contrast and a lot of light. It helps if you know what the camera is looking at!
If all it working you should have an image being generated from the camera! Try not to move the camera as it is constantly generating a new image.
Downloads
Add the Camera Firmware
If everything checks out in Processing, the remaining firmware will turn your 3D printed box of electronics into a full blown digital camera(the lowest resolution camera ever).
Upload the digital camera firmware.
Install an SD card and battery. The camera won't let you take pictures unless there is an SD card present and it will say so on the OLED display if you have one connected.
Your camera is ready to take some pictures!
Downloads
Setting Up Photos
I think we all know by now that this is an experiment in making your own digital camera, and you're not going to be able to get amazing images out of it. Quite frankly getting any image out of your own DIY digital camera is a feat in itself, but I was blown away by the amount of details that are visible.
Its not going to do well in just general photography. You will need high contrast and large objects to see anything really.
Taking a picture of my face worked best when the background was dark and my face was well lit.
Play around with it and learn, and please, try messing with the Arduino Firmware and try and make it better.
You're a Pro!
If you finished this project and its working, seriously impressive.
Tweet at me with your images, I want to see what you come up with.
Support Future Projects!
All of these projects are free open source, and I try to make them as accessible as possible. If you are a fan of my work, and you can afford it, consider supporting me by becoming a patron on Patreon. My patrons are what make these projects possible.
https://www.patreon.com/seanhodgins
If you enjoy the videos head over to my YouTube and hit that subscribe button! (or just click the link below)
Thanks for all of your support!
Feel free to share this project on Reddit, Twitter, Instagram, and anywhere else you want. On twitter and Instagram be sure to tag me @idlehandsdev so I can thank you!