Here I have made some "spur" gears. The smallest has 5 teeth, the largest has 20, and the other two have 10 and 15 teeth. There isn't actually any physics going on, just believable timing.
How to draw a gear.There are many ways to draw a spur gear procedurally, here I will describe the one I'm using above.
Each gear consists of some number of spokes or "teeth" and an equal number of indents or "valleys". In my version above, the valleys are mirror-reversed versions of the teeth, so they're drawn the same way, just flipped upside down. So, I just need to explain how to draw a tooth.
The gear actually has three invisible circles, one which grazes the bottoms of the valleys, one which grazes the tops of the teeth, and one which is midway between these two. Each tooth is actually a Bezier curve, which consists of two end points and two control points. It turns out to be good enough to put the end points on middle circle, and the control points on the inner circle for valleys and the outer circle for teeth and to make each point (control or end) a small angle further around the circle from its predecessor. That's the basic trick. I may try to add more details and pictures (sorry for all the text) at a later date.