Difference between revisions of "Anti-Theft Alarm"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 1000px;" |- | ==Outline== 600px|center Make a simple anti-theft alarm system, controlling the system to start with a touch butto...")
 
Line 38: Line 38:
  
 
==Module Setup==
 
==Module Setup==
======
+
====Setup==
 
[[File:anywhere_steal-step.jpg|600px|center]]
 
[[File:anywhere_steal-step.jpg|600px|center]]
 
*Assemble the modules and sensors:  
 
*Assemble the modules and sensors:  
Line 49: Line 49:
 
==Programming==
 
==Programming==
 
===Required Program Blocks===
 
===Required Program Blocks===
*[[“ColorLED prepare” program block]]
+
*[["ColorLED prepare" program block]]
*[[“ColorLED control” program block]]
+
*[["ColorLED control" program block]]
*[[“Waiting” program block]]
+
*[["Waiting" program block]]
*[[“Touch button” program block ]]
+
*[["Touch button" program block ]]
*[[“Delay” program block]]
+
*[["Delay" program block]]
*[[“If-do” program block]]
+
*[["If-do" program block]]
*[[“If-else” program block]]
+
*[["If-else" program block]]
*[[“Declare as”, “item” program block]]
+
*[["Declare as", "item" program block]]
  
 
===Programming Thought===
 
===Programming Thought===
*Declare a variable “on” to store the state of the switch. You can set open an close two states of the switch with touch button 2.
+
*Declare a variable "on" to store the state of the switch. You can set open and close two states of the switch with touch button 2.
 
**on=0 represents open;
 
**on=0 represents open;
**on=1 represents close at night. If there is someone rushing into the museum, the value of on will change into 2;  
+
**on=1 represents closed at night. If there is someone rushing into the museum, the value of on will change into 2;  
 
**on=2 represents there is someone rushing into the museum, and it is on alarm state, the LED will flash red to alarm.  
 
**on=2 represents there is someone rushing into the museum, and it is on alarm state, the LED will flash red to alarm.  
 
[[File:mixly-ctrl-steal.jpg|600px|center]]
 
[[File:mixly-ctrl-steal.jpg|600px|center]]
Line 81: Line 81:
 
'''4. If on=1, closed at night, the color LED will change into red.'''
 
'''4. If on=1, closed at night, the color LED will change into red.'''
 
<br>
 
<br>
If on is 1(closed at night), judge whether the PIR sensor of pin 10 has detected the movement of people, it it has, set on to 2 (change from closed state to alarm state), otherwise the color LED will light red (it is safe currently, and keep alarm).
+
If on is 1(closed at night), judge whether the PIR sensor of pin 10 has detected the movement of people, if it has, set on to 2 (change from closed state to alarm state), otherwise the color LED will light red (it is safe currently, and keep alarm).
 
[[File:mixly-ctrl-steal-code3.jpg|600px|center]]
 
[[File:mixly-ctrl-steal-code3.jpg|600px|center]]
 
'''5. If on=2, someone has rushed into the house, flash and alarm and then close.'''
 
'''5. If on=2, someone has rushed into the house, flash and alarm and then close.'''
Line 96: Line 96:
 
<br>
 
<br>
 
<br>
 
<br>
Q: When it alarms, only the color LED flashes red, which is not obvious enough, an alarm bell is supposed to be added, which will better!
+
Q: When it alarms, only the color LED flashes red, which is not obvious enough, an alarm bell is supposed to be added, which will be better!
 
A: You just need to add a buzzer.  
 
A: You just need to add a buzzer.  
 
<br>
 
<br>
Line 103: Line 103:
 
**on=0, the color LED lights green, and it is on open state.  
 
**on=0, the color LED lights green, and it is on open state.  
 
**on=1, if the PIR sensor has detected the movement of people, on=2, and it will enter the alarm state.
 
**on=1, if the PIR sensor has detected the movement of people, on=2, and it will enter the alarm state.
**on=2, the color LED lights red, and the buzzer alarms.
+
**on=2, the color LED flashes red, and the buzzer alarms.
 
[[File:mixly-ctrl-steal-code5.jpg|600px|center]]
 
[[File:mixly-ctrl-steal-code5.jpg|600px|center]]
  

Revision as of 06:19, 19 October 2016

Outline

Anywhere steal.jpg

Make a simple anti-theft alarm system, controlling the system to start with a touch button.
Suitable kits: mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Passive Infrared Sensor 1 Detect the movement of human
Touch button 2 Detect the touch
ColorLED 1 Color LED

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Lego shell
  • Lego or other fixation structure
Anywhere steal-module.jpg

Module Setup

==Setup

Anywhere steal-step.jpg
  • Assemble the modules and sensors:
    • Stick the red core module, battery base and green extension module;
    • Connect the touch button to pin 2/3 of Hub;
    • Connect the color LED to pin 8/9 of Hub;
    • Connect the PIR sensor to pin 10/11 of Hub;
    • Plug one end of USB cable into the battery base, and connect the other to computer;

Programming

Required Program Blocks

Programming Thought

  • Declare a variable "on" to store the state of the switch. You can set open and close two states of the switch with touch button 2.
    • on=0 represents open;
    • on=1 represents closed at night. If there is someone rushing into the museum, the value of on will change into 2;
    • on=2 represents there is someone rushing into the museum, and it is on alarm state, the LED will flash red to alarm.
Mixly-ctrl-steal.jpg

Programming

1. Color LED prepares, and declare variables.
ColorLED prepare. Declare a variable named on to record the working mode.

Mixly-ctrl-steal-code.jpg

2. Press the touch button 2 to change the state of the switch.
If the power button is pressed, it will execute the internal program. If on is 1 (it is on the closed state at night), set on to 0 (open in the daytime). Otherwise (on open or alarm state), set on to 1 (close at night). Wait for the power button to be released.

Mixly-ctrl-steal-code1.jpg

3. If on=0, open in the daytime, and the color LED will change into green.
If on is equivalent to 0(open in the daytime), activate the color LED in green.

Mixly-ctrl-steal-code2.jpg

4. If on=1, closed at night, the color LED will change into red.
If on is 1(closed at night), judge whether the PIR sensor of pin 10 has detected the movement of people, if it has, set on to 2 (change from closed state to alarm state), otherwise the color LED will light red (it is safe currently, and keep alarm).

Mixly-ctrl-steal-code3.jpg

5. If on=2, someone has rushed into the house, flash and alarm and then close.
If on is equivalent to 2(alarm), set the color LED to red and flash (alarm).

Mixly-ctrl-steal-code4.jpg



Test the result
After upload, it is on open state by default, and the color LED will light green; press the touch button 2, switch it to closed state, and the color LED will light red. At this time, wave in front of the PIR sensor (it will detect the movement of people), and you will see the color LED flash red to alarm.

Anywhere steal.jpg



Q: When it alarms, only the color LED flashes red, which is not obvious enough, an alarm bell is supposed to be added, which will be better! A: You just need to add a buzzer.

  • When someone rushes into the museum, the alarm lamp will flash, and the alarm bell will alarm at the same time.
    • on=0, the color LED lights green, and it is on open state.
    • on=1, if the PIR sensor has detected the movement of people, on=2, and it will enter the alarm state.
    • on=2, the color LED flashes red, and the buzzer alarms.
Mixly-ctrl-steal-code5.jpg

Technical Specification

Related Cases

FAQ