Browse our open source example apps to accelerate your wireless IoT project.

Blues Developers
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Button IconHelp
Notehub StatusVisit our Forum
Button IconSign In
Sign In
Sign In
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
homechevron_rightExample Appschevron_rightAcceleratorschevron_rightValve Monitor

Valve Monitor

  • Arduino Firmware
  • Environment Variables
  • Fleet Management
  • Notehub API
  • Swan
  • Web App Provided
  • Wiring Required
  • Zephyr Firmware

Monitor and control the open/closed state of a valve, and measure liquid flow state.

The valve monitor project’s web application and hardware

To run this project yourself you’ll need to:

  • Configure Notehub.
  • Purchase and assemble the necessary hardware.
  • Flash the project’s firmware
  • Run the project’s web application.

Notehub

The Valve Monitor project runs on top of Notehub. As such, to run this sample you’ll need to create a Notehub account, start a new Notehub project, and configure a handful of environment variables.

Creating a New Project

  1. Sign up for a free Notehub account, if you don’t have one already.
  2. Click the blue Create Project button in the top-right corner of the screen.
  3. Give the project a name, such as “ValveMonitor”, and then click the next Create Project button. Creating a project in Notehub with a name

Configuring Environment Variables

The Valve Monitor project uses environment variables for storing project settings that need to be shared and synchronized across devices.

You can set this project’s environment variables at the fleet level or device level, where fleet-level variables affect all devices in the fleet, and device-level variables are specific to an individual device.

Notehub creates an initial fleet for you when you start a new project, and you can use that for setting your initial variables.

  1. Navigate to your fleet in the navigation menu, and then click the Settings link. Location of Notehub fleet settings
  2. Click the Environment tab.
  3. Scroll down to the Fleet environment variables heading, and define the four variables below.
    1. flow_rate_alarm_threshold_max: (number) The maximum expected flow rate from your device, in mL / min. Flow-rate readings over this amount will trigger an alarm.
    2. flow_rate_alarm_threshold_min: (number) The minimum expected flow rate from your device, in mL / min. Flow-rate readings under this amount will trigger an alarm.
    3. monitor_interval: (integer) How often to take readings from the device’s flow-rate monitor, in seconds.
  4. With all three defined, click the blue Save button. Notehub fleet environment variables fully defined

With this your Notehub backend is fully configured, and you’re ready to start setting up your hardware.

Hardware

The following hardware is required to run the Valve Monitor project.

  • A Blues Starter Kit .
  • A flow meter, such as this GREDIA Quick Connect Water Flow Sensor .
  • A solenoid valve, such as this DIGITEN Inlet Feed Water Solenoid Valve .
    • If you do get the DIGITEN valve, make sure you also have spade cables for connecting the valve to power.
  • Tubing for moving liquid throughout your hardware, such as this 1/4 OD silicone tubing .
  • A power breakout, such as this HiLetgo power breakout for supplying correct voltage to this project’s various components.
  • An I2C level shifter, such as this one from HiLetgo , to translate the flow meter’s pulses from 5V logic to 3.3V logic for the Swan microcontroller.
  • A MOSFET driver, such as this one from HiLetgo , is required to allow the Swan to switch on high-power devices such as the solenoid, without needing to send that power from the microcontroller. (The Swan can only send about 0.066 Watts (3.3V*20mA) out of a GPIO.)

Additionally you may wish to also use the following:

  • (Optional) A manual valve such as this YZM Quick Connector to make it easier to start/stop the flow of liquid while testing.
  • (Optional) An enclosure for your hardware such as this outdoor-friendly enclosure from Sixfab .

Once you have all of your hardware you’ll next need to assemble the pieces. To start, complete the Notecard and Notecarrier-F quickstart guide, which will help you connect your Notecard, Notecarrier, and Swan.

The Notecard, Notecarrier, and Swan connected

From there you’ll need to connect both your flow meter and solenoid valve to the Notecarrier. If you’re using this project’s recommended hardware, here’s a wiring diagram that shows how all the components connect .

Wiring diagram of the various valve monitor components

Regardless of which hardware you use, you’ll need to have the following pins wired to your Notecarrier:

  • The solenoid valve’s signal line must be connected to the Notecarrier’s F_D10 pin. The Swan uses this pin to open and close the solenoid.
  • The flow meter’s signal line must be be connected to the Notecarrier’s F_D6 pin. The Swan uses this pin to read the flow rate from the flow meter.
  • The Notecarrier’s F_D13 pin must be wired to the Notecarrier’s ATTN pin. The Swan uses this to respond to interrupts whenever the Notecard receives a command to open or close the solenoid valve.

When everything is put together your build should look something like this.

The Notecarrier connected to the solenoid and the valve monitor

If you’re also using a case like the recommended one from Sixfab , your build can look like this when placed within the enclosure.

The full build within a Sixfab enclosure

With the hardware assembled, your next step is getting the project’s firmware running on your device.

Firmware

This project has firmware implemented with both Arduino and Zephyr. To get your firmware up and running on the Swan, you can follow the documentation for either implementation:

  • Arduino
  • Zephyr

Web Application

The Valve Monitor project’s web application allows you to view flow rates, open and close solenoid valves, set alarm thresholds, and manage environment variables in a browser.

The Valve Monitor project’s web application

As a final step, complete the web app’s setup guide to get the app running on your development machine.

On This Page

  • Notehub
    • Creating a New Project
    • Configuring Environment Variables
  • Hardware
  • Firmware
  • Web Application

Resources

  • GitHub
  • Hackster
  • Request More Info
© 2025 Blues Inc.
© 2025 Blues Inc.
TermsPrivacy
Notecard Disconnected
Having trouble connecting?

Try changing your USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

Advanced Usage

The help command gives more info.

Connect a Notecard
Use USB to connect and start issuing requests from the browser.
Try Notecard Simulator
Experiment with Notecard's latest firmware on a Simulator assigned to your free Notehub account.

Don't have an account? Sign up