Start here, Make a project!
This blog shares various useful Projects made by Kuman and Kuman's specially invite writers. If you like, welcome to contribute to us, and get paid.
By Kumantech | 15 June 2017 | 1311 Comments

Human body detection sensor based on Arduino

This detecter is based on Arduino human body induction experiment, the sensor detects human's body approaching, when the man reaches its induction range, it will trigger the alarm buzzer to make a sound.

Make the project, you will need the items below:
1. Kuamn Arduino Uno board*1
2. Kuman Buzzer*1
3. Kuman Human body detection sensor*1
4. Dupont cables

How to wire?
Buzzer:

Negative electrode(-)---------- GND
positive electrode(+)----------- VCC(5V、Connection development board Digital pin 8)

Human body detection sensor:

GND --------------------   GND
VCC --------------------    5V
OUT -------------------  Connection development board Digital pin 2

General View:


Code:
int ledPin = 13;
int fengming = 8;
int sensor = 2;
int val = 0;
int i=0;
void delay1ms(void)   //devintion -0.25us
{
    unsigned char a,b;
    for(b=190;b>0;b--)
        for(a=2;a>0;a--);
}
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // set as output number pin
pinMode(sensor, INPUT); // set as input number pin
pinMode(fengming, OUTPUT); // set as output number pin
}
void loop()
{
for(i = 0; i <= 100; i++)
  {
    if(i==100)
             {
         i=0;
         }
    else
           { val = digitalRead(sensor); // read input pin
        if(HIGH == val)
                 {
               digitalWrite(ledPin,HIGH); // set LED high level
               digitalWrite(fengming,HIGH); // set buzzer as high level
                   delay1ms();
                }
         else
                 {
               digitalWrite(ledPin,LOW); // set LED high level
               digitalWrite(fengming,LOW); // set buzzer as high level
                delay1ms();
                 }
 
             }
  }
}

 

Recently Reviews

Read More

Leave a Reply

Your email address will not be published.Required fields are marked. *
Name
E-mail
Content
Verification code
POPULAR BLOG