This defines a pic for the gear. It takes the parameters
- the number of cogs
n,
- the radius of the inner circle
r1,
- the radius of the gear
r2,
- the amplitude
a.
The other things like draw color, fill color and transformations like rotations can be passed to the options of the pic. I also added the ratio \Ratio of cogs.
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/sinus gear/.style={code={
\tikzset{gear/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/gear/##1}}
\pgfmathtruncatemacro{\mymod}{360/\pv{n}}
\draw[pic actions]
plot[variable=\t,domain=0:360,samples=12*\pv{n}+1,smooth cycle]
(\t:{\pv{r2}+\pv{a}*sin(\pv{n}*Mod(\t,\mymod))})
(0,0) circle[radius=\pv{r1}];
}},
gear/.cd,r1/.initial=0.8cm,r2/.initial=1cm,n/.initial=12,a/.initial=0.1cm]
\begin{scope}[local bounding box=gears]
\def\Ratio{5}
\path (0,0) pic[fill=orange!20,draw=orange,even odd rule]
{sinus gear={n=10*\Ratio,r1=\Ratio*0.3cm,r2=\Ratio*0.5cm}}
(135:{(1+\Ratio)*0.5cm+\pgflinewidth})
pic[fill=red!20,even odd rule,draw=red,rotate=90/\Ratio]{sinus
gear={n=10,r1=0.3cm,r2=0.5cm}};
\end{scope}
\end{tikzpicture}
\end{document}

This is a clipped version with different colors and inner radii (and an arrow). The reason why one may want to clip it is that then cogs match. If you want a cog up or down, rotate the gear by integer multiples of 90/n, where n is the number of cogs.
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[pics/sinus gear/.style={code={
\tikzset{gear/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/gear/##1}}
\pgfmathtruncatemacro{\mymod}{360/\pv{n}}
\clip plot[variable=\t,domain=0:360,samples=12*\pv{n}+1,smooth cycle]
(\t:{\pv{r2}+\pv{a}*sin(\pv{n}*Mod(\t,\mymod))})
(0,0) circle[radius=\pv{r1}];
\draw[pic actions]
plot[variable=\t,domain=0:360,samples=12*\pv{n}+1,smooth cycle]
(\t:{\pv{r2}+\pv{a}*sin(\pv{n}*Mod(\t,\mymod))})
(0,0) circle[radius=\pv{r1}];
}},
gear/.cd,r1/.initial=0.8cm,r2/.initial=1cm,n/.initial=12,a/.initial=0.1cm]
\begin{scope}[local bounding box=gears]
\def\Ratio{5}
\path (0,0) pic[fill=yellow,draw=orange,ultra thick,even odd rule,rotate=90/50]
{sinus gear={n=10*\Ratio,r1=\Ratio*0.3cm,r2=\Ratio*0.5cm}}
(90:{(1+\Ratio)*0.5cm})
pic[fill=blue,even odd rule,draw=purple,ultra thick,
rotate={90*(\Ratio+1)+\Ratio*90/50+18}]{sinus gear={n=10,r1=0.3cm,r2=0.5cm}};
\draw[-latex,] (90:{(1+\Ratio)*0.5cm+\pgflinewidth})
++ (0,-0.8*0.3cm) -- ++(0,1.6*0.3cm);
\end{scope}
\end{tikzpicture}
\end{document}

An animated version.
\documentclass[tikz,border=3mm]{standalone}
\tikzset{pics/sinus gear/.style={code={
\tikzset{gear/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/gear/##1}}
\pgfmathtruncatemacro{\mymod}{360/\pv{n}}
\draw[pic actions]
plot[variable=\t,domain=0:360,samples=12*\pv{n}+1,smooth cycle]
(\t:{\pv{r2}+\pv{a}*sin(\pv{n}*Mod(\t,\mymod))})
(0,0) circle[radius=\pv{r1}];
}},
gear/.cd,r1/.initial=0.8cm,r2/.initial=1cm,n/.initial=12,a/.initial=0.1cm}
\begin{document}
\foreach \X in {1,...,36}
{\begin{tikzpicture}
\path[use as bounding box] (-3.1,-2.6) rectangle (2.6,3.1);
\def\Ratio{5}
\path (0,0) pic[fill=orange!20,draw=orange,even odd rule,rotate=\X/\Ratio]
{sinus gear={n=10*\Ratio,r1=\Ratio*0.3cm,r2=\Ratio*0.5cm}}
(135:{(1+\Ratio)*0.5cm+\pgflinewidth})
pic[fill=red!20,even odd rule,draw=red,rotate=90/\Ratio-\X]{sinus
gear={n=10,r1=0.3cm,r2=0.5cm}};
\end{tikzpicture}}
\end{document}

\documentclass[tikz,border=3mm]{standalone}
\tikzset{pics/sinus gear/.style={code={
\tikzset{gear/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/gear/##1}}
\pgfmathtruncatemacro{\mymod}{360/\pv{n}}
\draw[pic actions]
plot[variable=\t,domain=0:360,samples=12*\pv{n}+1,smooth cycle]
(\t:{\pv{r2}+\pv{a}*sin(\pv{n}*Mod(\t,\mymod))})
(0,0) circle[radius=\pv{r1}];
}},
gear/.cd,r1/.initial=0.8cm,r2/.initial=1cm,n/.initial=12,a/.initial=0.1cm}
\newsavebox\BigGear
\newsavebox\SmallGear
\def\Ratio{5}
\sbox\BigGear{\tikz{\pic[fill=orange!20,draw=orange,even odd rule]
{sinus gear={n=10*\Ratio,r1=\Ratio*0.3cm,r2=\Ratio*0.5cm}};}}
\sbox\SmallGear{\tikz{\pic[fill=red!20,even odd rule,draw=red]{sinus
gear={n=10,r1=0.3cm,r2=0.5cm}};}}
\begin{document}
\foreach \X in {1,...,90}
{\begin{tikzpicture}
\path[use as bounding box] (-3.4,-3.4) rectangle (3.4,3.4);
\path (0,0) node{\usebox\BigGear}
(4*\X:{(1+\Ratio)*0.5cm+\pgflinewidth})
node[rotate={4*(\Ratio+1)*\X}]{\usebox\SmallGear};
\end{tikzpicture}}
\end{document}
