Smart Inductive Door 1

From Microduino Wiki
Jump to: navigation, search

Overview

Anywhere line door.jpg

Make a smart inductive door of which the servo will control to open the door when one of the Line Finders detected that someone is approaching.
Suitable kit: mCookie302


Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Servo 1 Servo
Servo Connector 1 Servo Connector
Line Finder 2 Detect objects

Other Equipment

  • USB cable*1
  • Sensor cable*3
  • Sensor shell
  • Building blocks or other fixation structures
Anywhere don't touch me-module.jpg

Module Setup

Setup

Anywhere don't touch me-step.jpg
  • Assemble modules and sensors together:
    • Stick the red core module, battery base and green hub together;
    • Connect the servo connector to pin 6/7 of Hub;
    • Connect the servo to pin 1 (the lower three pins) of servo connector;
    • Connect the Line Finder to pin A0/A1 and A2/A3 of Hub;
    • Plug one end of the USB cable into the battery base and connect the other to the computer.

Programming

Required Program Blocks


Programming Thought

The distances on the both sides of the door are detected, when the distance of A or B is less than790 (someone is approaching any side), the door will open automatically, and delay 2s for pedestrians to pass by. If the distances of A and B are larger than 800 (there is no one on each side of the door), the door will close.

Mixly-ctrl-line door.jpg

Start to Program

1. Read and store the distances of the two Line Finders
Variable A is for storing the value of one Line Finder, and variable B is for storing the value of the other. Store the value of A2 Line Finder in variable A, and store the value of A0 Line Finder in variable B.

Mixly-ctrl-line door-code.jpg

2. Judge someone is approaching on any side
Distance of A or B is less than 790 (someone is approaching to each side), the servo will rotate to 10 degrees, at the speed of 50 degrees/s (open the door slowly).Delay 2s for pedestrians to pass by.

Mixly-ctrl-line door-code1.jpg

3. Judge that there is no one on both sides and then close the door Distances of A and B are larger than 800 (there is no one on both side). The servo will rotate to 170 degrees at the speed of 50 degrees/s (close the door slowly).

Mixly-ctrl-line door-code2.jpg



Test the result
When there is no one approaching the door, the servo is at closing door state; when someone is approaching the door, the servo will open the door.
Install the two Line Finders on the two sides of the door, and set up the shape of the door with building blocks. Fix the iron wire on the arm of the servo. When the arm rotates to 170 degrees, the door is closed. When the arm rotates to 10 degrees, the door is open.

Anywhere line door.jpg



Q:If someone is just standing inside the threshold, the sensor is unable to detect him, then thedoor will be closed, can a closing door alarming be added to the door?
A:Of course it can. Just use a buzzer or a LED to alarm

Declaration and assignment. When someone is approaching, the servo controls to open the door
ColorLED prepare Variable door is for storing the open and closed state of the door. Assign 1 to door (the door is open)

Mixly-ctrl-don't touch me-code3.jpg

There is no one on both sides, the door will be closed and the indicator light will light up
If door is 1 (the door is open), the internal program will be executed Assign 0 to door (the door is closed) Red LED flashes 3 times (alarming before closing the door)

Mixly-ctrl-don't touch me-code4.jpg

Technical Specification

Relative Cases

FAQ