HomeTurtlegraficsGPanelRobotics WebTigerPython
 Python - Online
alarmanlagen
Deutsch   English   

9. ALARM SYSTEMS

 

 

YOU LEARN HERE...

 

how you can use the micro:bit to monitor systems and trigger an alarm if necessary.

 

 

MONITOR THE WATER LEVEL

 

 

You rarely have to water your little plant, but you can't forget to do so. With your micro:bit, you can monitor the water level and trigger an alarm if it is too low.

You use the property of water to conduct electricity, so if you create a circuit from the 3V power supply to pin 0, which runs through the water, a higher voltage will be measured at pin 0 than when the circuit is open. You only need two cables with crocodile clips and two pieces of wire or other metal that you insert into the flower pot as probes.

Connect one cable to pin 0 and the other to 3V.

Das eine Kabel verbindest du mit Pin0, das andere mit 3V.

 

You can use any water container for the program development.

With the command pin0.read_analog()

you measure the voltage at P0 and write the value into the terminal window. As you can see, the difference in the measured values is large, depending on whether the probes are in the water or not.

 

Program:

from microbit import *

while True:
    v = pin0.read_analog()
    print(v)     
    sleep(500) 
► Copy to clipboard

Supplement your system with a visual alarm indicator on the LED display.

If you want to trigger an acoustic alarm, you can use a buzzer. However, you cannot control this directly with the micro:bit as it requires too much power. The easiest way is to build a small transistor amplifier. You can also use this to switch other devices on and off with the micro:bit, for example a relay or a switch on your model railroad.

 

 

REMEMBER YOU...

 

You can easily build simple alarm systems with the micro:bit as an embedded system if you combine your manual skills with some knowledge of electronics and programming.

 

 

TO SOLVE BY YOURSELF

 

 

1.

Set up an alarm system that monitors whether a door is opened. You can use a security wire, the acceleration sensor or the magnetic field sensor.