
Flow Instrumentation
Model BV2000
PURPOSE
This document provides a reference design to incorporate the
Vision BV2000 flow meter into an existing circuit. Customers have
the option to include a microcontroller into the circuit that would
be used to monitor and possibly display the rate of flow and total
accumulated flow.
HARDWARE DESIGN
For reference purposes, a development kit was used in this
illustration. The development kit includes a discovery board with
a microcontroller and many built-in peripherals including a 24
segment LCD display. For this design, the ST Microelectronics
STM32L-Discovery board was used. The data sheet for the discovery
board can be found at: http://www.st.com/st-web-ui/static/active/
en/resource/technical/document/data_brief/DM00027566.pdf
There are many free firmware development Toolchain options
available to develop on the STM discovery board.
The following is a circuit that could be used to interface the
microcontroller into a circuit containing the meter.
VIS-AS-00984-EN-01 (June 2014)
A Voltage divider is used to protect the discovery board input pin
from a voltage exceeding 5 Volts. Also, a low-pass filter is used to
block out external noise that may be coming in on the data line
(brown wire).
Reference Design

Vision Turbine Meters
FIRMWARE DESIGN
The firmware in this example was developed using the Keil uVision5 compiler. The interface to the discovery board was over USB-A to mini
USB-B cable using the ST-Link Debugger driver. The firmware was developed to execute the following functions:
• Display/Scroll Welcome message upon board power up
• Calculate and display the totalizer value
• Calculate and display the current flow
• Use the “USER” push button to advance screens
• Use the “RESET” push button to reset totalizer and flow and re-display the welcome message
A majority of the code was provided by ST-Microelectronics to run their discover project, which is standard to this version of discovery
board. The code can be found on ST’s website at http://www.st.com/web/catalog/tools/PF250990. This code is used to run the
initialization and setup of the discovery board (LCD screen, memory, etc…), but can also be modified to set up an external interrupt driven
by the rising and/or falling edges of the pulses generated by the Vision flow meter.
Some basic code snippets (in C/C++) to drive the totalizer count and flow calculation can be seen below:
Updating the Totalizer:
void Update_Total(void) {
if (Flow % PPL == 0)
Totalizer++;
}
Flow is the variable used to track the number of pulses generated by the meter.
PPL represents how many pulses there are to make one liter (given by data sheet of meter).
Totalizer is the variable used to store the value of the totalizer.
Updating the Current Flow Rate:
void Update_Rate(void)
{
if(prev_rate >= Flow)
{
Flow_Rate = 0;
return;
}
Flow_Rate = Flow - prev_rate;
prev_rate = Flow;
}
Prev_rate is the temporary value of the previous rate of flow.
Flow_Rate is the current flow rate.
Flow is the variable representing pulses coming from the meter.
The code works in the following manner: if pulses are coming in from the meter, display the flow rate then wait for ~1 second. Store the flow
rate as the previous flow rate, then check how many pulses are coming in and store as the Flow_Rate. Display the difference between the
current flow rate (Flow_Rate) and the flow rate from 1 second earlier (prev_rate). Repeat until pulses are no longer being collected at
the input.
Page 2 June 2014

Control. Manage. Optimize.
Trademarks appearing in this document are the property of their respective entities. Due to continuous research, product improvements and enhancements, Badger Meter reserves
the right to change product or system specications without notice, except to the extent an outstanding contractual obligation exists. © 2014 Badger Meter, Inc. All rights reserved.
www.badgermeter.com
The Americas | Badger Meter | 4545 West Brown Deer Rd | PO Box 245036 | Milwaukee, WI 53224-9536 | 800-876-3837 | 414-355-0400
México | Badger Meter de las Americas, S.A. de C.V. | Pedro Luis Ogazón N°32 | Esq. Angelina N°24 | Colonia Guadalupe Inn | CP 01050 | México, DF | México | +52-55-5662-0882
Europe, Middle East and Africa | Badger Meter Europa GmbH | Nurtinger Str 76 | 72639 Neuen | Germany | +49-7025-9208-0
Europe, Middle East Branch Oce | Badger Meter Europe | PO Box 341442 | Dubai Silicon Oasis, Head Quarter Building, Wing C, Oce #C209 | Dubai / UAE | +971-4-371 2503
Czech Republic | Badger Meter Czech Republic s.r.o. | Maříkova 2082/26 | 621 00 Brno, Czech Republic | +420-5-41420411
Slovakia | Badger Meter Slovakia s.r.o. | Racianska 109/B | 831 02 Bratislava, Slovakia | +421-2-44 63 83 01
Asia Pacic | Badger Meter | 80 Marine Parade Rd | 21-06 Parkway Parade | Singapore 449269 | +65-63464836
China | Badger Meter | 7-1202 | 99 Hangzhong Road | Minhang District | Shanghai | China 201101 | +86-21-5763 5412 Legacy Document Number: N/A