How to design and make something (CAD/3D Printing/Electronics)

Jacob David C. Cunningham
7 min readDec 17, 2023

This is based on my own DIY/hobbyist experience. You can see all the different things I’ve made on my Hackaday profile. This is also not the only way to do this. I’m showing generic concepts/free tools.

Recently I made this camera (software still in progress).

From these parts:

How did I do that?

Two things: measurement and 3D modeling (and a 3D printer, Ender 3 Pro in my case).

Have a vision

You gotta see it, to believe it… (I’m just riffing here).

This camera did turn out differently than how I initially envisioned it. Mostly because of the battery, I initially avoided using an 18650 since they are pretty big (long). I started out with two parallel 1 cell lipos later just 1 lipo (I only had a 1 cell USB charger/bms).

I knew the major parts I wanted: screen, d-pad, switch, battery, lens position and barrel wrapper. This is what it looks like without the barrel wrapper.

Measure, model, scale

I don’t want to say “the most important thing” but yeah, you want one of these, a caliper. The silver thing below. Mine is not expensive I think it’s under $50 or somewhere around there.

This allows you to very accurately measure how big your parts are. Then you can make models of these parts (major dimensions) and figure out how big your project will be.

I use Google SketchUp because I learned it 15 years ago and it’s free. It has problems but it works pretty well. You may notice that the parts are not very detailed… the thing I’m after is volume and where the major parts/dimensions are the screw hole locations and ports.

I laid out the parts to get an idea of where I wanted things to be. Also how big “in reality” it would be since in CAD it can be hard to gauge how big something is.

Before I landed on the final design, it looked different.

There’s no major reason for how it turned out other than where I wanted the lens/OLED/dpad and how big parts were.

What ends up happening is you can align the parts/give some room and then design a case around it.

Tolerance

A quick tip. You don’t want to have joining faces/spacing around holes to not have a gap… otherwise things will not fit. I design in inches (shame) and I usually have a 0.01" gap around holes. This is pretty close but still loose enough to work with. For a wall thickness I use 0.1". You can print samples out and see how strong it is (PLA).

Screws

I use these cheap Phillips screws called M1.7*6 they came in a variety pack from Amazon. No specific reason I chose them, I just wanted “small screws”.

The hole diameter I use for these screws is 0.02" assuming the screws are 0.03" wide. That gives the screw something to bite into (be smaller). Then of course you want that screw hole to have a decent wall thickness so it doesn’t split. I went with a screw hole wall of at least 0.02" thick.

Regarding SketchUp and 3D Printing

You will want this plugin called Solid Inspector 2 which you use to verify that your designed part is solid, will print correctly. It’s possible that some surface may seem closed/solid but it’s not eg. becomes a hole when 3D printing.

Then you have another plugin, an STL exporter. This produces the file that will be sliced by a program like Cura.

Quick side note: if you are just now learning 3D modeling software, learn something better than SketchUp eg. Fusion 360. If you watch my SketchUp video below of designing this camera, SketchUp can be a PITA to work with.

Here you can see the model above imported to be sliced. I have pointed at the “support” option to make sure that’s checked. This is particularly important for parts of the component that are not touching the ground.

Then when you slice it, you want to preview that and make sure nothing looks odd (use slider to see steps of print).

In order to reduce print times, try to reduce supports and material volume/surface area (seems obvious). Infill is a way to reduce inner material but I stick with 20% for the most part unless I need it to be stronger.

Anyway you don’t want to see a random hole where it shouldn’t be.

Also note that this back piece took 5 hours to print. It is important to be sure you are ready to print before committing. The front part of the camera took 8.5 hours.

In order to be sure, besides previewing above. You can print sections out that you are concerned with. For example I wanted to be sure that the soldered d-pad protoboard dimensions I measured were correct.

This print was like 20 minutes or something… much better than re-printing a 5-hour print.

Electronics

In the Basics on hobby robotics post I wrote, I covered some concepts in hobby electronics (think Arduino). Mostly common parts, names of stuff, voltages, communication, etc… so you do need to understand some of that in order to make something like this.

This project though is pretty simple. It’s mostly plugging wires in. The buttons are basic you can see the schematics below (MS Paint skills).

The LD33V (2nd img, top-right) drops a dynamic battery voltage range eg. 3.7 to 4.2 V or the DC-DC output of 5V to 3.3V because the GPIO pins of the RPi are designed for 3.3V. The resistor I believe is there to prevent drawing too much current.

The buttons are just basic on/off switches. The GPIO pins they’re connected to when receiving a “HIGH” signal eg. 3.3V tells the python code “this pin received an on-event” which you map to a button name eg. “LEFT” is 17 (above). To see what that looks like, check the repo section here.

Code

Besides interfacing with the parts, for example the camera above has: 7 buttons, camera, OLED and an IMU that it uses. All of those things combined, gives you a “camera”. The IMU was just extra/cool feature. The Pi Zero has built in bluetooth so I do plan to develop an RN mobile app.

Basically though when thinking about this camera as an example project. You go through the steps/how it would work.

  • turn it on
  • you see something (like a welcome scene)
  • you want a menu (to get to things like view photos)
  • you want to see the photo before taking it (live preview on OLED)
  • you want to take the picture
  • want to know battery life
  • etc…

The OLED and the 10-axis IMU (GY-91) have their own libraries/examples to interface with them. The buttons are just on/off calls, calling a method (function/piece of code). Then the menu is a state manager eg. “I’m on the home page, the camera is active” vs. “I’m looking at the list of photos I took right now”.

This project was written all in Python since the RPi is a full blown computer with an operating system (Linux) so it’s easier to use than something like an Arduino/microcontroller. C++ is a harder language (my opinion). Mostly though it’s more forgiving/faster to work with a full computer than an Arduino that you keep having to flash when you make changes. (You could mock things out like a fake OLED, fake button event, etc…).

You can see in my repo structure that I have things split apart by purpose.

This project is still in progress so I don’t have too much to show yet of fully working software right now. I am having problems with the OLED/RPi working together. Not sure yet if it’s a hardware limitation or my mediocre code.

Some videos on the project so far

--

--