USB thermometer/humidity sensor for OpenWrt [Solved]

Dear all,

I would like to monitor temperature and possibly humidity in my summer house, ideally using OpenWRT rdd graphs and sensors (luci-app-statistics). This will allow me to collect data remotely and send an alarm using SMS if temperature is low or humidity is too high.

So I am looking for a simple, cheap and reliable USB thermometer and humidify sensor supported in OpenWRT. If it has a short USB cable and/or a sensor cable, it is better to avoid interaction with the router.

There are also very inexpensive wireless devices, like Zigbee temperature/humidity sensors. But batteries and monitoring are needed, so they would not my first choice and this would require Zigbee communication in OpenWRT. Plus it may require a home installation package.

Feel free to propose anything and discuss the best solution.

Kind regards,

Hey ffries,

if you're familiar with I²C and C coding, then i've a cheap solution for you.
I²C temp. and hum. sensor connected to STM32 bluepill Board flashed with "USB to I²C Converter" firmware. Then you can simply read out the values by a piece of C code and send them by MQTT (or something else) to your home control.

regards

1 Like

Another alternative are the really cheap non-standard wireless sensors using some ISM band or another allowed band for short range devices, coupled with a generic USB-connected receiver. There are nice software defined radio solutions based on the RTL2832U DVB chips, and this is also packaged for OpenWrt: https://openwrt.org/packages/pkgdata/rtl_433

I am using a stick like this as a receiver (on a Debian PC, but it should work with a powerful enough OpenWrt router too) : https://www.ebay.com/p/11021080395

and a couple of "Digoo DG-R8H Outdoor Sensors". Sorry, the exact eBay item seems to have gone since I bought them in 2017. These are powered by two AAA batteries, which lasts a very long time. I am guessing 6-12 months. Haven't really counted. The sensors will transmit temperature+humidity measurements approximately once a minute.

The JSON dump from rtl_433 for one of these sensors looks like this:

{
   "humidity" : 29,
   "id" : 28,
   "temperature_C" : 31.8,
   "battery" : "LOW",
   "time" : "2020-08-19 12:42:24",
   "model" : "Nexus Temperature/Humidity",
   "channel" : 3
}

As you can see: the temperature in this room is really high now, and it is about time I changed batteries. The sensors usually work for weeks or months after the status changes to "LOW", but the measurement frequency decreases, And the selected channel tends to drift. There are no high quality crystals here :slight_smile:

BTW, wrt the channel: These sensors have a swicth to select one out of three "channels". Useful as a way to separate different sensors from each other. But as you can see they also have an "id", which can be used for the same purpose. I believe this is randomly generated on power-on, so it is stable at least until you cahnge batteries.

I also have a slightly different sensor, without the humidity sensor and the channel switch. This was bought as part of an indoor/outdoor thermometer with a wireless outdoor sensor. It shows up as

{
   "id" : 182,
   "battery" : "OK",
   "time" : "2020-08-19 12:50:30",
   "model" : "Nexus Temperature",
   "channel" : 1,
   "temperature_C" : 22
}

The beauty is that the indoor display unit and the rtl_433 receiver obviously both can receive these sensor data simultaneaously. They just listen for sensors transmitting. I assume the display is locked to that specific sensor ID. It appears to be fixed to 182.

Thanks. Digital receiver stick costs 15€ and temperature sensors 10€. Could be a workable solution. I am quite reluctant to use batteries, since they all finish in trash, rechargeable or not. What I like in OpenWRT is that I can use my devices a long time before they go to recycling.

Furthermore, how do you collect and store the data and actually use your snippet?

I found the MagiDeal USB Thermometer on Amazon. Users report that it works under Linux. Accuracy is 3°C, which is not accurate. Thermometer needs to be calibrated, which I am not able to do.

I also found a couple of Zigbee device collecting Temperature and Humidity.

There are also a lot of meteo stations, sometimes very cheap, some of them might send temperature and humidity via USB.

Still waiting and searching for the killer product with direct integration into OpenWRT.

Thanks. Yes, there are USB i2c sticks compatible with OpenWRT. Then I only need a temperature and humidity module (for Arduino for example), soldering and USB power. But there are no casing and you need some programming. So it is not for me.

I can understand that. For me, wireless was pretty much a requirement since I needed to measure the temp and humidity in several rooms where a Linux device or USB cabling was unwanted (bathroom etc).

