Now we'll build a sensor for detecting the RPM of the motor. This number is important for safety of the motor, efficient when driving, and most importantly my power steering needs this value. Sure I could just spoof a number to make it happy but would much rather have the real value and display it on the original tachometer.
First off the sensor we will be using is a Melexis 90217 Hall-Effect Sensor. This is really a great sensor. It auto calibrates itself depending on the seen variations in magnetic fields and has a built in ADC. The sensor can be used in a few ways but in this case it seems easier to use the gear tooth pickup feature. Basically you can add a magnet to one side of the sensor and then by running metal past the sensor on the other side causes the magnetic field to pass through the sensor. As each tooth passes by it detects the tooth. Take the total count for a given period of time and divide that by your number of teeth and then convert that time frame to minutes for your RPM!
I picked up a few supplies from a local Tractor Supply and of course hardware store. I found a keyed collar that was 3/4" (secondary output shaft). I also found a 3/4" gear which I figured I could use. They also had the 1/4"x1" key I needed to lock the collar to the motor shaft. I also picked up a plastic spacer. I needed something to house the sensor that wasn't a material the magnetic force would be affected by. The long black thing is just some heat shrinking tubing.
I put some heat shrink tubing around the magnet so that the pins of the sensor wouldn't short out across it. Next I hot glued the sensor to the magnet.
The sensor and magnet were then placed inside the plastic collar and hot glued into place. The connector is attached to the sensor.
Here is a top view. You can see the sensor embedded in the spacer and hot glue.
Next I put a layer of heat shrink tubing around the whole thing (blue) followed by a few wraps of electrical tape. The sensor is ready.
Now we needed something to mount the sensor to that could be mounted to the motor. Again to avoid interfering with the magnetic field I choose an aluminum square tubing. It's easy to work with and doesn't need to be strong to only hold the sensor. It also allowed for the sensor and wire to be enclosed even further. I cut an oblong mounting hole so that it could be precisely adjusted above the gear if needed.
Here is the completed sensor assembly. It was a snug fit into the tubing but I added some extra electrical tap anyway.
I welded the gear to the collar and painted them to protect the steel from the elements. Not bad!
Here is the gear and sensor mounted to the motor. When I'm doing the final wiring I will protect the sensor wires in a loom. Right now I have a few extra washers bring the sensor out far enough. Later this will be replaced with the mount for my AC compressor.
Here is a picture of my setup testing the RPM sensor. Make sure you never apply more than 12 volts on this motor unless it's under load. You can seriously hurt the motor and yourself.
Here is the output from my debugger. I'm doing a 250ms sample in this test so my number needs to be multiplied by 240 to get RPM. If I was doing a 1000ms, or 1 second, sample I would multiply by 60. In addition I have 12 teeth on the gear so the number must be divided by 12.
98 * 240 / 12 = 1960.
In the final project a variance of the pulses, not RPM will be sent to the gauge and EPS unit. I think it was something like four pulses / revolution. I'll have to do some testing and compare my debugger numbers to the gauge to calibrate that.