Introduction: 3D Printed Earbuds
I've been looking for a pair of ear-buds that fit well in my ears for a long time, but most are either uncomfortable or fall out of my ears. Recently it occurred to me that my ears may not be symmetrical, so it may be really hard to find ear-buds that fit both of my ears. That’s why I decided to take a scan of my ears, and 3D print my own pair of ear-buds. The best part is that the total cost to have them 3D printed and upgrade my ear-buds was only $12.
To make the scan of my head I used a process called photogrammetry, which is a method of generating a 3D mesh from a set of pictures. Most people do not use this method, because if you want to achieve high quality results the usual procedure is to align about 20 DSLR cameras in different angles around a person in a studio, with equal lighting being cast on the person from all angles being photographed. The cameras are then all set off at the same time to take images of several different angles of a person at once. The reason that this method is used is because moving while different photos are taken can result in a lower quality mesh. Also bad overall lighting, or changes in lighting from one photo to the next, can result in poor mesh generation. While this process can have very good results, the problem is that it can cost several thousands of dollars to do. However, I have come up with a way of achieving similar results by using a video taken on one camera.
In this Instructable I will take you through the process of taking a video, splitting that video into individual frames for the photogrammetry software, generating a mesh, and then using that mesh to create a pair of headphones.
To give you an example of how my earbuds look I have provided a .STL file.
Step 1: Tools
- 1 camera that can record videos.
- 1 Computer
- 1 X-Acto Knife
- 1 Soldering Pen
- 1 Cue-Tip
- 1 tube of Super Glue
- VisualSFM (For creating a 3d reconstruction.)
- CMVS toolchain (For creating a dense point cloud.)
Citation: Changchang Wu, Sameer Agarwal, Brian Curless, and Steven M. Seitz,"Multicore Bundle Adjustment", CVPR 2011
Step 2: Taking the Video
The device that you use to take the video will make a difference in mesh quality. As you can see in the above pictures while the two meshes may seem the same when they have a texture, the difference in quality can be seen when the texture is removed from the mesh.
The first mesh (first two pictures) were taken with a DSLR camera.
Video Settings: 1920x1080p HD/30 FPS
The second mesh (second two pictures) were taken with a GoPro Hero 3+.
Video Settings: 1080p/30 FPS/Narrow FOV
- Find an area outside where there is nothing surrounding you for at least ten feet.
- Next have someone walk around you while taking a video of your head. Try to get your whole head in the video camera’s frame, and try to stand as still as possible.
The reason a video is taken is because it is faster which means the person who is being videoed will move less, and there will be very little changes in scene lighting if any. Also when the video is subdivided into individual frames, it will simulate hundreds of camera angles. The video is taken outside because the natural sunlight gives equal lighting for all the objects in the scene.
After I took the video and generated the mesh I found that the mesh was not to scale. To fix this problem I would suggest taping an object that you know the size of to your face (such as a coin). Later on in Blender, you can use the "s" key to scale your mesh.
Step 3: Using Blender to Divide the Video Into Individual Frames
- After you have downloaded and installed blender, open it up and in the bottom left corner change the “Editor Type” to “Video Sequence Editor”.
- In the “Type of sequencer view” panel, select the “both sequencer and preview” option.
- Now go to the “Add” tab and select the “Movie” option to open the video you took.
- Near the bottom of the screen you will see “Start” and “End” options which designate the frames that will be rendered. The start-up “End” value is 250, but you will most likely have to change this value (In my case it was changed to 1527).
- Directly under the “Output” option in the “Render tab” on the right hand side of the screen is where you will choose the folder where the individual images will be stored. Under the “File Format” option select “JPEG”, and set the quality to %100.
- Now under the “Render” option, select “Animation” and all of your JPEG images will be saved to the output path you chose.
Step 4: Installing VisualSFM and the Necessary Toolchains
VisualSFM is a good tool for creating high-quality meshes, but unlike the other programs in this instructable it can be a little confusing to properly install.
- Once you have downloaded the VisualSFM and CMVS toolchain .zip files, right click on them and extract them.
- Place the extracted CMVS toolchain folder in the VisualSFM folder. In the CMVS toolchain folder, navigate to software>cmvs>bin and copy all three files (“cmvs”,”genOption”, and “pthreadVC2.dll”) into the VisualSFM folder. Next navigate to software>pmvs>bin and copy “pmvs2” to the VisualSFM folder.
Now click on the VisualSFM program, to open up the application.
Step 5: Using VisualSFM to Make a Dense Point Cloud
- In the top panel click on the “Open Multiple Images” icon to import the images that you created with blender. (You may not need to use all of them. I selected photos in increments of ten to get several different camera angles, and only used 152 of the original 1527 frames).
- Now click on the “Compute Missing Matches” icon (Four Arrows).
- · Next select the “Compute 3D Reconstruction” icon (Icon with two arrows right next to the “Compute Missing Matches” icon).
- After the full 3D reconstruction has finished, a new “Run Dense Reconstruction” icon (CMVS) will show up. Click on it, and enter where you want your files to be saved. You won’t see a change on your screen on how the output looks here, but it is important for generating a high quality mesh in Mesh lab.
Step 6: Using Meshlab to Create and Texture the Mesh
- Open Meshlab, and then press the “Open Project” icon (Folder with a stack of papers coming out of it) and select the .nvm file that was saved from VisualSFM.
- Now click on File>Import Mesh and select the .ply file that was saved from VisualSFM. You should see a very big change in mesh quality. (This .ply file was created from the Dense reconstruction in VisualSFM)
- Click on the “Select Vertexes” tab, to highlight in red any mesh that is not a part of the head scan you wanted.
- Now select the “Delete the Current set of selected vertices” icon, to remove the unwanted mesh.
- Next go to Filters>Point Set>Surface Reconstruction Poisson. In the Surface Reconstruction Poisson settings set the “Octree Depth” to 10, the “Solver Divide” to 7, and click “Apply”. You should now have a mesh. On the right side of the screen, you will see 3 eye icons. If you click on all these icons except the Poisson Mesh icon, you will be able to better see your mesh.
- Go to Filters>Texture>Parametrization + texturing from registered rasters. Set the “Texture Size” to the resolution of your images, and click “Apply”.
- Click on File>Export Mesh. Under “Files of type”, select the .OBJ extension. When the texture settings appear, click “Ok”.
Step 7: Making the Earbuds in Blender
- Open Blender and go to File>Import>Wavefront (.obj) to import the .obj file you exported from Meshlab.
- Once the file opens, change the "Viewport Shading" to "Texture" so that you can better see all of the individual features on your mesh.
- Set the Object Interaction Mode to "Edit Mode", Press "ctrl C" on your keyboard to open the circle selection tool, and select all the vertices except the ones for your ear so that they are highlighted in orange. Then delete them (We won’t be using these vertices, and since there are several hundred thousand total, and keeping them might cause Blender to crash.)
- Now that all you have is the two ear meshes that you will be working with, try to remove all of the vertices that are not part of the inner ear, where the headphones will fit.
- Once you have removed the outer portion of the ear mesh, use the "Numb Pad" on the right side of your keyboard to get a side view of your mesh. Then in edit mode select the "B" key on your keyboard to use the rectangular selection tool. Select and delete the vertices on your mesh so that you get a flat surface on the opening that is not going into your ear. (You don't need the "Viewport Shading" to be set to "Texture" mode anymore, so I changed it back to "Solid")
- You may notice a few extra extruded areas that aren't supposed to be there. To fix this, set the "Object Interaction Mode" to "Sculpt Mode". Next under the "Brush" settings, use the "Smooth" brush to fix any of the problem areas.
- On the right side of the screen, set the "Type of Data to Display and Edit" to "Scene" and set the Units to "Metric".
- Next set the "Object Interaction Mode" back to "Edit Mode". Press the "Z" key on your keyboard so that your mesh shows up as a wireframe. Select the vertices on the flat edge, and then press the "E" key on your keyboard to extrude your mesh a few millimeters. On the left side of the screen you will see a "Extrude Region and Move" panel, where you can extrude your mesh to exact measurements (I extruded mine 2.5 mm on the Y axis).
- Now change the "Object Interaction Mode" to "Object Mode". Select the earbud, click on the "Shift" and "D" keys to duplicate the object and then hit the "esc" key so that one object overlaps the other. Now hit the "S" key to scale down the second object. On the left side of the screen you will see a "Resize" panel where you can scale your object to exact measurements (I scaled mine to .885 mm). Now just extend the flat edge of the smaller object to match the larger object, and you will have created the walls of your earbud.
- Now we need to make a hole for the speaker. To do this, we will need to make a circular hole through our mesh where the earbud will match the ear canal location. To do this, first press the "shift" and "A" keys on your keyboard, and go to Mesh>Cylinder. Now you can rotate the cylinder by clicking the "R" key on your keyboard, and then position the cylinder where you want the hole in your mesh.
- On the right side of the screen, set the "Type of Data to Display and Edit" to "Object modifiers" and in the "Add Modifiers" tab select "Boolean". Set the "Operation" to "Difference", the "Object" to the "cylinder", and then click "Apply".
- You may notice that when the hole was created in the mesh there was a gap between the inner and outer walls that were left. In order to fix this, you will need to select several vertices between the two walls (A minimum of 3 vertices) and then press the "F" key to create a face and seal off the gap between the two walls.
- Next, do the same process to seal the gap between the inner and outer walls of the flat edge of the earbud.
Step 8: Making the Earbud Cover in Blender
- Select the newly created faces, and press the "shift" and "D" keys to duplicate the faces, and move them away from the rest of the ear-bud.
- Select the inner edge of the faces you just duplicated and extrude them towards the inside of the ear-bud, the same distance that you extruded the flat edges earlier (in my case 2.5 mm on the Y axis). Then press the "F" key to close off the bottom of the cover.
- Next select the outer edges of the faces you just duplicated, and extrude them .5 mm, and scale it in. Repeat this process so that the cover takes the shape of a curved surface. When you've decided that there is enough of a curve for the cover, press the "F" key to seal off the outer wall of the cover of the ear-bud.
- Measure the diameter of the ear-buds' wire. Then using the same process as how to create the hole for the speaker, create a hole in the cover of the ear-bud, so that the ear-bud wire can pass through.
Step 9: Finishing and Exporting the Design
- Repeat steps 7 and 8 for the other ear.
- To export the mesh, go to File>Export>Stl. You can then send this file to a 3D printer.
Step 10: Pulling Out the Speaker
- Look for a crease in your ear-buds original casing. This is where the pieces of the ear-buds were joined together. It is also where it will be easiest to separate the speakers' casing.
- Place the tip of the X-Acto knife on the crease and gently pull off the casing surrounding the speaker.
Step 11: Releasing the Speaker Contacts
- Use a soldering pen to desolder the two wires from the speaker. You may want to mark the wire positions so you know where to solder the wires back later.
- Next string the wires through the hole in the earbud cover that you made in step 8.
Step 12: Putting the Metal Grill
All ear-buds have some way of keeping earwax from getting to the speakers. It is usually in the form of a metal grill that is glued to the inside of the ear-bud casing.
- Use the end of a pencil to push out the metal grill.
- Coat a cue-tip with a little bit of glue, and apply it to the speaker hole.
- Now place the grill on the hole with the glue, and allow the glue to dry.
Step 13: Aligning the Speakers
- Re-solder the wires to the contacts on the speaker.
- If you made an indention in the ear-bud case, align the speaker with that indention and glue it in place. If not try to center the speaker, and glue it in place.
Step 14: Finishing Touches
- Glue the two pieces of the ear-bud together (edge to edge), and allow the glue to set.
- You may want to fill in the hole for the wires with some glue to re-enforce them, and keep them from potentially being pulled out. I filled mine with red Sugru, so that it would match the rest of the case.
Step 15: Expanded Uses
I think that photogrammetry has several potential uses. In this Instructable I showed you guys how you could build your own ear-buds, but I think that this process could be used for several different applications including: making it easier for Digital Artists to create 3D textures & animations, creating custom frames for glasses, orthotics for people that have plantar fasciitis (flat feet), prosthetics, etc.
Participated in the
3D Printing Contest