zigbee devices might be a good alternative. I didn't research that. Went for a solution simple enough that I could understand it, which limits the range a lot :slight_smile:

I do also have a TEMPerHUM, which I didn't want to mention because I'm not too satisfied with it. It sort of works, but it is expensive, imprecise, and quite limited by the practical length of a USB cable. I am using temperd (https://github.com/edorfaus/TEMPered ) to read it. Don't know if that is packaged for OpenWrt?

I wrapped the rtl_433 process in a hackish perl script which just reposts the JSON to an MQTT topic. Then I pick up the values there, using telegraf and feed them to an influxdb, with grafana as frontend. Or at least in theory :slight_smile: Still work in progress to create a nice dashboard etc. The same perl wrapper also provides simple data output for an old cacti instance which is graphing the data the Good Old Way(tm)

One advantage with the intermediate MQTT solution is that it is easy to distribute the same reading to multiple readers, like a temperature gauge on a web page etc.

1 Like

Found OpenWRT temper USB package:
https://openwrt.org/packages/pkgdata/temperusb

Github repository:

Can be used with the Temper USB stick sold on Amazon. Again, users indicate a 3°C accuracy.
I found this thead in the old archived forum:
https://forum.archive.openwrt.org/viewtopic.php?id=54345

OK, temper might be a suitable solution.

Can I easilly use luci-app-statistics to read the return of the command:
temperusb

In OpenWRT: opkg list | grep collectd-mod
https://collectd.org/wiki/index.php/Table_of_Plugins

I don't see any plugin to read a command output.

Otherwize onewire is very well supported by collectd:
https://collectd.org/wiki/index.php/Plugin:OneWire
But it is not included in OpenWRT.

I am still waiting before buying any hardware, integration in collectd is necessary.

I am back to 1wire as it is better supported as a standard and less expensive.

I bought a 5 pack precalibrated temperature + humidity sensors sold for 12€.
DHT11 basic temperature-humidity sensor

There is no 1-wire collectd package in OpenWRT.

How to install:
https://collectd.org/wiki/index.php/Plugin:OneWire

OneWire relies on owfs which is already part of OpenWRT.

Update : I wrote a request to package collectd 1wire package.

DHT11 is not 1-wire device supported by w1* package(s) and owfs.

Slightly offtopic: Anyone using / heard / tried Amazon Echo plus 2. generation with Zigbee Hub and internal temperature sensor?

I wanted to, but the temperature was off about 4-5 °C max. while it was really hot inside my appartement (>30°C). I recalibrated several times but with only marginal improvement.

The hub was refurbished and really cheap about 55€ incl. P&P, I plainly sent it back and didn't reorder because I lost some trust in the product. On the other hand I didn't find similiar reports on the web.

Thanks. I just canceled the order. What 1wire product is supported by W1* packages and owfs?

https://owfs.org/index_php_page_standard-devices.html

1 Like

Nice list but pardon my ignorance, I cannot choose the right product. Would you recommend one of those devices? A product with small casing would be nice.

ds18b20 - classic 1-wire temperature sensor
I'm not aware of any 1-wire humidity sensor available.

Thanks. The ds18b20 that I found on Amazon need to be connecter using a small electronic scheme, with a resistance of 4,7K. So I need a small breadboard.

Can I find a product that I simply connect to the 1wire without soldering ?

Edit : Sorry, I found the right product.
DS18B20 Temperature Sensor Module for Arduino and Raspberry Pi
The DS18B20 is soldered on a small board with proper wiring.

By the way, which USB to 1wire adapter would you recommend for OpenWRT?
I have a couple of Rasberry pie but I would prefer a USB converter.

This kind of product seems very nice, as it includes a serial converter and thermometer:

It is announced as supported by owfs on the product page.
Seems like the perfect choice for my need. What do you think?

I am waiting for confirmation before I order.

The simplest option is to use any available GPIO port your router may have.
The adapter you found looks good.

Many thanks for your advice.

The GliNet-N1300 that I am using is tiny and I don't want to damage it looking for a GPIO ports. My Raspberry Pie 2/3 have a GPIO ports, but I don't plan to set up a Raspberry for 1-wire.

So I will probably go for the solution of the USB adapter.

Later, I might use a home automation distribution with Raspberry Pie, but not presently.

Finally, I may use a Raspberry Pie, in which case I only need a:
DS18B20 Temperature Sensor Module for Arduino and Raspberry Pi