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.
Could you show me how to connect the Sensor directly to the Raspberry PI? Thanks
ReplyDeleteConnect pin 1 (leftmost pin as pictured above) to a 3.3v.
ReplyDeleteConnect 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.