A versatile interface circuit for capacitive and resistive sensors