DIY Virtual Wall for Roomba – Part One
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 |
|
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.