PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Sensors

Baby monitor

MediumBudget $7Python · gpiozero

A sound sensor (powered from 3.3 V) with its DO on GPIO27: high while it is loud. An LED on GPIO17.

Light the LED as soon as the baby makes a sound, and keep it lit until there have been 3 s of quiet since the last sound. A new sound while the LED is on restarts the 3 s.

The test makes short noises at 1 s, 6 s and 7.5 s. So the LED is lit from 1 s to about 4 s, and from 6 s to about 10.5 s. Check DO at least every 0.05 s.

More in Sensors