Wednesday, August 14, 2013

Hall Effect Sensor

For wind speed, I decided to build my own anemometer rather than just buy one off of the shelf.  I figured I could do a satisfactory job for significantly less money than most digital anemometers cost. Basically I need to determine how many times the rotor spins in a given period of time, and then I can correlate that to a wind speed (in mph, kph, knots, m/s, etc...). 

To accomplish this, I need a momentary switch of some kind to send an interrupt signal over a GPIO pin to the Pi, but I didn't want to introduce any extra drag into the system. In this situation, a reed switch or hall-effect switch would be perfect. Both of these sensors detect the presence of a magnetic field.  I found that Adafruit had a hall-effect sensor that they had tested, and I determined that it would be perfect for my setup.  
Hall-effect sensor from Adafruit. And yeah, that's a quarter next to it... This thing is tiny!

I also acquired a neodymium magnet and tested the sensor. Adafruit came through again. This sensor was great!  There were literally no issues with bounce which should make coding easier (read more about bounce). It only requires you to connect power, ground, 1 GPIO pin, and a pullup resistor. Now it is time to integrate this thing with a set of wind cups and get it calibrated.  

2 comments:

  1. Could you show me how to connect the Sensor directly to the Raspberry PI? Thanks

    ReplyDelete
  2. Connect pin 1 (leftmost pin as pictured above) to a 3.3v.
    Connect pin 2 (middle pin) to ground.
    Connect pin 3 (rightmost pin) to any GPIO port and place a 10K resistor between pin 3 and power (pin 1).
    Your program should listen on whatever GPIO port you used. When the south pole of a magnet is near, the voltage will drop to 0v.
    If you need more help, just let me know.

    ReplyDelete