Rpm Counter

Hello, I'm building little rpm counter with hall sensor from cd-rom.

I have ground and +5V pin conected to it with 1k resistor and signal from sensor with 1k resistor also to A0 pin on arduino running analog read code. When serial opened it shows about 0.3V float, when magnet is close it ramps up to around 0.9V (and goes down to 0.3V again when magnet isn't close).

I need a code that would count rpm based on lets say if sensor reads above 0.4V adds to the value. Google-d everything ,but nothing realy helped.

sensor datasheet (not exactly, but pin I/O same as my sensor):

Sorry if I got into the wrong section, but I need some help. Thanks.

Post a wiring diagram (hand drawn, not Fritzing).

If you can find the data sheet for your sensor, that would be very useful.

I need a code that would count rpm based on lets say if sensor reads above 0.4V adds to the value. Google-d everything ,but nothing realy helped.

This sounds like a job for the analog comparator and the analog comparator interrupt.

Your google search terms should be "arduino analog comparator" and you'll find articles like this

There is even a library to do the register setup for you.

Available through the library manager.

Sensor datasheet is almost same for every hall effect sensor in this package, it has four legs: Gnd, vcc, h+, h-.

It's not complicated setup, just powered it with arduino 5v (resistor between for limiting current to about 10mA because sensor max is 20ish), on sesnor bridged Gnd pin with h+ pin , and h- pin connected to A0 pin of arduino with resistor in series for safety.

This all is in datasheet page 5 that I linked.

Sensor datasheet is almost same for every hall effect sensor in this package

It is fascinating that you know about every one of the sensors with this pinout, but don't care about the differences, and can't post a link to the data sheet for the sensor you have.

Good luck with your project.

Not really that I know, but you can't find out what sensor it is if only "F" is on the casing of it so yeah. Tested it and find out that it give same results on output like that sensor from datasheet, what else I can?

Another datasheet:

I have searched and this is linear hall effect sensor but didn't find any code for the project, when no magnet is present it shows 60 analog value and about 180 value when magnet is present. just need some code for it to work if anyone would help it will be great! Thanks.

Found the code that works perfectly, just changed the treshold to 70!

Thanks guys.