Sensors

Sensors turn something physical — light, temperature — into a resistance you can read. de:volt ships two resistive sensors: the LDR / photoresistor and the NTC thermistor. Neither produces a voltage on its own; you pair each with a fixed resistor to make a divider, and read the midpoint on an analog input.

LDR / Photoresistor

A light-dependent resistor. In the dark it presents a high resistance; under light its resistance falls sharply. The part is non-polar — pins a and b are interchangeable.

Pinout

PinLabelFunction
aATerminal (non-polar)
bBTerminal (non-polar)

Specs

PropertyValue
Dark resistance (rDark)1 MΩ
Bright resistance (rLight)500 Ω (~1 kΩ illuminated)

rDark and rLight set the two ends of the range and are editable in the Inspector. The part interpolates between them with the light level you set, so a darkroom reads near rDark and full illumination near rLight.

Reading it

An LDR alone gives you a resistance, not a voltage — pair it with a fixed resistor as a divider and read the junction:

+5V ──── [LDR] ──┬── A0  (rises in the dark, falls in light)

              [10kΩ]

                GND

With the LDR on top, the A0 voltage rises as it gets darker (the LDR’s resistance grows, so it holds more of the rail). Swap the LDR and the fixed resistor to invert that. Choose the fixed resistor near the LDR’s resistance at the light level you care about — 10 kΩ is a sensible start — so the midpoint swings across a useful range rather than pinning at a rail.

NTC Thermistor

A Negative Temperature Coefficient thermistor: resistance falls as temperature rises. Non-polar.

Pinout

PinLabelFunction
aATerminal (non-polar)
bBTerminal (non-polar)

Specs

PropertyValue
Nominal resistance (rNominal)10 kΩ (at 25°C)
B-parameter (beta)3950 K

rNominal is the resistance at 25°C and beta is the B-parameter that sets how steeply resistance changes with temperature — both editable in the Inspector. A 10 kΩ / 3950 K part is the common default.

Reading it

Same pattern as the LDR — one arm of a divider, midpoint to an analog input:

+5V ──── [10kΩ] ──┬── A0  (rises as it gets hotter)

              [NTC]

                 GND

With the NTC on the bottom, its resistance drops as things heat up, so it holds less of the rail and the A0 voltage rises with temperature. Put the NTC on top to invert. Pick the fixed resistor equal to rNominal (10 kΩ) so the divider is most sensitive around room temperature — the point where the curve is steepest and your readings have the most resolution.

Calibrating in firmware

Because both parts are non-linear, the divider voltage isn’t proportional to light or temperature — it follows the sensor’s resistance curve. Convert the analog reading back to a resistance first (from the known divider), then apply the device curve (beta for the NTC) in your code to get an engineering value. The divider just gets the physical quantity into a voltage the input can read.