Designing and building an open source clock case
Introduction
I got very excited when I saw that this screen came with speakers and in a form factor that would work as a wall clock. I ought to have known how much work this would be as I’d already designed two cases by this point, and yet I still decided to make this happen for some reason
When I first started developing mauveine, I didn’t intend to become a designer of clock cases, but my intention was always that it would become my alarm clock. While there are some commercial Raspberry Pi cases available they all tend to focus on the official display, which at 7” is a little bulky for bedside use.
My bedside alarm clock - it only took two years of work to get here
That then sent me down a rabbit hole that, after a truly disproportionate amount of effort has resulted in some quite nice cases for the Raspberry Pi single board computer and its displays. It’s been a road that has been frustrating an interesting in equal measures, so I thought I would document some of the process and some of the questionably useful things I’ve learned dipping my toe into hobbyist hardware design here.
The right tools for the job
Design is not at all my skill set, and I have no experience in computer modelling, but I did have access to 3D printer, a no frills but functional Creality Ender 3. Armed only with a knowledge of basic trigonometry, I decided that rather than try to learn how to do 3D CAD, I was better off using a program like OpenSCAD to create my design. This way I reasoned, it would be easier to adapt it to different screens later.
I think that was a wildly ambitious goal. Each screen has its own quirks and while OpenSCAD will allow you to supply parameters so you can quickly change the dimensions of your model, in practice, this quickly gets sufficiently complex that it’s probably easier to maintain separate CAD files for each type of clock.
You can see some of the OpenSCAD parameters for the wall clock on the left hand side here. Things get complex fast when you’re trying to remain flexible.
Another thing about OpenSCAD is that its programming language is “opaque” at best. I may have been aware of a tools like PSML to allow you to write your models in python and generate OpenSCAD code, but I felt that adding another layer of complexity into creating models would just make things harder to understand. With hindsight, this was the wrong decision. OpenSCAD has made some courageous choices in the design of its language, particularly around how loops work, which can really catch you out. Writing in python would, I think have been the better choice.
OpenSCAD code can be opaque, and frankly a bit of a maintenance nightmare.
However, there were smaller screens that came with a case built in. The problem with those, is that they generally laid flat on the desk, and you want to be able to control an alarm clock from above.
I wonder, if I were starting again, whether I’d want to have a try with FreeCAD instead. Given the lack of gains from parametrisation, this really might have been a better choice.
But for better or for worse OpenSCAD was what I used. On the plus side, it did mean that my second case required only a little extra work after the first one, so some of the parametrisation paid off.
Learning how not to do things
In OpenSCAD everything is built up from a collection of shapes, cubes and spheres etc. You can stick those shapes to others, or you can cut them out of other shapes. Once the shapes get complex, there is a fair amount of mental gymnastics required to work out what is going on. Here are some things I wish I’d understood when I started writing these files.
-
The linear_extrude() function is pretty amazing. It’s often easier to create a shape by “drawing” the bottom of it, then stretching it out in the third direction to produce a solid. Doing the original stand this way would have saved me a lot of time.
-
When designing for 3D printing, yh
The first case design I therefore came up with was effectively a stand that the Pi case could rest on.