Last weekend, we finally decided it was time to get a Roomba robotic vacuum.  This decision was made easier by the relatively good price and availability of the iRoomba 585 at Sam’s Club.  While this isn’t a product review, I’ll take a moment to say that so far the results are excellent.

Included with the unit was one “virtual wall“, a little black box that shoots out an infrared beam, creating an invisible line you don’t want the robot to cross.  This allows you to keep it from going somewhere you don’t want it to go without physically placing some obstruction in its path.  The virtual wall works great, but one just isn’t enough in our case.  Luckily, it took just a bit of Googling before I was ready to build my own.

Circuit

It turns out that the virtual wall isn’t too complex.  Basically, it sends out a repeating pattern of ON/OFF infrared signals, each one a millisecond long.  These signals ride on a 38kHz carrier frequency, just like most infrared remote controls, meaning that an ON signal is actually being pulsed ON/OFF about 38,000 times per second.  I won’t go into more detail here, especially because it’s beyond the scope of my expertise, but please see the references for more information on carrier frequencies.

Only a few parts were required to start building my own virtual wall, all of which I was lucky enough to have on-hand.  Here I’ll put out my standard disclaimer that my electronics knowledge is pretty limited, and anything that I cobble together runs mostly on dreams and good intentions.  I did my best to throw some math into this circuit, but I’m always open to helpful hints as to how to improve things.

I used a PIC12F683 microcontroller because I have a bunch of them.  They’re inexpensive and pretty robust, so I bought a pack of ten a while back on eBay.  In this simple circuit, I use the PIC’s pulse-width modulation (PWM) capabilities to generate the 38kHz carrier frequency.  The PWM pulses are output through the GP2 pin, which turns on the transistor, letting current flow through the infrared LED, thus generating the required signals.

Components

  • PIC12F683 Microcontroller
  • R1 – 330 ohm 1/4-watt
  • R2 – 12 ohm, 1/4-watt
  • Q1 – 2N3904 (Datasheet)
  • L1 – Infrared LED (Datasheet)

Source Code

The source code is written for the HI-TECH C compiler, which is included in the older version of the MPLAB IDE I’m still using.  I first tested sending a steady stream ON/OFF pulses, which had the desired effect of making the robot stop and turn.  In an attempt to extend battery life, however, I’ve settled on sending out a blast of pulses, then putting the microcontroller to sleep for a couple hundred milliseconds.  My assumption is that the robot won’t travel too far in that time.  So far, the results look positive.

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

#include <htc.h>

__CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & CP_OFF &

    CPD_OFF & BOREN_OFF & IESO_OFF & FCMEN_OFF);

#ifndef _XTAL_FREQ

 #define _XTAL_FREQ 2000000

#endif

#define PWM_OFF CCP1CON = 0x10

#define PWM_ON CCP1CON = 0x1c

#define BURST_COUNT 10                  // How many IR bursts to send

// GP2 - PWM output

void main() {

    int i;

    OSCCON = 0x51;                      // Internal 2MHz osc.

    ADCON0 = 0;                         // all pins digital

    ANSEL = 0;                          // all pins digital

    CMCON0 = 7;                         // Comparators off.

    TRISIO = 0;                         // all output

    GPIO = 0;                           // all pins low

    PR2 = 0b00001100 ;                  // Set up PWM for roughly 38kHz

    T2CON = 0b00000100 ;

    CCPR1L = 0b00000110 ;

    PWM_OFF;

    PSA = 0;                            // Don't use Timer0 prescalar

    WDTCON = 0b00010000;                // Prescalar = 1000 = 8192 = 272ms

    while (1){

        // Send a few IR bursts

        i = BURST_COUNT;

        while( i-- )

        {

            // Virtual wall is 1ms on, and 1ms off

            PWM_ON;

            __delay_us(1000);

            PWM_OFF;

            __delay_us(1000);

        }

        // Then sleep for a moment

        SWDTEN = 1;     // Enable watch dog timer

        asm("sleep");

        SWDTEN = 0;     // Disable watch dog timer

    }

}

Next Step

I’ve got the microcontroller programmed and the components permanently soldered onto a perma-proto board.  I’ve tested it using a CR2032 coin cell battery as the 3-volt source, and positioning it just right in a doorway with a small piece of a drinking straw over the infrared LED to make it more directional.  The next step, and the one most likely to confound me, will be finding a suitable enclosure, especially one pretty enough to be left out in the open and not look like I made it.

References

http://www.enide.net/webcms/index.php?page=virtual-wall-for-roomba
https://sites.google.com/site/irobotcreate2/createanirbeacon
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html
http://led.linear1.org/1led.wiz

