using a high sensitivity switch SW-520-d as a sensor. the working voltage from 3.3 V to 5 V output form: digital switching output (0 and 1) use the wide voltage comparator LM393 the comparator output, clean signal, good waveform, driving capacity is strong, for more than 15 ma.