The DFRobot SEN0644 is a fully waterproof (IP68) ambient light sensor that communicates with TapHome over RS485 using Modbus RTU. It measures illuminance from 0 to 200,000 lux with a resolution of 0.01 lux and an accuracy of ±5 %, runs on a wide DC 5–32 V supply and works at −40 to +80 °C, so it can be mounted outdoors, in greenhouses or in workshops.
The template provides one read-only Illuminance device in lux, polled every 15 seconds, with the sensor firmware version as a service attribute and service actions for the acquisition rate and calibration. Typical uses are dusk detection for outdoor lighting and daylight-driven shading or lighting control. The register map and protocol description come from the DFRobot SEN0644 wiki.
Hardware connection
Mounting

The sensor head is mounted with an M25×1.5 gland thread:
| Parameter | Value |
|---|---|
| Thread length | 10 mm |
| Opening size | 25 mm |
| Wrench size | 33 mm |
| Cable diameter | 4–10 mm |
| Cable length | 1 m |
| Protection | IP68 |
| Operating temperature | −40 to +80 °C |
Point the transparent window towards the light source that should be measured and keep it unobstructed. Remove the protective cover from the sensor before use. The sensor is a precision device — do not disassemble it.
Wiring
The sensor has a four-wire cable:
| Wire colour | Signal | Description |
|---|---|---|
| Red | VCC | Power supply positive, DC 5–32 V |
| Blue | GND | Power supply ground |
| Yellow | 485-A | RS485 data line A |
| Green | 485-B | RS485 data line B |
- Connect the yellow wire (485-A) to terminal A and the green wire (485-B) to terminal B of the RS485 bus on the TapHome Core (or of a Bus Extender port).
- Connect the red wire (VCC) and the blue wire (GND) to a DC power supply of 5–32 V. The sensor draws less than 10 mA.
- The cable supplied with the sensor is 1 m long. Extend it in a junction box with a twisted-pair cable.
- Terminate the bus at both ends of the line. The TapHome wiring guide uses a 100 Ω resistor between A and B; the Core has it built in on every bus, the Bus Extender on none of its ports (see Bus Extender — wiring and bus termination).
For outdoor mounting outside the lightning protection zone, or whenever the bus cable leaves the building, isolate the bus — use a galvanically isolated port of the Bus Extender (Bus 3 or Bus 4) or an RS485 optical isolator, and power the sensor from a separate power supply.
Configuration
Modbus communication
Modbus RTU is the only interface of the sensor and needs no enable step. The factory settings match the template:
| Parameter | Default | Permitted values |
|---|---|---|
| Slave address | 1 | 1–254 (255 is the general command address) |
| Baud rate | 9600 bps | 1200, 2400, 4800, 9600, 19200, 38400, 57600 |
| Data bits | 8 | 8 |
| Parity | None | None, odd, even |
| Stop bits | 1 | 1 |
The sensor reads registers with function code 0x03 and writes them with function code 0x06; in 16-bit values the high byte comes first.
In TapHome, add the template on a Modbus RTU bus set to 9600 bps, 8 data bits, no parity and 1 stop bit, and enter the sensor address in the Modbus Slave ID import parameter (default 1).
Changing the address or serial parameters
With more than one device on the bus, each one needs its own address. The address, baud rate and parity are holding registers 0x0064, 0x0065 and 0x0066 and are best set with a Modbus commissioning tool during the initial installation:
| Register | Content | Values |
|---|---|---|
| 0x0064 | Device address | 1–254 |
| 0x0065 | Baud rate | 0 = 1200, 1 = 2400, 2 = 4800, 3 = 9600, 4 = 19200, 5 = 38400, 6 = 57600 |
| 0x0066 | Parity | 0 = none, 1 = odd, 2 = even |
After changing the address or the baud rate, switch the sensor off and on again. If the current address is unknown, read registers 0x0064 and 0x0065 at the general command address 0xFF — the answer contains the real address and the baud rate.
The sensor also has a soft reset command (register 0x00E0) and a factory reset command (register 0x00F0, the manufacturer’s example writes 0 to it at address 0xFF). A factory reset can change the address and baud rate as well, so check them afterwards.
After changing the address, baud rate or parity, change the TapHome bus settings and the Modbus Slave ID import parameter to match — otherwise communication stops after the power cycle.
Device capabilities
Illuminance
Illuminance shows the measured ambient light level in lux. The value is a 32-bit unsigned integer in two consecutive holding registers — 0x0002 (high 16 bits) and 0x0003 (low 16 bits). The template reads both in one function-code 03 request (MODBUSR(H, 2, UInt32), high word first) and divides the raw value by 1000. TapHome polls it every 15 seconds; the device is read-only.
Typical values from the manufacturer:
| Situation | Illuminance |
|---|---|
| Night | 0.001–0.02 lx |
| Moonlit night | 0.02–0.3 lx |
| Cloudy, indoors | 5–50 lx |
| Reading a book | 50–60 lx |
| Cloudy, outdoors | 50–500 lx |
| Sunny, indoors | 100–1,000 lx |
The measuring range of the sensor ends at 200,000 lx.
Firmware version
The sensor firmware version is a read-only service attribute of the Illuminance device (register 0x0067).
Acquisition rate and calibration
The Illuminance device has three service actions:
- Set acquisition rate — writes the illumination acquisition rate (register 0x0046), level 1–20. Lower values increase the measurement frequency.
- Set calibration enable — switches the calibration function of the sensor on or off (register 0x0047: 1 = enabled, 0 = disabled).
- Set calibration compensation — writes the calibration compensation value (register 0x0048). The value is entered enlarged 100 times: a compensation of 1.4 is written as 140. The manufacturer calculates it as (collected illuminance ÷ actual ambient illuminance) × 100 — for example a collected value of 221 lx at an actual 260 lx gives (221 ÷ 260) × 100 = 85.
Troubleshooting
No reading in TapHome
- Check the A/B wiring: yellow is A, green is B. Swapped A and B lines are a common installation error on RS485 buses.
- Check that the bus is not disconnected and that the supply voltage is within DC 5–32 V.
- Check that the Modbus Slave ID import parameter matches the sensor address (default 1) and that the bus runs at the sensor’s serial settings (default 9600 8N1).
Reading is zero or implausibly low
- Check that there is a light source and that the protective cover of the sensor has been removed.
- Check that the transparent window faces the light and is not obstructed or covered.
Communication lost after a power cycle
If the address or baud rate was changed in registers 0x0064–0x0066, the sensor starts with the new values after the power cycle. Set the TapHome bus and the Modbus Slave ID to match. If the address is unknown, query it at the general command address 0xFF (register 0x0064) with a Modbus commissioning tool.
