Skip to content

Support for BH1750FVI sensor on Armbian / Orange Pi Zero 3 (non-RPi SBC) #8

Description

@twometre

Summary

Successfully running lunarsensor on an Orange Pi Zero 3 (Allwinner H618) with a BH1750FVI sensor on Armbian Bookworm Minimal. Sharing setup notes in case it helps other non-Raspberry Pi users.

Hardware

Component Detail
SBC Orange Pi Zero 3 (1GB, Allwinner H618)
Sensor BH1750FVI (I2C, ADDR→GND = 0x23)
OS Armbian Bookworm Minimal (kernel 6.12.58-current-sunxi64)
I2C Bus /dev/i2c-2 (mapped from i2c3-ph overlay)

Wiring

BH1750FVI → Orange Pi Zero 3 (26-pin header)
VCC  → Pin 1  (3.3V)  ← Pin 1 is on the debug header side, NOT the USB side
SDA  → Pin 3  (PH5 / I2C3)
SCL  → Pin 5  (PH4 / I2C3)
GND  → Pin 6
ADDR → Pin 9  (GND) → address 0x23

Key differences from Raspberry Pi setup

1. I2C overlay must be loaded via configfs

armbianEnv.txt with overlays=i2c3-ph does not reliably load on boot. Workaround — create a systemd service:

[Unit]
Description=Load I2C3-PH overlay via configfs
After=local-fs.target sys-kernel-config.mount
Before=sysinit.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'mkdir -p /sys/kernel/config/device-tree/overlays/i2c3-ph && cp /boot/dtb/allwinner/overlay/sun50i-h616-i2c3-ph.dtbo /sys/kernel/config/device-tree/overlays/i2c3-ph/dtbo'

[Install]
WantedBy=multi-user.target

2. Port must be 80

lunarsensor hardcodes port 80 for sensor discovery regardless of LunarSensorPort defaults key. The log confirms:

Starting sensor check for lunarsensor.local:80/ambient_light

Solution: run FastAPI on 8772 and proxy via nginx on port 80.

3. lunarsensor.local hostname resolution

On networks with MDM-managed DNS or split-tunnel VPN, .local mDNS does not resolve. Workaround — add to /etc/hosts on the Mac:

10.10.50.43 lunarsensor.local

4. User must be in i2c group

sudo usermod -aG i2c $USER

Otherwise the FastAPI process returns -1.0 lx silently.

Feature request

Would it be possible to make the sensor discovery port configurable, or document that port 80 is required? The LunarSensorPort defaults key appears to have no effect currently.

Result

Sensor Mode working with real-time lux updates on Lunar. Tested with two external monitors (LG UltraGear + Philips 345E2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions