Using Gear tooth Sensors in an Off-Road Racecar
Measuring systems that spin very fast is a common challenge in vehicle systems. To accurately measure how quickly something is spinning without touching it like an encoder, the UCLA Baja racing team makes use of the Littelfuse 55075 series of gear-tooth sensors. In this article, weāll be exploring how gear tooth sensors use the Hall effect to function, as well a practical example of how we use them on our race car. After giving this a read, you should hopefully be able to implement your own gear tooth sensor solutions!
Theory
Gear tooth sensors like the Littelfuse 55075 use the Hall effect to detect ferrous materials. Thatās a dense statement, so letās take a second to unpack it. Ferrous materials (or any material with high magnetic permeability) have a very special property: they can guide and concentrate magnetic fields. In the figure below, you can clearly see that introducing a ferrous material into the magnetic field of a typical bar magnet concentrates the field directly in front of it. This means that as ferrous materials pass by the face of the sensor, the strength of the magnetic field will become stronger and weaker. Gear tooth sensors like the 55075 series typically embed this magnet into the sensor body, but you should check your sensorās datasheet to be sure! Source: Edward Ramsen
But how is this useful, and how do we detect this phenomenon? The answer lies in the Hall effect. The Hall effect takes advantage of the fact that magnetic fields push moving electric charges. Charges of different signs move in opposite directions, allowing us to detect magnetic fields as a voltage! By reading this voltage, we can quantify the strength of the magnetic field through the sensor. The finer details of how a hall effect sensor works can get hairy, so hereās a video by the organic chemistry tutor explaining how it works! Picture of the Hall Effect in Action. Charges moving due to the magnetic field create a voltage Vh that we can measure!
Implementation
By measuring the Hall Effect, gear tooth sensors can read when ferrous materials pass by them. Like I said, we can use this to read the speed of a spinning object (provided it is ferrous). Thankfully, because of some additional circuit magic inside the 55075 series, we donāt have to worry about reading and interpreting the Hall Effect voltage. Instead, the sensor outputs a digital high signal when it detects the presence of a ferrous material, and a digital low signal otherwise.
We can easily interpret these digital signals using a microcontroller like an Arduino Uno. Weāll be using the same sensors we use on the car: the 55075 by Littelfuse. Wire up the sensor as shown below.
In this example, weāll be using the gear tooth sensor to measure the speed of the front wheels of our vehicle. Picture of how the gear tooth sensor is implemented in the demo.
Circled in red is the gear tooth sensor. Itās set up to read the slots in the steel brake disc. As the wheels (and the brake disc) spin, the sensor outputs a logic low when the slots in the disc pass by. If you donāt have access to a Baja car, donāt worry! You can also wave any ferrous item across the face of the sensor to test if its working! We like to use steel bolts in a pinch. If your sensor is powered with 5V, and you probe the output, you should see the following:
Code
In the Arduino IDE, we used the following code to record the RPM (rotations per minute) values as the wheel spins:
The code isnāt too complicated if youāve used interrupts before. An interrupt is just a function that triggers when a digital pin changes, or is driven high/low. In our case, we detect when the gear tooth sensorās output changes (High-Low or Low-High). When that happens, we increment our variable, ticks.
Each tick corresponds to the sensor passing by a slot in the brake rotor. In the main loop, we evaluate the RPM every 0.5 seconds by dividing the number of ticks by the number of slots in the brake rotor (8). This gives us rotations. We then divide that by how many minutes have elapsed to get the rotations per minute (RPM)!
We print both the calculated RPM and the time in milliseconds so that we can plot our data later!
Results
In order to test our sensor, we drove our car around in a parking lot for a few minutes at a time. We then took the values we printed to the serial monitor and graphed it using Python. The results are shown below: You can see that the output contains quite a bit of noise and a couple peaks that need to be filtered out. By passing the sensor data through a simple low pass filter, we can achieve the output below! Using this method, the Baja team measures the speed of all 4 wheels and the engine. We then use those sensor inputs to control our automatic transmission! Weāll save explaining how we do that for a different article.
By now, if youāve read through the article, you should be able to understand not only how a gear tooth sensor works, but also how to implement it in practice! Happy making!