marsrover
Posts: 3
Joined: Mon Sep 04, 2017 4:05 pm

Hacking a flow sensor

Sat Sep 16, 2017 1:37 pm

Hello all,

I am working on interfacing a Neptune FS-100 flow sensor unit with my raspberry pi.

After taking it apart, I have found inside a Honeywell SS460S Hall sensor (http://www.mouser.com/ds/2/187/honeywel ... 794951.pdf) and a 120ohm resistor between V+ and the output pin.

The Neptune control module for their flow sensors say:
In addition to the four sensor ports, the FMM also has a DC24 accessory port and a power supply input. This adds another controllable outlet to your Apex set up. So, for instance, if you do want to make your own ATO and attach our available PMUP or Solenoid Valve, you can do so. Simply add our 36W 24V DC power supply (available separately).
I looked at the data sheet for the hall sensor and i'm trying to make sense of it.

To me, it is saying:
The range of input supply voltages 3-24Vdc.
The output range (Applied output voltage?) is -0.5V to 26.0 V

But it doesn't provide information on input voltage to output voltage.

I have a few questions:
1. How to read/interpret this data sheet
2. How to interact with this flow sensor using my raspberry pi
3. Do I need a 24V power supply? Or can i power this thing off my Raspberry pi 3.3V supply?
4. I tried hooking up the hall sensor with V+ going to 3v3, ground going to ground, and the output pin going to pin 23 with the following test code and my output is pretty erratic regardless of whether i pull up or down the output pin (23). It reads "true" even when there is no magnet anywhere near the hall sensor. When i bring the magnet near it, it doesn't seem to change the output noticeably. I rotate the magnet very slowly trying to find the + or - side and there isn't much of a change. The code :

Code: Select all

#!/usr/bin/python
import os
import RPi.GPIO as GPIO

boardRevision = GPIO.RPI_REVISION
GPIO.setmode(GPIO.BCM) # use real GPIO numbering
#GPIO.setup(23,GPIO.IN, pull_up_down=GPIO.PUD_UP)
#GPIO.setup(23,GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(23,GPIO.IN)

lastPinState = False
pinState = 0

CONTINUE = True


# main loop
try:
     while CONTINUE:
       if GPIO.input(23) == True:
         pinState = True
         print "Pinstate = True!!!"
       elif GPIO.input(23) == False:
         pinState = False
         print "Pinstate = False!!!!!!!"

# if CTRL+C is pressed the main loop is broken
except KeyboardInterrupt:
     CONTINUE = False
     print "\Quitting"


# Actions under 'finally' will always be called
# regardless of what stopped the program
finally:
     # stop and cleanup to finish cleanly so the pins are available to be used again
     print "Cleaning up...."
     GPIO.cleanup()
thanks for your help with this folks!
Screen Shot 2017-09-16 at 7.04.07 AM.png
Screen Shot 2017-09-16 at 7.04.07 AM.png (246.38 KiB) Viewed 286 times

User avatar
Burngate
Posts: 4976
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Hacking a flow sensor

Sat Sep 16, 2017 5:38 pm

marsrover wrote:
Sat Sep 16, 2017 1:37 pm
I looked at the data sheet for the hall sensor and i'm trying to make sense of it.

To me, it is saying:
The range of input supply voltages 3-24Vdc.
The output range (Applied output voltage?) is -0.5V to 26.0 V

But it doesn't provide information on input voltage to output voltage.
That's because there's no relationship between input voltage and what the output does.

As long as there's at least 3v (and no more than 24v) between supply and ground pins, the output pin will be either a short-circuit to the ground pin, or open-circuit.
You circuit must attempt to put current into that output pin, and see what happens to it - either its voltage stays low, or it goes as high as it can.

The device's output pin can sink 20mA to ground (table 1 of the data sheet), but putting 120R from 3v3 to the output pin can cause 27.5mA to flow.
You may have been unlucky with this and destroyed the device.
Next time, use a higher resistance - 1k or more, or use the Pi's internal pull-up (which is about 50k)
I have a few questions:
1. How to read/interpret this data sheet
The picture at the top of page three is where I went first, followed by the table on page 2. Then I had to hunt round to find the pin-out.
3. Do I need a 24V power supply? Or can i power this thing off my Raspberry pi 3.3V supply?
It'll work happily down to 3v (table 1) so you don't need any more than 3v3 from the Pi
4. I tried hooking up the hall sensor with V+ going to 3v3, ground going to ground, and the output pin going to pin 23 ...
That looks good. But see my analysis of the 120R resistor.

User avatar
Burngate
Posts: 4976
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Hacking a flow sensor

Sun Sep 17, 2017 10:15 am

I've googled a bit more.

The manufacturers were unlikely to design it such that the chip was being overloaded, as 120R would do.
It seems that other people have come up with 10k as the value of the resistor, which makes more sense.
So you should be safe to use it as-is.

As regards it not doing much -
When i bring the magnet near it, it doesn't seem to change the output noticeably. I rotate the magnet very slowly trying to find the + or - side and there isn't much of a change.
Once the power supply has stabilised, the output will stay on or off (low or high) until a magnetic field of the right magnitude and direction tells it to change.
May be you haven't tried with a strong enough magnet?

marsrover
Posts: 3
Joined: Mon Sep 04, 2017 4:05 pm

Re: Hacking a flow sensor

Sun Sep 17, 2017 2:15 pm

Hello Burngate,

This is a full unit produced by a well known manufacturer of saltwater aquarium monitoring systems. The magnet and resistor are all integrated into the unit as sold so i am confident this circuit and magnet should work....somehow....
IMG_4106.JPG
IMG_4106.JPG (206.45 KiB) Viewed 222 times
IMG_4107.JPG
IMG_4107.JPG (225.2 KiB) Viewed 222 times
IMG_4108.JPG
IMG_4108.JPG (248.08 KiB) Viewed 222 times

i'm curious on how i use this with a Pi?
You circuit must attempt to put current into that output pin, and see what happens to it - either its voltage stays low, or it goes as high as it can
. How exactly do you do that?

thanks

pcmanbob
Posts: 1767
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Hacking a flow sensor

Sun Sep 17, 2017 6:43 pm

I would approach this as 2 separate problems

first test the hardware to make sure you know its working and what output it actually provides.

From you circuit description you should be seeing either 3.3v or 0V on the output wire.
so have you tested with a meter to see if you actually get this change of output.
disconnect the output wire from the pi and connect a meter set on volts between the wire and ground now with the sensor powered if you slowly pass the right part of the vanes past the sensor past do you see the voltage change you may have to pass several vanes past the sensor to see the change. also noting what actual voltages you see.


once you have proved the sensor is working and that voltages you see are within the ranges need to work with the pi gpio then you can do a simple test with the pi.

Code: Select all

import import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(7, GPIO.IN)

while True:
    print GPIO.input(7)
    time.sleep(0.1)
    
once you can see the changing string of 1's and 0's you know your sensor is connected and working on the pi you can then move on to writing your actual program to capture the input.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 10 guests