Windows 7 BLE/RuuviTag Setup? (want to pass through to VM)

I wanted to modify RuuviCollector to include one or two more extended values (related to vapor pressure). I am not a Java programmer but I sure have modified existing Java code in the past, so I setup a Ubuntu VM on my Windows 7 host. Problem is, in order to pass through the USB Bluetooth (at least one RuuviTag out of my many) to my VM I first need to get to to connect to Windows 7. I am not familiar with this process, as I usually don’t use Bluetooth. Any pointers?

If this is a no go, I will use a real Ubuntu machine to run a test setup of RuuviCollector and Influx, and modify the code and rebuild the JAR there.

PS: I have more than a dozen RuuviTags monitored with my Pi Zero W using the RuuviCollector/Influx/Grafana setup but I can’t use that Pi for building obviously (could I?).

For purely development needs I recommend one of the approaches outlined in this question/issue so that you don’t need a VM at all; you can run hcidump remotely from your RPi Zero W (simultaneously with your “in-use” collector running there). An alternative, easier but less realistic option is to capture a short hcidump recording on the RPi into a text file and “playback” it on your development machine (also described in the question/issue).

If you go with the hcidump-over-ssh approach, do note that you don’t need to use the scan command on your “development instance”, as your “production instance” of the collector is already running it on the RPi (as long as the collector is running there of course). Basically: hcitool (the scan command) must be running exactly once on a device (trying to run multiple times simultaneously likely results in errors), while hcidump (the dump command) can be running any number of times on the same device; they will all receive identical feed of data as long as the scan is active.

If you specifically want to use a VM for development (don’t want to or can’t install development tools on your host), the above approaches can be used there too, or you can use a method called “USB Passthrough” which is supported by most VM hypervisors (you didn’t specify which one you are using, Hyper-V, VirtualBox, etc…) which will basically pass through the entire USB device to the VM, and then the VM will see it as a regular USB device as if it was attached to a physical machine. This way the host OS doesn’t even need to understand what the device is. Do note that the Bluetooth dongle you’re using must support Bluetooth Low Energy, some cheaper dongles only support Bluetooth Classic and thus can’t listen to RuuviTag broadcasts.

Out of curiosity, what extended values are you going to add?

1 Like

Thanks a lot, that’s very helpful. Especially the hcidump-over-ssh aproach.

My code is up and running.

I added Leaf Vapor Pressure Deficit (VPD) to RuuviCollector. It’s used for green houses.

Usually the leaf or canopy temperature is measured or estimated (ie. air temperature at canopy -1 or -2C), then the saturated vapor pressure of the air and the leaf is calculated to get the VPD.

I have (air) temperature -2°C hard coded at the moment, not sure where to set this but ruuvi-collector.properties seems a good place as this value usually doesn’t change often (it’s an estimate after all) - taking the real leaf temperature is usually not practical.

PS: I cloned from Github just yesterday, but the version says 0.2 while the release page says v0.2.4. I changed the version in pom.xml from “0.2” to “0.2vpd” on my local copy.

Did I add my code to the latest 0.2.4 or to the old 0.2?

About VPD:

Interesting. Surely learned something new today :stuck_out_tongue:

I don’t maintain the “patch version number” (as in major.minor.patch versioning scheme) in the pom.xml (0.2 does not necessarily mean 0.2.0). Since you very recently cloned the repository, you actually added your code on top of what’s going to be the 0.2.5 release, I just haven’t had time to make a full release out of it yet.

@alexhk I had the same need as you - growing some plants that require very proactive management of VPD in a semi-commercial setting. I was surprised that yours is the only other post I found on VPD, actually.

I didn’t want to manage my own fork of RuuviCollector, so I managed to get the VPD using InfluxQL and the “stock” values already available from the tag. Below is the relevant part of of the (very ugly) query in case you or anyone else wants to quickly get at Leaf VPD by implementing this straight into their RPi+Influx+Grafana stack. Like you, I hardcoded the temperature difference (-2) in the query (in two places where “temperature” is selected).

I validated the query using the Pulse sensor VPD guide - but if anyone catches mistakes in this mess let me know:

SELECT (610.78 * POW(2.71828, ((mean("temperature") - 2) / ((mean("temperature") - 2) + 238.3) * 17.2694))) - ((610.78 * POW(2.71828, ((mean("temperature")) / ((mean("temperature")) + 238.3) * 17.2694)) * mean("humidity") /100))
FROM "autogen"."ruuvi_measurements" WHERE $timeFilter GROUP BY time($__interval), "name" fill(null)