SKU:SEN0158(https://www.dfrobot.com/product-1088.html)
(https://www.dfrobot.com/product-1088.html).

介绍
这款相机是一款小型定位红外相机,可同时追踪4个红外目标。其应用范围广泛,包括追踪带有红外发射器的导航机器人、光栅以及确定物体方向等。
此外,它还可以作为火焰传感器,跟踪热源和火焰位置。
该传感器安装和连接都很简便。您只需要四根线,两根用于供电,两根用于I2C通信。
规格
- 功耗要求:3.3V/44mA,5V/48mA
- 检测距离:0~3米
- 通信协议:12C
- 水平探测角度:33度
- 垂直检测角度:23度
- 分辨率为 128×96 像素,采用硬件图像处理,可跟踪四个物体(红外发射或反射物体)。
- 尺寸:32 x 16(圆柱形)
引脚排列
- 红色 – VCC+
- 黄色 – SDA
- 绿色 – SCL
- 黑色 – GND
连接图

Samp密码
操作说明
摄像头检测到信号后,会在第一个位置显示其坐标。其他位置将为空(返回 1023, 1023)。如果摄像头检测到多个物体,它会按照检测顺序排列这些物体。如果其中一个物体超出了检测顺序,则该物体将被移除。 view该位置将为空(返回 1023,1023)。它一次最多只能支持跟踪 4 个对象。
Arduino代码
// Wii遥控器红外传感器测试ampkako 的代码 http://www.kako.com
// RobotFreak 为 Wii-BlobTrack 程序修改的输出 http://www.letsmakerobots.com
// 已修改 https://dfrobot.com 作者:Lumi,2014年1月
#包括
int IRsensorAddress = 0xB0;
//int IRsensorAddress = 0x58;
int slaveAddress;
int ledPin = 13;
boolean ledState = false;
byte data_buf[16];
int i;
int Ix[4];
int Iy[4];
整数 s;
void Write_2bytes(byte dl, byte d2)
{
Wire.beginTransmission(slaveAddress);
Wire.write(dl); Wire.write(d2);
电线.结束传输();
}
无效设置()
{
slaveAddress = IRsensorAddress >> 1; // 这将导致 0x21 作为 p 的地址。
串行.开始(19200);
pinMode(ledPin, OUTPUT); // 将 LED 引脚设置为输出
电线.开始();
// 红外传感器初始化
Write_2bytes(0x30,0x01); delay(10);
Write_2bytes(0x30,0x08); delay(10);
Write_2bytes(0x06,0x90); delay(10);
Write_2bytes(0x08,0xC0); delay(10);
Write_2bytes(0x1A,0x40); delay(10);
Write_2bytes(0x33,0x33); delay(10);
延迟(100);
}
无效循环()
{
ledState = !ledState;
如果 (ledState) { digitalWrite(ledPin,HIGH); } 否则 { digitalWrite(ledPin,LOW); }
//红外传感器读数
Wire.beginTransmission(slaveAddress);
Wire.write(0x36);
电线.结束传输();
Wire.requestFrom(slaveAddress, 16); // 请求 2 字节的头部(最高有效位到最高有效位)
for (i=0;i<16;i++) { data_buf[i]=0; }
我=0;
while(Wire.available() && i < 16) {
data_buf[i] = Wire.read();
我++;
}
Ix[0] = data_buf[1];
Iy[0] = data_buf[2];
s = data_buf[3];
Ix[0] += (s & 0x30) «4;
Iy[0] += (s & 0xC0) «2;
Ix[1] = data_buf[4];
Iy[1] = data_buf[5];
s = data_buf[6];
Ix[1] += (s & 0x30) «4;
Iy[1] += (s & 0xC0) «2;
Ix[2] = data_buf[7];
Iy[2] = data_buf[8];
s = data_buf[9];
Ix[2] += (s & 0x30) «4;
Iy[2] += (s & 0xC0) «2;
Ix[3] = data_buf[10];
Iy[3] = data_buf[11];
s = data_buf[12];
Ix[3] += (s & 0x30) <<4;
Iy[3] += (s & 0xC0) «2;
for(i=0; i<4; i++)
{
如果 (Ix[i] < 1000)
Serial.print(“”);
如果 (Ix[i] < 100)
Serial.print(“”);
如果 (Ix[i] < 10)
Serial.print(“”);
Serial.print(int(Ix[i]));
Serial.print(“,”);
如果 (Iy[i] < 1000)
Serial.print(“”);
如果 (Iy[i] < 100)
Serial.print(“”);
如果 (Iy[i] < 10)
Serial.print(“”);
Serial.print(int(Iy[i]));
如果 (i<3)
Serial.print(“,”);
}
Serial.println(“”);
延迟(15);
}
处理代码
// 前任amp汤姆·伊戈
// 由 Lumi 于 2014 年 1 月修改,发布于 https://www.dfrobot.com
/*
这段代码应该为每个检测到的红外光源(最多四个)显示一个彩色斑点。
*/
导入处理.序列号。*;
int if = 10; // ASCII 换行符
String myString = null;
串口 myPort; // 串口
无效设置(){
// 列出所有可用的串口
println(Serial.list());
// 以所需的速率打开您正在使用的端口:
myPort = new Serial(this, Serial.list()[0], 19200);
myPort.clear();
// 丢弃第一次阅读,以防我们一开始就读错了。
// 在发送者的字符串中间。
myString = myPort.readStringUntil(lf);
myString = null;
大小(800,800);
//帧率(30);
}
void draw() {
背景(77);
//while (myPort.available() > 0) {
myString = myPort.readStringUntil(lf);
如果 (myString != null) {
int[] output = int (split(myString, ',I)),
println(myString); // 显示输入的字符串
int xx = output[0];
int yy = output[1];
int ww = output[2];
int zz = output[3];
int xxx = output[4];
int yyy = output[5];
int www = output[6];
int zzz = output[7];
ellipseMode(RADIUS); // 将 ellipseMode 设置为 RADIUS
fill(255, 0, 0); // 设置填充颜色为白色
ellipse(xx, yy, 20, 20);
ellipseMode(RADIUS); // 将 ellipseMode 设置为 RADIUS
fill(0, 255, 0); // 设置填充颜色为白色
ellipse(ww, zz, 20, 20);
ellipseMode(RADIUS); // 将 ellipseMode 设置为 RADIUS
fill(0, 0, 255); // 设置填充颜色为白色
ellipse(xxx, yyy, 20, 20);
ellipseMode(RADIUS); // 将 ellipseMode 设置为 RADIUS
fill(255); // 设置填充颜色为白色
ellipse(www, zzz, 20, 20);
}
}
常问问题
| 问答 | 一些常见的 Arduino 问题/常见问题解答/技巧 |
| Q | SEN0158零件的螺纹尺寸是多少? |
| A | 它是M18。 |
| Q | 说明书中提到水平检测角度为 33 度,垂直检测角度为 23 度。我该如何区分哪个是水平的,哪个是垂直的? |
| A | 请点击此处阅读更多内容:Wiimote/指向 > 查找感应条(http://wiibrew.org/wiki/Wiimote/Pointing). |
如有任何疑问、建议或奇思妙想,请访问 DFRobot 论坛。
(https://www.dfrobot.com/forum/).
更多文档
- SEN0158 尺寸图
(https://dfimg.dfrobot.com/5d303ff74db88f1df9d80a04/wiki/44cdc19545c0e4e6bbd98cecd7a1264d.zip) - SEN0158 三维模型
(https://dfimg.dfrobot.com/5d303ff74db88f1df9d80a04/wiki/a67e1109a29fe0f858c271300817c379.zip)
文件/资源
![]() |
DFRobot SEN0158 重力红外定位相机 [pdf] 用户手册 A700000013081448,SEN0158 Gravity 红外定位摄像机,SEN0158,Gravity 红外定位摄像机,红外定位摄像机,定位摄像机,摄像机 |
