Posts: 10
Joined: Sun Feb 22, 2015 9:48 am

Hall effect sensor question

Sun Feb 22, 2015 10:54 am

First forum post, so please bear with me!

I'm working on automating the pump and boiler on an outdoor swimming pool.

I'm planning on using a Pi, some DS18b20 temperature sensors, a DN40 1.5 inch water flow sensor and a 433mhz transmitter to control some HomeEasy brand mains sockets.

The temperature sensors seem fairly straightforward. The 433mhz remote stuff looks trickier, but it seems like I may be able to use PiSwitch to sample the codes from the existing remote and replay them. Failing that it seems that rigging the output from the receiver to a PC soundcard and using Audacity should work.

The area I'm least clear on is wiring the DN40 hall effect sensor: it seems that reading the output is a matter of using WiringPi's ISR function to count the pulses, but I'm not certain whether I can use the Pi's 5v pin to power the sensor or not. The specs seen to indicate 5v-24v (, so I assume it would be OK, but could do with a bit of expert guidance. Does anyone have any experience using this kind of sensor?

Posts: 3520
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Hall effect sensor question

Sun Feb 22, 2015 1:42 pm

You will need to do some test with it.

5 Volts should be okay to power it up.

Just use a resistor divider to reduce the output signal to 3.3V.

The best way is to add a schmitt trigger gate to square the pulse. (Prevention of double pulse).

This is a schematic I made using a LM555 I.C. Everything is on 5V. but I use the open collector output using a 3.3V pull-up.
This way we are 3.3V friendly for the Raspberry Pi GPIO. Another advantage is that if you need to power the sensor with 12V, you could just use 12V on the LM555. ... 59#p685759

and for pulse counter I will use pigpio.


Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Hall effect sensor question

Mon Feb 23, 2015 4:04 am

The hall effect sensors that I have don't pull the signal up to vcc, it's either GND or floating, and you use a pull-up to make floating something predictable. This works very well with the Pi, since I can power the sensor off 5v, and use a pullup on the signal pin to 3.3v so that the GPIO remains safe.

If yours works the same, great. Otherwise, you'll have to use two resistors to make a voltage divider and bring the 5v down to the safe 2.5-3.3v range for the GPIO to read. Still pretty easy.

Posts: 10
Joined: Sun Feb 22, 2015 9:48 am

Re: Hall effect sensor question

Thu Apr 23, 2015 7:16 pm

Thanks very much to those who replied, it was very helpful.

I wasn't able to power the hall effect sensor off the pi, I had to use a separate 5v supply from the 'never throw anything away' box.
I've got some simple python to log the number of falling edge interrupts in a given time and can detect when I blow through the sensor. I do seem to get a lot of noise (0 to 4 edge detections per second), but that may just be the way I've got things wired temporarily.

I'm planning on wiring the DS18B20s to the pi using CAT5E. Would I be OK to use three of the spare wires in the cable to carry ground, 5v and signal from the hall sensor, or will this upset the 1-wire traffic?


Return to “Automation, sensing and robotics”