# Making a printable Cam

In this post we are going to explain the process of making a 3D printable Cam with OpenSCAD and a little bit of code I wrote.

In a nutshell, the code I wrote takes in a standard displacement diagram used to describe the increase and decrease in displacement of a Cam over time. Something that looks like this:

And uses that information to create a 3D model like this:

A cam on a cylinder (known as a disc cam).

A cam on a ramp (also known as an end cam).

If you don’t know what a Cam is then please read the previously linked Wikipedia page. But just because you know what it is does not explain why you would want to make one.

A Cam is an device that turns rotational motion into linear motion an many different ways; this is extremely powerful. In mechanical engineering is is pretty easy to create rotational motion (Electric Motor, Steam, Windmill, Treadmill with mice, etc). This is great and already useful but, in many cases, we then want to perform some kind of linear movement based on this rotation. For example, maybe we want to use the rotational motion to trigger a button a certain number of times per second (like an odometer). In this scenario the rotational motion needs to be turned into the linear motion of pushing the button up and down. This conversion is extremely useful and almost every modern petrol based engine uses a Cam via the aptly named Camshaft; the thing in your car which make the engine pistons go up and down.

However, I am personally very excited by the combination of combining a cam with a spring follower. This allows you to slowly store more and more energy in a spring and then release it all at once explosively, letting you create an automatic catapult. For a rudimentary example of what I mean please see this olive slinging device:

So, with that in mind I wrote a quick program in OpenSCAD to generate Cam for you. At this point in time you can generate two different types of Cam’s: a disc cam and an end cam. The two methods that allow that let you specify:

• The displacement diagram of the Cam
Given as a list of points from (0, 0) -> (1, 1) with linear interpolation between the points and points that retain the same displacement to infinity on either end of the diagram.
• The number of segments
Ultimately the Cam will not have a smooth surface but rather be built from a number of segments. The more segments then the more precision your Cam will have and the smoother the finish will be
• The dimensions of the Cam
How high should it be? How big should the radii be?

Lets run through a quick example to show you how it works. With these variables under your control you can then write openscad code that looks like this:

```end_cam(displacement = [ [0, 0], [0.2, 0.8], [0.6, 0.5], [1, 1] ],
segments = 360,
baseHeight = 1,
peakHeight = 3,
width = 0.5);
```

And it would produce a Cam that looked like this:

And here is an even more complex example where we made the displacement diagram be the (sin(x)) ^ 2 function.

```[ for(i = [0 : 360]) [i / 360, sin(i) * sin(i)] ]
```

It looks great:

An edge cam generated with the sin(x) ^ 2 function.

And this is very very powerful, you can now create a cam for your own hobby purposes. Here is the full example of test Cams that you can view just by loading up the test-cam.scad file that exists in the source code:

If you wish to add extra fixtures to the Cam’s so that you can attach them to your motors or rotating mechanical devices then the union and difference functions from OpenSCAD are your friends. Good luck. I hope that this helps you on your mechanical endeavours and please post your creations made using this code in the comments section below. I can’t wait to see them!

# How to control a Quartz Clock Mechanism

In the past I have spoken about the Internals of a Quartz Clock Mechanism explaining how it works and how it all comes together with a handy video. However, even though I explained how the solenoid spins the pinion gear I did not explain very precisely how you might go about manipulating a Quartz Clock Mechanism.

In this blog post I present you with another video that explains “How to control a Quartz Clock Mechanism”. In the video I explain and show how to connect the clock to a custom electric circuit that you construct and I then provide a method to speed up and slow down a regular quartz clock. I hope you enjoy the video, if you like the video then please let me know in the comments or share it around:

## Recommended Resources

In the video I run through a number of concepts and I want to provide you the links to those concepts here in one convenient location:

Hopefully you can use these resources to control you own Quartz Clock Mechanisms or other electronic circuits.

## Concluding Words

I have attempted to explain clearly how to control a Quartz Clock Mechanism in the hope that other people might follow suit. With any luck you can now go out there and do something really interesting with Quartz Clock Mechanisms. If you do then please let me know about it. If you have any comments at all, or would like to see me do something else that is interesting with Quartz Clock Mechanisms then please let me know!

