Wednesday, November 18, 2015

How to make Motion Sensor Using Arduino - Robomart

In this tutorial you set up a motion sensor to your Arduino and a motion is detected or when to turn off the LED will give a simple example. With its new speed sensor wire and how to program the Arduino ? Well look no further. The principle is used in many fields of automatic door open , such as smart homes .... Arduino, HTML and CSS tutorial , keep the following .
Step 1: REQUIRED ELECTRONICS
 The parts required for this basic complex are

Step 2: HOW TO BUILDING THE  ELECTRONICS
  • If possible Place your controller on a breadboard! we are using Arduino micro so it is very convenient to put on a breadboard if we are not using a micro then we will need jumper wires to connect your Arduino to a breadboard so we can plug our output devices and sensors in more easily.
  • After all you are located , you can go ahead with the motion sensor and the ground should be labeled the pin Arduino you are going to place a wire from the ground.
  • You are going to take a pin on your Arduino and you let me use your PIN number five pins on the Arduino to a blank " out " label to connect the speed sensor are pin out.
  • Then you come out with the Arduino that is positive five volts to the VCC output speed sensors are going to connect the VCC output .
  • Next on my breadboard, LED is the positive side the lead now or go ahead and place both you and your leadership led to it being a small scar on the side of the one are the same for your breadboard Arduino place on the ground downside downside plug in, you then empty on the ground on a pin for making motion sensor LED pen to the ground can use a jumper wire to the positive Arduino LED Run a wire from the side.
  • I used this for a pin number 7 . We now proceed to the wires and controller programming , go to the next step .
Step 3: HOW TO CODING
int motion = 5;
int motionLed = 7;
void setup() {//ok i need to state what each pin will be doing. the led pin will//be an output and the motion pin will be an input.
pinMode(motion, INPUT);
pinMode(motionLed, OUTPUT);}
void loop(){ //what will happen in the sketch //if motion is detected we want to turn the led light on //if no motion is detected turn the led off //you also need to declare a variable to hold the sensor data long sensor = digitalRead(motion); //then the if statement to control the led
if(sensor == HIGH){
digitalWrite (motionLed, HIGH); }
else {
digitalWrite (motionLed, LOW); }
}

No comments:

Post a Comment