A comparator is a device which is used to sense when an arbitrary varying signal reaches some threshold or reference level.