The comparator solution as drawn (both of them) require a split power rail. Otherwise the +ve input is never going to be able to go below the -ve one to switch the comparator.
Thanks for the explanation dc42.About your circuit, I didn't understood the diodes protection very well.You connected two diodes "inverted" to each other between the comparator inputs?Isn't it just like wiring the inputs together? How does that work?
It didn't work well with either schematics here had here, there was too much noise, specially at low RPMs.So I followed the links posted by ams0178 to add hysteresis, and this the schematic I got working pretty fine (at first).
As I explained in my 1st post, my goal is to control the speed of a motor by controlling the supply of the injection pump.When I hookup the rest of the circuit I got (schematic bellow) to control the pump, instead of via an external adjustable power supply.There was some kind of interference and my rpm reading got crazy (much higher than the real), so I guessed more noise :-/Then I started looking at the signals in the oscilloscope, but when I connected the oscilloscope to the sensor pins the noise got "filtered" somehow.I don't understand this, but it was always reproducible. When the oscilloscope is connected on the sensor leads (along with my circuit), the RPM reading is fine. If I disconnect it, it goes crazy.