USB Post Tag - TechOpt.io https://www.techopt.io/tag/usb Programming, servers, Linux, Windows, macOS & more Tue, 17 Jun 2025 02:37:27 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.3 https://www.techopt.io/wp-content/uploads/2024/07/cropped-logo-1-32x32.png USB Post Tag - TechOpt.io https://www.techopt.io/tag/usb 32 32 Reading my Water Meter in Home Assistant with USB SDR https://www.techopt.io/smart-home/reading-my-water-meter-in-home-assistant-with-usb-sdr https://www.techopt.io/smart-home/reading-my-water-meter-in-home-assistant-with-usb-sdr#respond Sat, 29 Mar 2025 22:25:29 +0000 https://www.techopt.io/?p=860 One of the most interesting things I’ve done recently is integrating my residential city water meter into Home Assistant using a USB Software Defined Radio (SDR). I’ve been exploring ways to import utility meter data, like gas, water, and electricity into Home Assistant, and I discovered many of these meters emit signals over radio frequency. […]

The post Reading my Water Meter in Home Assistant with USB SDR appeared first on TechOpt.

]]>
One of the most interesting things I’ve done recently is integrating my residential city water meter into Home Assistant using a USB Software Defined Radio (SDR). I’ve been exploring ways to import utility meter data, like gas, water, and electricity into Home Assistant, and I discovered many of these meters emit signals over radio frequency.

Using RTL-SDR and rtl_433 for Water Meter Home Assistant Integration

After reading success stories online, I picked up the Nooelec RTL-SDR v5 Bundle from Amazon. This little USB SDR dongle can tune from 100kHz to 1.75GHz, which is perfect for picking up utility meter signals.

My first attempt was to plug the SDR into my Raspberry Pi 4 running Home Assistant and use the rtl_433 addon. Unfortunately, I ran into some power issues and weird addon errors, likely due to the antenna drawing too much power with everything else I already had plugged in.

Setting Up a Dedicated SDR Host for Home Assistant

To fix this, I decided to run the SDR on a dedicated Raspberry Pi. I had an old, original Pi 1 Model B lying around. With a decent 2A power supply and a wireless N dongle for network connectivity, I installed Raspbian Lite and the rtl_433 tool.

I experimented with both 433 MHz and 915 MHz frequencies, using the coiled antennas included in the kit. The 900 MHz antenna ended up being the winner. On the 915 MHz band, I finally started seeing data in the logs:

An example of the data I was seeing in the rtl_433 logs

Identifying My Water Meter in Home Assistant Logs

One key data point stood out: a field called Consumption Data showing a value around 168000. After comparing this with the value on my actual Neptune T-10 water meter (used by the City of Ottawa), I realized I was picking up my own water meter’s signal!

I also saw signals from neighboring meters, but by monitoring the data for a few hours, I confirmed which one was mine. The value updated every 15 to 30 minutes.

Fixing USB Stability for Water Meter Data Collection

One hiccup: after several hours, rtl_433 would crash with libusb errors. Unplugging and replugging fixed it temporarily, but the long-term solution was to use a powered USB hub (4A supply) to give the SDR the juice it needed. I also ditched the USB extension cable from the kit and plugged the SDR directly into the hub. That seemed to fix the issue.

The nice thing with this hub is also that I can use it to power the Pi; so I have 1 power cable for the hub, with 1 USB cable running from the hub to the Pi. I have a microUSB cable going from the hub to the Pi for power, and I have the RTL-SDR and Wi-Fi dongle plugged into the USB hub. You can see the final setup up close in the picture below:

My final setup showing the USB hub, radio, Wi-Fi dongle and Pi all connected

Publishing Water Meter Data to Home Assistant via MQTT

With the setup stable, I configured rtl_433 to output data to MQTT. Since I already had the Mosquitto addon running in Home Assistant, I pointed rtl_433 to it and monitored the output using MQTT Explorer. I found the data for my meter which matched up to the logs I was seeing directly on the Pi:

Seeing water meter consumption data in mqtt home assistant

Creating a Systemd Service for Water Meter Integration

To make everything persistent, I created a systemd service at /etc/systemd/system/ha-sdr-915M.service:

[Unit]
Description=rtl_433 on 915M SDR
After=network.target

[Service]
ExecStart=/usr/local/bin/ha-sdr-915M.sh
Restart=unless-stopped
WorkingDirectory=/usr/local/bin

[Install]
WantedBy=multi-user.target

The script at /usr/local/bin/ha-sdr-915M.sh:

#!/bin/bash

source /etc/ha-sdr.env

LOGFILE="/var/log/ha-sdr/ha-sdr-915M.log"

/usr/bin/rtl_433 -f 915M -F mqtt://homeassistant.domain.com:1883,user=$MQTT_USER,pass=$MQTT_PASS -F kv 2>&1 | while IFS= read -r line
do
    echo "$(date '+%Y-%m-%d %H:%M:%S') $line"
done >> "$LOGFILE"

I enabled the service by running systemctl daemon-reload and systemctl enable ha-sdr-915M.service.

Adding a Water Meter MQTT Sensor in Home Assistant

In Home Assistant YAML configuration:

