BSS138 Logic Level Converter w/ Flowmeter

Hi all,

I'm an electronics newbie trying to setup a simple flowmeter on an Arduino.

I have one of those generic 5V flowmeters and I've managed to make it work with an Arduino Nano, following this tutorial https://bc-robotics.com/tutorials/using-a-flow-sensor-with-arduino/.
However, I now need to make this work with an Arduino Nano 33 IoT. I have tried using Adafruit's BSS138 LLC, but I haven't managed to make this work.

My connections are as follows:
Adafruit BSS138 LLC:

  • LV to 3.3V on Arduino
  • Lo GND to GND on Arduino
  • A1 to D2 on Arduino
  • HV to 5V on Arduino (5V pads bridged on back side)
  • Hi GND to GND on Arduino
  • B2 to yellow cable (output) on flowmeter (with pullup resistor to 5V)

Flowmeter:

  • Red cable to 5V on Arduino
  • Black cable to GND on Arduino

Unfortunately, this does not work (no serial monitor output). My multimeter shows all voltages are where they should, except for the sensor output which at B2 settles at 0V or 5V when the fan is not spinning, and around 2.5V when it is. I do not own an oscilloscope, so I have no idea how to troubleshoot this.

I could not find a lot of useful info around the webs, so any help is more than welcome!

Can you post a schematic, not a frizzy thing and a link to the sensor showing technical information, not a azon link that just gives sales information.

Hi, I tried to make a quick sketch - if you have a preferred online tool, please let me know so I can make it look better.

The sensor I bought is this one: https://grobotronics.com/liquid-flow-meter-plastic-1-2-nps-threaded.html?sl=en

SPECIFICATIONS
Sensor Type:

    Liquid Flow

Typical Input Voltage:

    5VDC

Oparating Current: 15mA
Interface:

    Analog

Communication Protocol:

    Without

SPECIFICATIONS

    Working Voltage: 5 to 18VDC
    Max current draw: 15mA @ 5V
    Working Flow Rate: 1 to 30 Liters/Minute
    Working Temperature range: -25 to 80°C
    Working Humidity Range: 35%-80% RH
    Maximum water pressure: 2.0 MPa
    Output duty cycle: 50% +-10%
    Output rise time: 0.04us
    Output fall time: 0.18us
    Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)
    Pulses per Liter: 450
    Durability: minimum 300,000 cycles

Did you use a pullup with the Nano? I only ask this because it is not usual to use a pullup but it is common practice to use a 1k series resistor.

I'm not familiar with the Nano33, but I'm betting your problem lies with the BSS138. Hall effect flow meters can work on 2.4v, so I wonder if you really need it.

The 'HV' side outputs on those level-shifters are pulled-up to 'HV' - and the 'LV' side outputs are pulled-up to 'LV', too.

PE - And they are only for High/Low (there's no analog shift).

But then they link to https://github.com/adafruit/Adafruit-Flow-Meter/blob/master/Adafruit_FlowMeter.pde
witch uses interrupts...

Hi all, thanks for taking the time to have a look :slight_smile:

I have tried without the pullup resistor (no luck), but I will also try with it in series.
I also tried with a simple voltage divider, but it did not work.

Perhaps I should change the flowmeter for another model? However, this is the most popular part I could find (no 3V flowmeters found, at all).

They are around

but I'm far from sure you should rush out and buy one, and you have not said that you have tried the one you have on 3.3v. You should check the current available on the 3.3v pin though, as it may be better to use a divider on the 5v pin.
I assume your code is kosher, so I think there is something silly going on with the connections, but that definitely does not mean you should rush out and buy an oscilloscope. Just check them.

I will take a SWAG and say the output is an open collector NPN transistor with the emitter grounded. The little data gives states 5V to 18V, so no guarantee it will work below 5V. Try pulling up to 3V3 with a 1K and 5V for the power and measure the output voltage. I think it will always be between 0 and 3.3V. If so you can eliminate the LLC. If it is spinning it will be somewhere in between. Let us Know.

Hi, thanks for the reply.

I finally managed to get it to work - it was a programming error and not an electrical one.
I used the DIY ZaidaScope Arduino oscilloscope to troubleshoot my circuit, but found everything to be as expected: 5V PWM signal is correctly lowered to 3.3V, and gets stuck to 0V or 3.3V temporarily, depending on the rotor orientation when it stops spinning.

My mistake was with the interrupt pin (0), which was not one that Arduino Nano IoT 33 supported as an interrupt pin. I changed the interrupt and input pins to 2, and everything started working.

Thanks for your time,
P

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.