Update 8/9/2014:  I posted a second part to this article here that includes the final product.

http://misc.ws/2014/02/27/diy-virtual-wall-for-roomba/

DIY Virtual Wall for Roomba – Part One相关推荐

  1. DIY Roomba Virtual Wall

    We recently got an iRobot Roomba 805 from Costco to help keep up with our dog's continuous shedding. ...

  2. 擦地机器人排行榜_拖地扫地机器人十大品牌排行榜哪个牌子好

    繁忙的工作生活已让人疲惫不堪,更多人选择回家里寻找那份业余闲适.国家旅游局也曾在2013年发布一份报告指出,我国国民工作日的休闲时间仅占24小时的13.15%,相当于3小时.这3小时也包含了进餐和午休 ...

  3. 寿命长性价比高的室内扫地机器人SLAM导航方案

    SLAM历史介绍 "舟师识地理,夜则观星,昼则观日,阴晦观指南针",几个世纪以前的古人便利用观星术和指南针实现了大航海中位置和航向的标定,走出世代居住的大陆走向广袤的大海,探索新大 ...

  4. 设计模式之C#实现--FactoryMethod

    作者:cuike519的专栏   http://blog.csdn.net/cuike519/ 工厂方法的目的很明确就是定义一个用来创建对象的接口,但是他不直接创建对象,而由他的子类来创建,这样一来就 ...

  5. 设计模式之原型法(ProtoType)----对象创建型模式

    设计模式之原型法(ProtoType)----对象创建型模式 1.意图 用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 2.适用性 1)当要实例化的类是在运行时刻指定时,例如,通过动 ...

  6. Docker 安全问题与防护 (学习笔记)

    文章目录 1. Docker面临的安全问题 1.1 Docker简介 1.2 Docker安全问题 2. Docker安全方案 2.1 Docker安全基线 2.2 Docker安全规则 2.3 Do ...

  7. [Robot projection]step5:机器人远程网站ROBOTWEBTOOLS

    文章目录 前言 准备工作 机器人(内容待订正) 虚拟墙 服务器 端口问题 Tomcat问题 网站搭建 总结 前言 本文将使用ROBOTWEBTOOLS团队编写的代码包进行机器人远程控制网页的搭建,其团 ...

  8. wordpress 插件_适用于您的网站的2015年顶级WordPress安全插件

    wordpress 插件 WordPress is the most used CMS as compared to any other CMS. The code behind WordPress ...

  9. 《设计模式:可复用面向对象软件的基础》——创建型模式(2)(笔记)

    文章目录 三.创建型模式 3.4 PROTOTYPE(原型) 1.意图 补充部分 2.动机 3.适用性 4.结构 5.参与者 6.协作 7.效果 8 实现 9.代码示例 10.相关模式 3.5 SIN ...

最新文章

  1. css3绘制环形_HTML5 + CSS3 gt;gt;gt; 015
  2. Microsoft Office PowerPoint 2020中文版
  3. c中嵌入Python,提供灵活性
  4. java更改背景_java – 使用jquery更改menue的背景颜色
  5. Windows驱动程序的加载
  6. 【JAVA基础篇】多线程
  7. 使用Canvas基于手势可以使树秋千
  8. cookie不同页面访问不到的问题
  9. php毕业设计商城模板,基于Thinkphp的毕业设计网上购物商城
  10. ElmentUI数据表格 序号
  11. 已知url地址,批量下载图片到指定目录
  12. Android翻转动画(卡片翻转效果)
  13. 5g网络技术目前怎么样?5g网络什么时候出?
  14. 重复率30%可以通过论文查重吗?
  15. 信息学奥赛一本通-1042
  16. ArrayIndexOutOfBoundsException: 4096 while reading gif file
  17. ZZULIOJ1032
  18. 【计算机网络】Shannon公式与Nyquist定理
  19. 【洛谷 P1240】诸侯安置
  20. 从后台拿到webshell

热门文章

  1. 使用Visual Studio实现WinForm多语言版本实例
  2. ASP.NET 3.5 Extensions预览版即将发布
  3. vi的visual模式
  4. Python学习笔记:错误和异常
  5. Linux下PDF操作与转换
  6. 原:开辟内存时,可以以结构体为单位,这样测试,是对的吧?
  7. MATLAB——阈值分割(一)
  8. 视频分类/动作识别数据库研究现状
  9. [云炬商业计划书阅读分享]土鸡养殖创业计划书
  10. 云炬Android开发笔记 8代码生成器设计与实践(仿ButterKnife注解框架,编译期生成代码)