Mechanical

# The Internals of a Quartz Clock Mechanism

### Introduction

Most of the world has seen and used a clock; but how many of you have actually opened up your clocks to see what is inside and how it works. In this guide inside clock mechanism I will attempt to discover as much as I can about how clocks work and how they are controlled internally; it’s going to be a bit of a journey of discovery and I hope you enjoy it as much as I will. For this video I bought a cheap clock from KMart for AUD\$3 (you can see it on the right).

I must prefix this guide with the following statement: I know nothing about the construction of clocks, but I am going to attempt to reason about this one anyway. In this video I mention how the solenoid works and how it creates the clocks “tick” but I do not know if that information is accurate. Please feel free to correct me in the comments if I got it wrong.

## Gear Ratios

After doing all of that work making the video I decided that it would also be a good idea to record the gear ratios that are present inside the clocks and discovered that they both have exactly the same gear ratios on every part. I am just going to write down the details for each gear and explain how it is connected to the next gear:

Gear Name Teeth on Top Half Teeth on Bottom Half Connection to Next Gear
Pinion / Motor Gear 12 Magnet Top to Top
Pinion To Seconds 48 8 Bottom to Bottom
Seconds 8 60 Top to Top
Seconds To Minutes 64 8 Bottom to Top
Minutes 60 16 Bottom to Top
Minutes To Hours 48 8 Bottom to Top
Minutes To Hours 32 NA NA – No Next Gear

Now that we know these gear ratios we can work out how long it will take each gear to make a complete revolution. We can do this because we know that the small pinion gear takes 2 seconds to make a complete revolution (because it makes half revolution per tick). Therefore we can work back the time it takes for each gear to perform a full revolution by starting with the pinion gear and working it forwards.

Gear Name Calculation Seconds per Full Rotation
Pinion / Motor Gear Given 2
Pinion to Seconds 2 * 48 / 12 8
Seconds 8 * 60 / 8 60 (One Minute)
Seconds to Minutes 60 * 64 / 8 480
Minutes 480 * 60 / 8 3600 (One Hour)
Minutes to Hours 3600 * 48 / 16 10800
Hours 10800 * 32 / 8 43200 (Twelve Hours)

Now the first thing that we should notice is that the seconds hand takes one minute to rotate once, the minutes hand takes an hour to rotate once and the hours hand takes twelve hours to rotate once: this is excellent. If that did not work correctly then this would not be a very accurate clock at all; it would be completely wrong.

The other thing that you should notice is that Minutes to Hours gear will rotate once every three hours (10800 seconds). But remember that this is also the gear that we indirectly spin by using the control on the back of the Quartz Clock Mechanism. This control gear has 16 teeth internally and it is connected to the top of the “Minutes to Hours” gear which has 48 teeth. This means that every full revolution of the control dial on the back of Quartz Clock will rotate the “Minutes to Hours” gear by one quarter. This means a quarter of three hours which is 45 minutes. That tells you exactly the granularity that you have with the control dial on the back of the device. You give it one full spin for 45 minutes worth of time. This means that it takes sixteen (12 * 60 / 45) complete revolutions of the control dial to rotate the full twelve hours around the clock. However, since you can go in both directions with the control dial, it will only take a maximum of 8 spins to set the clock to any time that you like.

For those of you that are wondering how I counted the number of teeth on each gear then the answer is simple. I took photos of each and every gear and marked the photos such that increments of five teeth were easy to see and thus the number of teeth on the entire gear was trivial to calculate. For example, on the gear above I can see 9 groups of 5 gears and an extra three spare, making 48 teeth in total. A much simpler task than individually counting each and every tooth; much more accurate too.

### Concluding Words

Hopefully you have learned something fun from this video and you now understand fully how a Quartz Clock works on the inside. Please feel free to comment below. I will happily take any comments that you may have and would be more than interested in discussing anything about Quartz Clocks.