找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 9384|回复: 8
打印 上一主题 下一主题
收起左侧

51单片机HC-SR501人体感应模块资料库与代码

  [复制链接]
跳转到指定楼层
楼主
人体红外感应实物图:



单片机源程序如下:

  1. /*********************************************************************************************
  2. The name of the program: <Pyroelectric sensor module>     
  3. Date:  2012 04 09
  4. hardware:mcu(stc12c5a60s2),Operational Amplifier(lm324),Pyroelectric sensor module,etc
  5.                                                                
  6. /*********************************************************************************************/

  7. #include<stc12c5a60s2.h>  
  8. #define uchar unsigned char
  9. #define uint unsigned int
  10. /*********************************************************************************************/
  11. void Delay_us(unsigned int x)
  12. {
  13.         while(x--);
  14. }
  15. /*********************************************************************************************/
  16. void delay(int x)
  17. {
  18.         uchar i,j;
  19.         for(i=0;i<x;i++)
  20.                 for(j=0;j<110;j++);
  21. }
  22. /*********************************************************************************************/
  23. void ADC_one()       //Only channel P1.0
  24. {
  25.         P1ASF=0x1f;   
  26.         ADC_CONTR=0x00;
  27.         AUXR1=0x00;               
  28.         ADC_CONTR=0x80;
  29.         Delay_us(2);
  30.         ADC_CONTR=0x88;     
  31.         Delay_us(2);
  32.         while(ADC_CONTR==0x88);
  33.         ADC_CONTR=0;     
  34. }
  35. /*********************************************************************************************/

  36. void main()
  37. {       
  38.         while(1)
  39.         {
  40.                 float num=0;
  41.                 uint resl=0;
  42.                 ADC_one();            
  43.                 resl=ADC_RES;
  44.                 resl=(resl<<2)+ADC_RESL;
  45.                 num=resl/1024.0*5;   
  46.                 num=num*1000;

  47.                 if(num>2700)
  48.                 {
  49.                         P2=0XEF;//Light-emitting diode is lit
  50.                 }
  51.                 else
  52.                         P2=0XFF;        //Light-emitting diode is extinguished
  53.         }       
  54. }
  55. /*********************************************************************************************/
复制代码

1 Piece HC-SR501 High Sensitivity Human Infrared Sensor Module Pyroelectric PCB
Article-Nr.:2802164
Product Details:
•  Human Infrared Sensor Module
•  Condition: New
•  :Product Feature:
Probe LHI778, high sensitivity
•  Technical parameters: 1.Operating voltage: DC5V to 20V
2.Static power consumption: 65 microamps
3.Level output: 3.3V, low 0V
4.Delay time: adjustable (0.3 seconds to 18 seconds)
5.Blockade Time: 0.2 seconds
6.Trigger Mode: L can not be repeated, H can be repeated default value H
7.Sensing range: less than 120 degree cone angle of less than 7 meters
8.Operating temperature: -15 to +70 degrees
9.PCB Dimensions: 32 * 24mm, screw hole distance 28mm, screw aperture 2mm sensor lens size: (diameter): 23mm (default)
•  Features: 1. automatic induction: when someone enters its sensing range input high, people leave the sensor range automatic delay off high. Output low

2. photosensitive control (optional): module is reserved for the location, you can set the photosensitive control, daytime or light sensing. The photosensitive Control optional features not installed at the factory photoresistor. If necessary, please purchase separately photoresistor install it yourself

3. two trigger modes: L can not be repeated, H can be repeated. Jumper selectable, default is H

A. not repeat the trigger mode: the sensor output high, the delay time has elapsed, the output automatically from high to low.
B. repeatable trigger mode: the sensor output high, the delay period, if human activities within its sensing range, the output will always remain high until people leave only delay the high level goes low (sensor module detected after every activity of the body's automatic postponed a delay period of time, and the last time activities as the starting point of the delay time)

4. induced blockade time (default setting: 0.2 seconds): sensing module in every sensor output (high to low) followed by set up a blockade of the time, in this period of time the sensor is not receiving any induction signal. This feature can be achieved both of the (inductive output time and the blocking time) interval can be applied to the interval detection products; This feature can effectively suppress the various interference generated in the process of load switching

5. wide operating voltage range: default Voltage DC5V to 20V

6. micro-power: quiescent current of 65 microamps, particularly suitable for battery- powered electrical products

7. output high signal: easy to achieve docking with the various types of circuits
•  Instructions for use:
1. Sensing module is powered initialization time of about one minute, during which the module will output 0-3 times the interval, one minute after entering standby
2. Should avoid lights and other sources of interference the a close direct module surface of the lens, in order to avoid the introduction of the interference signal malfunction; using the environment as much as possible to avoid the flow of the wind, the wind will cause interference sensor
3. Sensing module uses dual probe, the probe window is rectangular, dual (A $ B $) in the long direction at both ends, from left to right or from right to left when the body is walked by infrared spectroscopy reach the dual time, distance difference, the greater the difference, the more sensitive the induction, when the human body from the front to the probe or from top to bottom or from the bottom to the previous direction came dual detection distance of less than infrared spectroscopy, no difference value, the sensor should be installed up to the direction of the probe dual direction with human activities as parallel as possible to ensure that the human body has been passed by the probe dual induction sensor insensitive or does not work; Round lens in order to increase the sensing range of angles, the module also makes the probe surrounded induction, but the left and right sides still up and down both directions sensing range and sensitivity, still need to try to install the above requirements
•  Color: show as pictures
PLS NOTE that due to lighting effects, monitor's brightness / contrast settings etc, it could be some minor differences in the hue of the images and the actual item


所有资料51hei提供下载:
HC-SR501人体感应模块.rar (2.62 MB, 下载次数: 207)



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏2 分享淘帖 顶 踩1
回复

使用道具 举报

沙发
ID:256517 发表于 2019-3-13 19:39 | 只看该作者
很不错的资源
回复

使用道具 举报

板凳
ID:256517 发表于 2019-3-13 19:40 | 只看该作者
很不错的帖子,谢谢
回复

使用道具 举报

地板
ID:524170 发表于 2019-4-29 08:34 | 只看该作者
很不错的帖子,谢谢
回复

使用道具 举报

5#
ID:349854 发表于 2019-6-22 10:01 | 只看该作者
感謝po主,正好需要
回复

使用道具 举报

6#
ID:634955 发表于 2019-11-21 14:44 | 只看该作者
有没有at89x52的程序和仿真
回复

使用道具 举报

7#
ID:638921 发表于 2019-11-29 21:53 | 只看该作者
可以教教我51单片机与HC-SR501之间怎么连接吗
回复

使用道具 举报

8#
ID:356967 发表于 2022-9-20 11:26 | 只看该作者
这不某一个宝给的资料吗?我还以为是51的
回复

使用道具 举报

9#
ID:1064915 发表于 2023-9-27 09:34 | 只看该作者
       ADC_RES和ADC_RESL是用于保存A/D转换结果的寄存器,当AUXR1=0x00时,转换结果的高八位存于ADC_RES,低二位存于ADC_RESL;当AUXR1=0x04时,转换结果的高八位存ADC_RESL,低二位存于ADC_RES;
      取十位完整结果:
      
      其中Vcc为单片机的供电电压,Vin为输入电压;
     

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表