Introduction: Designing a 3D-printed Cover for the Spark Button

About: Geek of all trades. Co-founder and developer / designer at Thinkamingo, building educational mobile apps. Founding board member of Tampa Hackerspace. Ham (AI4DG). Tinkerer.

I recently received a Spark.io Spark Core and their new Spark Button, a shield with 11 RGB WS2812 (“Neopixel”-style) LEDs, 4 buttons, and an accelerometer package. I wanted to use this combination as a flexible internet-connected LED display. After a little code wrangling, I could drive the LEDs and display what I wanted. The next step is to enclose the board in a decent case and diffuse the super-bright LEDs a bit. This Instructable will walk through the design process of using OpenSCAD to design a case for this shield.

Step 1: Measuring and Design Thoughts

The first step is to take a few measurements and think about the design. I wanted a simple hockey puck styled case that held the board so that the buttons on the back of the board would extend from the case and be able to be pressed by tapping the case. First I measure the diameter of the board and the depth of the front and back of the board. I also measured the power cord width and position.

Step 2: Modeling the Core of the Case

To begin modeling in OpenSCAD, I started with two cylinders. The Spark Button is 65mm diameter or 32.5mm radius. Since I’m printing this in ABS plastic, which shrinks a bit, I decided to leave 67mm of space for the board. First I define what is the second cylinder in my model, a radius of 33.5mm and a height of 20mm (which isn’t critical as long as it’s taller than the outer cylinder). This will actually be subtracted from the larger cylinder that will make up the outside of the case. Then I define the larger cylinder with a radius of 34.5mm and a height of 19mm. I use the difference() operator, which tells OpenSCAD to subtract the 2nd shape from the first. I use the translate() operator to move the inner cylinder up from the floor so it sits 13mm above the base. Here you can see the second, inner cylinder in red. Once that is subtracted, you’re left with a cylinder with a shallow cylinder-shaped hole in the top.

Step 3: Adding a Support Ridge

Next I define a third cylinder, slightly smaller (32mm) than the cutout for the board. This will cut out space below the face of the board and leave a 1.5mm ridge around the inside to support the board. I use the translate() operator to raise this cylinder 2mm above the floor, so the front face of the case will be 2mm thick. Here the newest cylinder cutout is seen in red.

Step 4: Space for Power

Now I need to cut a hole for the power cable. I use my previous measurements to define a cube that’s 12mm wide and 13mm high. I use the translate() operator to raise it 2mm above the floor (z-axis). I also use translate() to center the cube, since cubes in OpenSCAD are not centered on the axes like cylinders are. So I need to move the cube -6mm (half the width) along the x-axis. Then I also translate() the cube -37 mm along the y-axis to move it to the outer shell of the case. Here the cube cutout is seen in red.

Step 5: Wedging the Board

Now I add a couple small posts on the inside of the case shell to help wedge the board into place. These can easily be trimmed or sanded to fit the board tightly. I define one small (1mm x 1.5mm) cube and use translate() to position it on the inside wall of the case shell. Then I make a couple copies of that post and use rotate() to move the copies around the inside of the shell to support in on four sides.

Step 6: Printing the Case

The model is ready to print. I render it, export an STL file, and load it into the 3D printer software and let it go to work. 20 minutes later I have a decent little case for mounting the Spark Button on the wall.

Step 7: The Resulting Case

The case came out quite well and the board fits nearly perfectly. The wedges took a little trimming with an X-Acto knife but they hold the board in place nicely. The buttons on the back (top side here) extend just enough to be pressed easily.

Step 8: The Case in Action

The case does a good job diffusing the LEDs. The photos and video don't quite show it as well as it looks to the human eye though. If the board were further back, they'd be more diffused but you'd also lose a little of the ability to tell which LED is lit for clock-like displays.