Chain drive & sprocket rigging?

I have a project where I am wanting to model a chain drive, and I’ve had some issues with the drivers, getting the chain to follow the rotation of the gears.

I managed to get the sprocket drivers to work, so that the small gear follows the gear ratio of 3:1, respective to the larger sprocket on the right. I tried copying over the driver from the large sprocket to the chain elements, but it results in a mess when that sprocket is rotated. The links move away and out from the path the chain elements are parented to. I’m not quite sure how to get them to follow the path in sync with the sprockets. I did watch a few tutorials on Youtube, but that didn’t help much as the driver settings they provided were specific for the kind of arrangement they had, and mine is different. Also later I noticed that the small sprocket’s teeth don’t quite match the gaps in the chain, but that should be easy to fix.

What would be the best method to deal with this? Unfortunately, I’m fairly new to using drivers, so I’ve hit a wall here. I’ve included the small .blend file with this chain drive in it.

chaindrive.blend (528.6 KB)

Sorry, left a message where I hadn’t noticed your file.

First, you want your chain and the curve deforming it to have the same transform, because right now, they’re not quite set up right. Unparent both of these with “keep transform”, then set the origin of the mesh object to the location of the curve object. It’ll shift a little; don’t worry about that, we’ll worry about that when we get to the driver.

Second, you don’t want everything parented to sprocket.lg. You don’t want everything rotating when that rotates. Instead, parent everything to some shared parent, like an empty.

Third, to move the chain along the curve, you don’t want to rotate it in any way; you want to move it. Since your deform axis is set to -Y on the curve modifier, you want to move the chain in its Y. So copy/paste the driver to its Y location field and delete the rotation driver.

Now, how much do we want it to move? When I try to do this doing what makes sense, it doesn’t work for me. (It seems that its movement should equal the radius of sprocket, about 0.52 blender units.) So I just tune the driver curve to eye:

chaindrive1.blend (481.1 KB)

Thanks, I appreciate the help here. I probably will try making another set of sprockets, since the small one here didn’t quite mesh up with the chain.

Okay, so I redesigned the sprockets, and made careful measurements to make sure both the large driver sprocket and the smaller driven one would properly mesh with the drive chain. I found that if the tooth pitch wasn’t identical on both sprockets then it would result in a mess. So, after a bit of trial and error, what I did was place a circle with the same number of vertices as the number of teeth on the sprockets (16 and 48, in this case), and scaled so each edge would be 0.75" in length, matching the chain pitch of 3/4" (~19mm). The vertices would then line up with the centers of the rollers for the chain.

I also used the sprocket calculator at to figure out the proper distance between the sprocket centers, and the pitch diameters. It’s pretty useful.

Anyway, the problem with trying to drive the chain around the path is that the link segments will get distorted, so I parented to the links themselves to a small plane matching its dimensions, then applied the array & curve modifiers to the plane. That works to keep the chainlinks from being distorted.

The real problem I have now though, is getting the driver for the chain to move properly along the curve, to match the movement of the sprockets. I copied over the driver (X-axis rotation) from the large sprocket to the small and changed its scripted expression to ‘rotation_euler*3’, to match the 1:3 ratio of the gearing. Currently, the expression value for the chain (on Y movement) is ‘-rotation_euler’, but that doesn’t seem to work correctly. The chain moves along the path much too quickly to match the movement of the teeth. So, how to get it to work correctly? I didn’t notice anything in particular I could copy from the original file you modified and posted.

This is what I have so far:

chaindrive.06.07.23.blend (814.9 KB)

If you want to get my attention, just reply to my post, rather than the whole thread. If you reply to a post I’ve made, I’ll get a notification, and probably come see what was written. Otherwise, I’m kind of in the habit of ignoring threads with more than one poster (even if that poster was me, because I can’t easily tell.)

I didn’t anticipate that distortion would be a problem for you here, because your individual links are small in comparison to the curve-- I wouldn’t expect it to be something to worry about unless you zoom way, way in. In real life, metal’s flexible anyways.

Like I said earlier,

And we can do that. First, the chain is not in the right position to begin with, so we’ll move both driver controls up in the driver editor. Before:


Now, the chain still moves too fast, so we’ll move the right control down, toward zero. Ooops, we should turn off snapping the driver editor window, we should have done that earlier:

Okay, that looks good to me. You can be more careful about it if you want. I’m not going to use imperial units for my calculations though :slight_smile:

Edit: Okay, let’s do it more carefully, mathematically. Each link is 0.01905 units long (the constant factor in your array.) You have 48 teeth in your main gear.

Every time your main gear rotates through an angle of 2 * pi, you move 48 links. So the distance it moves, as a function of the rotation of the main gear, is var * 48 * 0.01905 / (2 * pi). Let’s try that out as a scripted expression, with a reset driver curve.

Okay, that looks like that works. Now we’ll just apply an offset (to both handles) until it’s in the correct position. And we’ll double check, by giving the main gear a crazy rotation, 60k degrees:

Looks fine to me here, doing it by math. Last time I tried to do the math I must’ve screwed something up.

Sorry about that.

I didn’t anticipate that distortion would be a problem for you here, because your individual links are small in comparison to the curve-- I wouldn’t expect it to be something to worry about unless you zoom way, way in. In real life, metal’s flexible anyways.

The distortion was actually pretty noticeable, and I decided to deal with it using that method. In any case it bugged me enough to do that.

Thanks for the info, I got it to work correctly, using those parameters, though I had to carefully adjust the driver curve to match the movement of the sprockets. I wanted to use them in an animation, though I figure if they’re moving fast enough it wouldn’t be obvious that they’re out of sync.

No hard feelings, just letting you know for next time :slight_smile:

Thanks. Unfortunately, the chain pitch ends up offset in relation to the sprocket teeth by a few mm per 360 degree rotation, and after a few rotations (past 720 degrees) it really ends up badly offset. Is there some way to fine-tune the movement rate to match the rotation of the driver gear more exactly? I tried messing with the curves, but that doesn’t seem to work.

I’m looking to have continuous motion too, but until I can get the movement perfectly matched to the sprocket teeth, I’m not worried about it.

Using the numbers I provided, in the most file you provided, your chain doesn’t change its offset to the teeth of the main (driving) gear in 60k degrees, let alone 720. I just looked through it (an autosave) yet again.

But yeah, you can fine tune things. Move both driver f-curve controls in the Y axis in the driver editor to change the offset. Move the right driver control in the Y axis to change the rate.

I’m going to have to backtrack and redo this, I guess, because something is not quite right, and I don’t know what.

So what I did, is start over and, and use Copy as New Driver on the large sprocket and paste that to the Y location of the chain. Then I edited the driver curve (at 0 rotation for the sprocket) to line up the chain, then added in the driver variable as you provided. But it still gets offset over time…

Do you mind posting that autosave file if you still have it?

Sure, I suppose you’ve put enough work in.

chaindrive.06.07.24.blend (1.0 MB)

Thanks, I appreciate it. Although, strangely, even with that file on my machine, the chain still ends out of alignment with the sprocket teeth, with rotation of the driver gear. If that isn’t happening on your side with that same file, it raises some questions. I’m puzzled as to why it’s happening.

For that matter, if I try to adjust the driver curves, that doesn’t seem to work either, as when I fix it for one level of rotation (say 3600 degrees, for example), then it ends up out of alignment for less or more rotation (such as at 1440 degrees, or 36000, etc).

Thanks for your help in trying to solve this, though.