Solution architecture
Based on the feature list, we will have the following subsystems:
- Sensor subsystem: This contains sensors and provides sensor readings. We will use BME280 and TSL2561 hardware modules in this subsystem and will read from them in a software module.
- User interaction subsystem: This contains a rotary encoder to get input from the user and employs an OLED display to output readings. For sound warnings, this subsystem drives a buzzer.
- Power management subsystem: In this subsystem, we will have a PIR module to detect surrounding motion. If no motion is detected for a while, then it will put the device into light-sleep mode. The rotary encoder will also provide input to this subsystem since if the user is using the rotary encoder, the device should be in an active mode of operation.
The following diagram shows the execution of the overall solution:
After the hardware initialization...