Do you like my hacking? If so, please consider leaving something in the
Fediverse (Mastodon etc): @Sprite_tm@social. spritesmods.com
Here's the electronics inside the terrorlevel-indicator:
The circuit is controlled by a microcontroller
(ATTiny2313), keeping the circuit very simple. The circuit requires a 12 V
supply, for which a standard mains adapter could be used. A 7805 provides
the 5 V for the logic.The microcontroller is the spider in the web of
this circuit. It uses three MOSFETs to turn the lights on and off.
The loudspeaker is connected directly to two pins of the uC without the
use of either an amplifier or D/A converter. An LDR is connected to the
analogue comparator input of the uC. A preset is used to set the
sensitivity. D1 shows whether the microcontroller thinks that the toilet
light is turned on or off, and is therefore useful when adjusting the
preset. You should be aware that the LED could have a delayed response of
up to four seconds, which should be kept in mind when you're adjusting the
preset.