how to rig a car engine piston
This can be done with one driver and one look-at constraint.
The height of the piston-pin above the center of the crank is given by the following expression:
h = r * cos(A)+sqrt( (l**2)-( (r**2)*(sin(A)**2) )  )
where r is the radius of the crank, l is the length of the rod, and A is the rotation of the crank, as explained here.
With a crank of radius 1, and a rod of length 4, as illustrated, this reduces to:
sqrt(16-(sin(A)**2))+cos(A)
so this is the sort of expression you can put into a driver for the height of the piston(-pin), where A is the angle through which the crank is rotated.
The rod simply has to be parented to the crank, with its origin on the crank's circumference, and given a Locked Track constraint, making it look at the piston-pin.

If you parent both the piston-pin and the crank to another object, their transforms are evaluated in that object's space, and so the rig can be freely moved around, using their parent. In the example blendfile, it's the Empty called 'Basis'.