A battery-powered occupancy sensor configured to be fed with a feed voltage (V battery) from a battery, the battery-powered occupancy sensor including: - a sensing probe configured to detect occupancy of a space monitored by the sensor and produce a corresponding sensing signal, - a comparator including a voltage divider (RA, RB, R1, R2, R3, RC) interposed between said feed voltage (V battery) and ground, wherein said voltage divider (RA, RB, R1, R2, R3, RC) is configured to define a comparison value (A, B), wherein said comparator is configured to compare said sensing signal against said comparison value (A, B) to detect said occupancy, and wherein said voltage divider (RA, RB, R1, R2, R3, RC) includes a plurality of resistors (RA, RB, R1, R2, R3, RC), said plurality of resistors including at least one switchable resistor (R1, R2, R3), each switchable resistor (R1, R2, R3) being coupled to an associated electronic switch (Q1, Q2, Q3), and - a controller configured to be selectively switched to an active state when comparison of said sensing signal against said comparison value (A, B) in said comparator indicates that occupancy is detected by said sensing probe, whereby changes in said feed voltage (V battery) induce a change in said comparison value (A, B), characterized in that said controller is configured to: - sense said feed voltage (V battery) applied to the sensor, - detect changes in said feed voltage (V battery), and - in response to said detected changes, selectively switch said at least one switchable resistor (R1, R2, R3) by said associated electronic switch (Q1, Q2, Q3) to keep said comparison value (A, B) substantially constant, thus countering changes induced in said comparison value (A, B) by changes in said feed voltage (V battery). - a sensing probe configured to detect occupancy of a space monitored by the sensor and produce a corresponding sensing signal, - a comparator including a voltage divider (RA, RB, R1, R2, R3, RC) interposed between said feed voltage (V battery) and ground, wherein said voltage divider (RA, RB, R1, R2, R3, RC) is configured to define a comparison value (A, B), wherein said comparator is configured to compare said sensing signal against said comparison value (A, B) to detect said occupancy, and wherein said voltage divider (RA, RB, R1, R2, R3, RC) includes a plurality of resistors (RA, RB, R1, R2, R3, RC), said plurality of resistors including at least one switchable resistor (R1, R2, R3), each switchable resistor (R1, R2, R3) being coupled to an associated electronic switch (Q1, Q2, Q3), and - a controller configured to be selectively switched to an active state when comparison of said sensing signal against said comparison value (A, B) in said comparator indicates that occupancy is detected by said sensing probe, - sense said feed voltage (V battery) applied to the sensor, - detect changes in said feed voltage (V battery), and - in response to said detected changes, selectively switch said at least one switchable resistor (R1, R2, R3) by said associated electronic switch (Q1, Q2, Q3) to keep said comparison value (A, B) substantially constant, thus countering changes induced in said comparison value (A, B) by changes in said feed voltage (V battery).