PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Sensors

Set the limit

MediumBudget $13Python · gpiozero

Two sensors: a DS18B20 on GPIO4 (4.7 kΩ pull-up, or the probe module), and a potentiometer across 3.3 V/GND with its wiper on channel 0 of an MCP3008 on the SPI pins (or the knob + ADC board). A red LED on GPIO17.

The knob sets the alarm limit: limit = 10 + 30 × reading °C (so 10 °C fully left, 40 °C fully right). Light the LED while the temperature is above the limit.

The test: knob at 50 % (limit 25 °C) and 22 °C; it warms to 27 °C at 3 s; the knob turns to 80 % (limit 34 °C) at 6 s; it warms to 36 °C at 9 s.

More in Sensors