sensor:
  - name: "Water Meter Consumption Data"
    object_id: water_meter_consumption_data
    state_topic: "rtl_433/pisdrfrontoh/devices/ERT-SCM/33391039/consumption_data"
    unit_of_measurement: "gal"
    state_class: total_increasing
    device_class: water

I noticed the values from my meter were in gallons, even though I’m in Canada where cubic meters or litres are common. To convert to litres, I added a template sensor:

sensor:
  - name: "Water Meter Consumption (Litres)"
    state: >
      {{ states('sensor.water_meter_consumption_data') | float * 3.78541178 | round(2) }}
    unit_of_measurement: "L"
    device_class: water

Setting Up a Utility Meter for Daily Water Tracking

Finally, I created a utility meter entity to track daily water usage:

utility_meter:
  daily_water:
    source: sensor.water_meter_consumption_litres
    cycle: daily

This entity allowed me to graph and display daily water usage data directly from my water meter in Home Assistant:

Water meter home assistant usage graph in litres

Final Thoughts on Monitoring My Water Meter with Home Assistant

This project took a few days of tuning and monitoring, but I’m thrilled with the results. For now, I’m only picking up water meter data, but I’m hopeful I’ll find more signals soon.

If you’re thinking about tracking your water meter in Home Assistant, using an SDR like the Nooelec RTL-SDR v5 and rtl_433 software is a great DIY approach. The insight into water usage is already super useful!

The post Reading my Water Meter in Home Assistant with USB SDR appeared first on TechOpt.

]]>
https://www.techopt.io/smart-home/reading-my-water-meter-in-home-assistant-with-usb-sdr/feed 0
Boot any ISO From a USB Flash Drive https://www.techopt.io/hardware/boot-any-iso-from-a-usb-flash-drive https://www.techopt.io/hardware/boot-any-iso-from-a-usb-flash-drive#respond Tue, 06 Aug 2024 21:40:08 +0000 http://localhost:8080/?p=102 It used to be impossible to boot any ISO from a USB drive. You had to format the USB drive every time with your new ISO, and the process was long and painful. Recently, developers released an open-source tool called Ventoy that can boot any ISO from a USB drive, and it’s awesome! You simply […]

The post Boot any ISO From a USB Flash Drive appeared first on TechOpt.

]]>
It used to be impossible to boot any ISO from a USB drive. You had to format the USB drive every time with your new ISO, and the process was long and painful.

Recently, developers released an open-source tool called Ventoy that can boot any ISO from a USB drive, and it’s awesome! You simply install Ventoy on your USB drive, copy all your ISOs over, and choose from a list of ISOs to boot.

It works with Windows and Linux ISOs, and boots them on both UEFI and Legacy BIOS systems.

Boot any ISO from a USB Drive Steps

To get Ventoy installed and boot any ISO from USB, you can follow these steps.

1. Install Ventoy to USB Drive

1.1 The USB Drive

First, get a USB drive to hold your Ventoy install and your ISO images. I recommend no less than a 16 GB drive. Of course, the more storage you have, the more ISOs and other files you’ll be able to store on the drive.

You should also use a dedicated USB drive, since Ventoy will erase anything that’s already stored on it (although you can still use it for regular file storage again after Ventoy is installed).

1.2 Download Ventoy

Next, download the Ventoy installer. An installer exists for both Windows and Linux. Alternatively, you can download the live CD and use the Ventoy live environment to run the installer.

1.3 Install Ventoy

Insert the USB drive and run the Ventoy installer.

Select the USB drive from the dropdown menu and click Install.

Ventoy installer on linux

After a minute or so, you should get a message that the installation is complete!

Ventoy installer complete message

You should now have a bootable Ventoy USB. You can try to boot it, and you should see the Ventoy menu, but there are no ISOs to boot. Let’s fix that.

2. Copying ISOs to Ventoy USB Drive

You can copy your ISOs to the USB drive’s root, or you can put them in a folder. To demonstrate, I like to create a folder called ISOs at the root of the drive and put them in there.

3. Boot any ISO from Ventoy USB

Insert your Ventoy USB in the computer and go to your computer’s boot menu (normally F10, F11 or ESC to access it upon boot).

Select your USB drive from the menu to boot Ventoy.

You should see the Ventoy menu and the list of bootable ISOs.

Ventoy boot menu to boot any iso

Finally, to boot any ISO, use the arrow keys on your keyboard to highlight the ISO you want to boot and press Enter.

Whether booting a Linux or Windows ISO, you should see the system boot to the ISO with no problems!

windows installer booted with ventoy

Remarks

  • To boot the Ventoy USB on some UEFI systems, you may need to temporarily disable secure boot in your BIOS settings.
  • When you select an ISO to boot from Ventoy, you may get a secondary menu asking which mode to boot in. For example, for Windows ISOs, you will be asked if you want to boot in normal mode or wimboot mode. You should normally select normal mode, unless you are having trouble booting the ISO in normal mode, in which case you can try one of the other modes.

The post Boot any ISO From a USB Flash Drive appeared first on TechOpt.

]]>
https://www.techopt.io/hardware/boot-any-iso-from-a-usb-flash-drive/feed 0