警猫眼App下载:(大小超附件限制,只好给个下载链接)
点击打开链接
连接后摄像端手机的摄像头会被打开,你把它放置在你想监控的地方,只要有网络,无论距离有多远,你就可以在另外一台手机里看到实时画面,而且比QQ视频还要更流畅,此外它还提供包括动作监测、双向语音、以及24小时SD卡录像等其他功能。
摘录官方网页的介绍:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
“警猫眼”软件把闲置安卓手机变成智能网络摄像头,可通过WiFi/3G远程传输实时视频与音频至随身手机,好似千里眼、顺风耳。附加摄像头动作捕捉、入侵报警,以及24小时无间断录像。专为居家室内安全系统设计。
▶ 无需专业监控硬件,只要一台闲置安卓手机 + 免费的“警猫眼”软件!
▶ 可用随身手机和电脑远程观看,观看端有Android、iOS、PC电脑 三个版本!
▶ 无需路由器端口设置,P2P即插即用!
▶ 没有内网限制,只要上互联网就能远程监控!
▶ 支持H.263硬编码、H.264硬编码,最大程度利用你安卓手机的潜能!
▶ 摄像头图像移动侦测触发报警,声音侦测触发报警,手机被拿动触发报警!
▶ 不插手机卡时,可以电子邮件报警;插手机卡时,还可以短信、彩信、打电话报警!
++++++++++++++++++++++++++++++++++++++++++++
很明显,能看出来 “警猫眼”机底盒是 Arduino控制板为核心的,还有HC-06蓝牙模块,DHT11,MQ2,舵机,继电器,红外人体感应器,LED灯,等模块。。
“警猫眼”机底盒与上面的安卓手机 是通过蓝牙串口通信交互的。
Arduino程序分享出来,大家参考:
#include
#include
#define PIN_A_VOLTAGE 5
#define PIN_A_MQ2 4
#define PIN_D_SERVO 9
#define PIN_D_DHT 8
#define PIN_D_RELAY 4
#define PIN_D_RED 5
#define PIN_D_LED 2
#define PIN_D_LEDA 7
#define PIN_D_LEDB 12
//PT2272 Recv
#define PIN_D_2272VT 6
#define PIN_A_2272D0 0
#define PIN_A_2272D1 1
#define PIN_A_2272D2 2
#define PIN_A_2272D3 3
//PT2262 Send
#define PIN_D_315SEND 10
#define PIN_D_433SEND 10
#define ANALOG_HIGH_VALUE 560
Servo servo;
dht DHT;
int8_t relayVal;
double readNumber()
{
int8_t dotCount = 0;
int n = 0;
double p = 0.0f;
char ch;
while (1) {
if (Serial.available() > 0) {
ch = Serial.read();
if (ch == '\r')
{
continue;
}
else if (ch == '\n')
{
return (double)n + p;
}
else if (ch == '.')
{
if (dotCount == 0) dotCount = 1;
continue;
}
else {
if (dotCount == 0) {
n = n*10 + (ch - '0');
}
else {
double tmp = 1.0f;
int i = dotCount;
while (i > 0)
{
tmp *= 0.1f;
i -= 1;
}
p += ((double)(ch - '0'))*tmp;
dotCount += 1;
}
}
}//if
}//while
}
uint16_t readWord()
{
uint32_t ret = 0;
char ch;
while (1) {
if (Serial.available() > 0) {
ch = Serial.read();
if (ch == '\r')
{
continue;
}
else if (ch == '\n')
{
return (uint16_t)ret;
}
else if (ch == ',')
{
return (uint16_t)ret;
}
else {
if (ret <= 65535) {
ret = ret*10 + (ch - '0');
}
}
}//if
}//while
}
// Return value:
// -1: Error
// n: n > 0, number of bytes
int readWordArray(uint16_t buf[], int bufSize)
{
uint16_t len = readWord();
if (len > bufSize)
{
return -1;
}
int i;
for (i = 0; i < len; i++)
{
buf[i] = readWord();
}
return len;
}
///////////////////////////////////////////////////////////////////
uint8_t pt2262_pin;
uint16_t pt2262_count;
void pt2262_foura(void)
{
int i;
for (i = 0; i < pt2262_count; i++)
{delayMicroseconds(10);}
}
void ev1527_bit0(void)
{
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
pt2262_foura();
pt2262_foura();
}
void ev1527_bit1(void)
{
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
}
void pt2262_dama0(void)//BIT"0"
{
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
pt2262_foura();
pt2262_foura();
}
void pt2262_dama1(void)//BIT"1"
{
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
}
void pt2262_damaf(void)//BIT"f"
{
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
pt2262_foura();
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
pt2262_foura();
}
void pt2262_syn(void)
{
int i=31;
digitalWrite(pt2262_pin, HIGH);
pt2262_foura();
digitalWrite(pt2262_pin, LOW);
while(i--)
{
pt2262_foura();
}
}
void pt2262_send(uint16_t addr, uint8_t data)
{
uint16_t addr_bak = addr;
uint8_t data_bak = data;
uint8_t i;
uint8_t j;
uint8_t tmp;
for (i = 0; i < 5; i++)
{
addr = addr_bak;
data = data_bak;
pt2262_syn();
for (j = 0; j < 8; j++)
{//A0 -> A7
tmp = addr % 3;
if (0 == tmp) pt2262_dama0();
else if (1 == tmp) pt2262_dama1();
else pt2262_damaf();
addr = addr / 3;
}
for (j = 0; j < 4; j++)
{//D0 -> D3
tmp = data % 2;
if (0 == tmp) pt2262_dama0();
else if (1 == tmp) pt2262_dama1();
data = data / 2;
}
}
}
void ev1527_send(uint16_t addr, uint8_t data)
{
uint16_t addr_bak = addr;
uint8_t data_bak = data;
uint8_t i;
uint8_t j;
uint8_t tmp;
for (i = 0; i < 5; i++)
{
addr = addr_bak;
data = data_bak;
pt2262_syn();
for (j = 0; j < 8; j++)
{//A0 -> A7 (16bit)
tmp = addr % 3;
if (0 == tmp) pt2262_dama0();
else if (1 == tmp) pt2262_dama1();
else pt2262_damaf();
addr = addr / 3;
}
for (j = 0; j < 8; j++)
{//D0 -> D7 (8bit)
tmp = data % 2;
if (0 == tmp) ev1527_bit0();
else if (1 == tmp) ev1527_bit1();
data = data / 2;
}
}
}
////////////////////////////////////////////////////////////////////
int8_t vtState = 0;
void pt2272_func()
{
uint8_t val2272;
int val = digitalRead(PIN_D_2272VT);
if (vtState == 0 && val == 1)
{
val2272 = 0;
if ((analogRead(PIN_A_2272D0) > ANALOG_HIGH_VALUE ? HIGH : LOW) == HIGH)
{
val2272 |= 0x1;
}
if ((analogRead(PIN_A_2272D1) > ANALOG_HIGH_VALUE ? HIGH : LOW) == HIGH)
{
val2272 |= 0x2;
}
if ((analogRead(PIN_A_2272D2) > ANALOG_HIGH_VALUE ? HIGH : LOW) == HIGH)
{
val2272 |= 0x4;
}
if ((analogRead(PIN_A_2272D3) > ANALOG_HIGH_VALUE ? HIGH : LOW) == HIGH)
{
val2272 |= 0x8;
}
Serial.print("M");
Serial.println(val2272, DEC);
}
vtState = val;
}
//////////////////////////////////////////////////////////////////////////////////////
void setup()
{
pinMode(PIN_D_2272VT, INPUT);
//pinMode(PIN_D_2272D0, INPUT);
//pinMode(PIN_D_2272D1, INPUT);
//pinMode(PIN_D_2272D2, INPUT);
//pinMode(PIN_D_2272D3, INPUT);
pinMode(PIN_D_315SEND, OUTPUT);
pinMode(PIN_D_433SEND, OUTPUT);
digitalWrite(PIN_D_315SEND, LOW);
digitalWrite(PIN_D_433SEND, LOW);
pinMode(PIN_D_LED, OUTPUT);
pinMode(PIN_D_LEDA, OUTPUT);
pinMode(PIN_D_LEDB, OUTPUT);
pinMode(PIN_D_RELAY, OUTPUT);
pinMode(PIN_D_RED, INPUT);
digitalWrite(PIN_D_RELAY, HIGH);
relayVal = 0;
digitalWrite(PIN_D_LED, LOW);
digitalWrite(PIN_D_LEDA, LOW);
digitalWrite(PIN_D_LEDB, LOW);
servo.attach(PIN_D_SERVO);
servo.write(90);
Serial.begin(9600);
delay(500);
int n;
char ch;
int val;
double fVal;
int i;
for (i = 0; i < 1500; i++)
{
while (Serial.available() > 0)
{
ch = Serial.read();
if(ch == 'd')
{
n = readNumber();
//Serial.print("dn=");Serial.println(n, DEC);////Debug
servo.write(n);
}
else if(ch == 'j')
{
n = readNumber();
//Serial.print("jn=");Serial.println(n, DEC);////Debug
if (n == 1) {
digitalWrite(PIN_D_RELAY, LOW);
relayVal = 1;
}
else if (n == 0) {
digitalWrite(PIN_D_RELAY, HIGH);
relayVal = 0;
}
}
else if(ch == 'a')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LEDA, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LEDA, LOW);
}
}
else if(ch == 'b')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LEDB, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LEDB, LOW);
}
}
else if(ch == 'L')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LED, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LED, LOW);
}
}
else if(ch == 'm')
{
n = readWord();
if (n == 315)
{
pt2262_pin = PIN_D_315SEND;
}
else if (n == 433)
{
pt2262_pin = PIN_D_433SEND;
}
pt2262_count = readWord();
n = readWord();
if (n == 2262)
{
n = readWord();
pt2262_send(n, readWord());
}
else if (n == 1527)
{
n = readWord();
ev1527_send(n, readWord());
}
}
}//while
val = servo.read();
Serial.print("d");
Serial.println(val, DEC);
val = relayVal;
Serial.print("j");
Serial.println(val, DEC);
val = (digitalRead(PIN_D_RED) == HIGH ? 1 : 0);
Serial.print("h");
Serial.println(val, DEC);
pt2272_func();
delay(200);
}
}
#define VOLTAGE_ARRAY_SIZE 50
uint8_t voltageArray[VOLTAGE_ARRAY_SIZE];
uint32_t loop_count = 0;
void loop()
{
int n;
char ch;
while (Serial.available() > 0)
{
ch = Serial.read();
if(ch == 'd')
{
n = readNumber();
//Serial.print("dn=");Serial.println(n, DEC);////Debug
servo.write(n);
}
else if(ch == 'j')
{
n = readNumber();
//Serial.print("jn=");Serial.println(n, DEC);////Debug
if (n == 1) {
digitalWrite(PIN_D_RELAY, LOW);
relayVal = 1;
}
else if (n == 0) {
digitalWrite(PIN_D_RELAY, HIGH);
relayVal = 0;
}
}
else if(ch == 'a')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LEDA, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LEDA, LOW);
}
}
else if(ch == 'b')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LEDB, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LEDB, LOW);
}
}
else if(ch == 'L')
{
n = readNumber();
if (n == 1) {
digitalWrite(PIN_D_LED, HIGH);
}
else if (n == 0) {
digitalWrite(PIN_D_LED, LOW);
}
}
else if(ch == 'm')
{
n = readWord();
if (n == 315)
{
pt2262_pin = PIN_D_315SEND;
}
else if (n == 433)
{
pt2262_pin = PIN_D_433SEND;
}
pt2262_count = readWord();
n = readWord();
if (n == 2262)
{
n = readWord();
pt2262_send(n, readWord());
}
else if (n == 1527)
{
n = readWord();
ev1527_send(n, readWord());
}
}
}//while
int val;
double fVal;
if ((loop_count % 10) == 0)
{
val = analogRead(PIN_A_MQ2);
Serial.print("y");
Serial.println(val, DEC);
val = servo.read();
Serial.print("d");
Serial.println(val, DEC);
val = relayVal;
Serial.print("j");
Serial.println(val, DEC);
val = (digitalRead(PIN_D_RED) == HIGH ? 1 : 0);
Serial.print("h");
Serial.println(val, DEC);
if (0 == DHT.read11(PIN_D_DHT))
{
fVal = DHT.temperature;
Serial.print("w");
Serial.println(fVal, 3);
fVal = DHT.humidity;
Serial.print("s");
Serial.println(fVal, 3);
}
}
uint8_t index = loop_count % VOLTAGE_ARRAY_SIZE;
voltageArray[index] = (uint8_t)round((double)(analogRead(PIN_A_VOLTAGE) - 3)/4.0f);
if (index == (VOLTAGE_ARRAY_SIZE - 1))
{
uint8_t j;
uint16_t arraySum = 0;
for (j = 0; j < VOLTAGE_ARRAY_SIZE; j++)
{
arraySum += voltageArray[j];
}
fVal = (double)(arraySum * 4) / (double)VOLTAGE_ARRAY_SIZE;
fVal = fVal * 0.02444f;
Serial.print("U");
Serial.println(fVal, 3);
}
pt2272_func();
delay(100);
loop_count += 1;
}