USB Ambient light sensor on OpenWrt

Dear forum,

I would like to connect an ambient light sensor to the USB port of my OpenWrt-powered router. Unluckily, GPIO is not available, so I'm looking for some USB stuff.

Searching for "ambient" in the package repositories reveals that "kmod-iio-bh1750" and "kmod-iio-tsl4531" are available, both are i2c based.

So I think I need an USB-to-i2C adapter. I read this https://openwrt.org/docs/guide-user/hardware/usb.i2c-tiny-usb and I am willing to buy an i2c-tiny-usb adapter, but it looks as if you can't buy it, instead you need to to buy the parts, solder them and flash the firmware to it, which is more than I can handle.

I have no problems patching the kernel sources or creating customized OpenWrt builds.

Does anyone of you know of a USB ambient light sensor with OpenWrt support or an USB-i2c-adapter I could buy?

Thanks!
Sven

Why so much hassle, when all you need is a esp32 or Esp8266 device + ambiant light sensor.
Flash esp32 or esp8266 using esphome web tools.
lhttps://esphome.github.io/esp-web-tools/.

Add the relevant code https://esphome.io/components/sensor/bh1750.html

Enable web server. https://esphome.io/components/web_server.html

And off you go.
No soldering required.

You can even add display https://discord.com/channels/429907082951524364/951213660905287761/991026030011641856

https://discord.com/channels/429907082951524364/951213660905287761/992737324158947408.

It will only take 15mins max to setup. :stuck_out_tongue_winking_eye:

2 Likes

Many thanks for the hint, @KOA !

I could also use an old raspberry and connect the BH1750 to its' GPIO pins, but I'm trying to minimize the number of devices I need to take care of. I have a Netgear R7800 (just AP, no router) in the attic next to the window, providing wireless access to the garden. So I thought that I could extend this device to provide outside light intensity values so that my home assistant installation knows when to close the roller shutters and to switch on the outside lighting. Currently this is done depending on the sun's altidude, but that does not take into account cloudy weather. :slight_smile:

I have now ordered a digispark USB plug, a BH1750 and two 10k resistors and will try to get them soldered together (just 8 soldering points altogether). That should provide me with the hardware I was searching for. :slight_smile:

Thanks again!

An ESP8266 costs the same as digispark USB plug and can be used with multiple sensors. I had my running WLED https://github.com/srg74/WLED-wemos-shield/tree/master/resources/Firmware/WLED_wemos_shield/v0.14.0-b0 with a Dallas temp sensor + WS2811 30led strip + SH1106 display.

You could have used esphome instead, just like I am doing with ESP32 node, running BH1750 + Dallas sensor + OLED Sh106 display.