IK-based rig problem

Hi everyone, I’m new here. Anyway, I’m currently working on a model of a robot, and I want to add these little gears that spin when the arm moves in a certain way. (Basically, when one bone rotates on the y axis, the gears spin.) The problem is that the bone which is supposed to control this movement is affected by IK everywhere, and for some reason IK-induced rotation don’t affect any of the constraints I know of. I’ve tried everything I could think of, but all the stuff that seems to work can’t be implemented into something that moves as much as an arm, while the ones that can don’t work. So help?