# Roomba - IR LEDs

I was wondering if it was possible to create a DIY virtual wall for the iRobot roomba. Can anyone explain how I'd go about figuring out how this works?

-

I've done that years ago just capturing the original signal from the Rumba Wall with my digital oscilloscope (but can be done for free with the PC audio card) and writing a really simple PIC program to replay the same signal with a 38Khz carrier just using NOPs and a few cycles.

I then built on a proto board a simple circuit with a PIC12F675, a transistor, a narrow beam IR led, and 4xAA NiMh cells.

30 minutes of work, and a Flawless victory :-)

I still have the code, but I'm really ashamed to show it, it really was a coding horror :D

EDIT: You asked for it, you got it. AND YOU PROMISED: No Comment... it just works. ;-)

list    p=12F629
include "p12f629.inc"
__CONFIG    _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT  ;Internal osc.
d1      equ     20h
d2      equ     21h
d3      equ     22h
d4      equ     23h
d5      equ     24h
d6      equ 25h
fileA       equ 26h ;delay fileA
fileB       equ 27h ;delay fileB
filec       equ 28h ;delay fileC
pin7        equ 0   ;GP0
pin6        equ 1   ;GP1
pin5        equ 2   ;GP2
pin4        equ 3   ;GP3
pin3        equ 4   ;GP4
pin2        equ 5   ;GP5

Start   org 0x0000
nop
nop
nop
nop
nop
nop
SetUp   bsf STATUS, RP0     ;Bank 1
movlw   b'10000110'
movwf   OPTION_REG
movlw   b'00000000'
movwf   TRISIO
call    0x3ff
movwf   OSCCAL
bcf STATUS, RP0 ;bank 0
clrf    GPIO
goto    Main
delay_1s
movlw    0x07
movwf    d1
movlw    0x2F
movwf    d2
movlw    0x01
movwf    d3
Delay_0
decfsz   d1, f
goto     $+2 decfsz d2, f goto$+2
decfsz   d3, f
goto    Delay_0
goto    $+1 goto$+1
goto    \$+1
return
do_pulse
movlw   b'11111111'
movwf   GPIO
nop
nop
nop
nop
nop
nop
nop
movlw   b'00000000'
movwf   GPIO
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return
do_not_pulse
movlw   b'00000000'
movwf   GPIO
nop
nop
nop
nop
nop
nop
nop
movlw   b'00000000'
movwf   GPIO
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return
Do_1
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
call do_pulse
return
Do_0
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
call do_not_pulse
return
Main
call Do_1
call Do_1
call Do_1
call Do_0
call Do_1
call Do_0
call Do_0
call Do_0

call Do_1
call Do_1
call Do_1
call Do_0
call Do_1
call Do_0
call Do_0
call Do_0

call Do_1
call Do_0
call Do_0
call Do_0

call Do_1
call Do_0
call Do_0
call Do_0

call Do_1
call Do_1
call Do_1
call Do_0
call Do_1
call Do_0
call Do_0
call Do_0

call delay_1s

goto Main

end@

-
This sounds idea. Would you be able to share the code or signal data you discovered? –  ElectroNoob Jun 5 '12 at 16:12
I think I still have somewhere the 'scope screenshot, tonight I'll search for it and I'll post that and/or the code. But I don't want to read NOTHING about the horrors in that program! :-) –  Axeman Jun 6 '12 at 5:57
@FakeName Grrrrrr.... :-) –  Axeman Jun 8 '12 at 9:31
Realistically, I actually believe that it's fundamentally impossible to tell bad assembler apart from good assembler. As such, I don't think anyone here will be particularly bothered. –  Connor Wolf Jun 8 '12 at 9:56
I almost agree with you, but there are some assembly listing that don't have excuses. like the one above... :-) –  Axeman Jun 8 '12 at 12:03

That should be doable. The virtual wall is just a beacon using an IR emitter. We're talking about this:

So it's just an IR LED, a series resistor and a battery? Most likely not, unfortunately. The beacon will probably use a coded signal, so the the Roomba can tell it apart from other IR sources. You would have to know which IR wavelength it uses, though 950nm is a good guess. Then you need an existing Virtual Wall to record its signal with an IR photodiode and a microcontroller. Once you have the signal, that same microcontroller can send it via an IR LED.
That's worst case. If they chose for a simpler signal it would probably be a steady pulse train, like Fake Name suggests. In that case you can use an oscilloscope or the microcontroller to measure frequency and duty cycle. Also in that case the microcontroller is the simplest way to regenerate the signal.

Not everybody is convinced of this. Yet the microcontroller does not need a single external component and the required program can be written in minutes, about the time you need to calculate the components for a 555 AMV. Accuracy: 1%. (the 1% ceramic capacitor for a 555 AMV costs almost as much as the microcontroller.) And the 555 can't do duty cycles less than 50% without yet another component. The microcontroller can do any duty cycle. Welcome to the 21st century.

You'll need some knowledge of programming microcontrollers. The rest is just a couple of optoelectronic components, like the LED and the photodiode. And of course you'll have to borrow a commercial Virtual Wall.

-
I kind of doubt they do any real modulation, I would bet it's just a simple carrier. If you have a actual, retail virtual wall, use a photodiode to sniff the signal (or take it apart and probe the internals directly) with an oscilloscope. –  Connor Wolf Jun 4 '12 at 8:33
Also in that case the microcontroller is the simplest way to regenerate the signal. What? The easiest way to generate a fixed-frequency signal is a hardware astable oscillator, like the common 555. A MCU is WAY overkill, and would drag in bundles of software complexity. It basically takes something that would take 20 minutes to solder together on some perf board, and turns it into a multi-hour undertaking. –  Connor Wolf Jun 4 '12 at 9:55
@Fake - using a microcontroller it takes exactly 1 (one) component, and you have a rectangle wave with 1% accuracy at any duty cycle you want. –  stevenvh Jun 4 '12 at 10:06
@stevenvh As you said: For someone who's acquainted with the microcontroller. Otherwise, it's hours and hours of getting into quirks of the platform, looking up errata and so on. Of course, there's the support circuitry needed and a programmer. A simple timer has wide input voltage, while a microcontroller will usually require 5 V or 3.3 V input, which with itself brings more complexity such as voltage regulator and so on. –  AndrejaKo Jun 4 '12 at 10:41
BTW: Roomba is able to differentiate between a virtual wall and its docking station, implying there is some sort of data contained in the pulse train. –  jippie Jun 4 '12 at 19:17