Tiny Remote for iRobot Roomba

Share:

Description

The Tiny Remote is a very compact infrared remote control with only two buttons to control an iRobot Roomba. It produces three different infrared control signals that the robot interprets as Clean, Spot and Virtual Wall/Lighthouse.

The circuit is built mostly using SMD components to reduce its size, nearly to the size of a keychain and is powered by a CR2032 coin battery.

 

Design Considerations

After having designed the virtual wall, I wanted to be able to remotely control the robot. Most of the work had already been done on the assembler software of Virtual Wall so I was left with the tasks of redesigning the power supply and add two buttons.

Power supply considerations:

 

Like the  Virtual Wall, the infrared pattern generator:

The infrared patterns emitted by the remote control are a form of PWM, modulated with a carrier frequency around 38KHz~40KHz. Below is a picture of the lighthouse pattern captured using a TSOP1238 and an oscilloscope.

 

It consists of a sequence of eight bits, encoded as:

Bit 0

Bit 1

 

Transmitting commands on the remote:

No Stop command is included in the remote because it's not needed! Each command, Clean or Spot, act as start when the robot is stopped and stop when it's already running.

 

Generating the infrared 38KHz~40KHz carrier frequency:

Using a PIC microcontroller it is possible to output the infrared pattern and generate the carrier frequency. Mixing is accomplished by connecting the LED between the PWM output and the carrier output.

A solution is to use the PIC's master clock oscillator output to produce the carrier frequency. This is the solution proposed by the circuit below. The PIC clock runs at 160KHz (FOSC) using an RC oscillator and the carrier frequency is available on CLKOUT pin as FOSC/4, at 40KHz.

 

Schematic

From left to right we have the CR2032 3V coin battery, the power supply based on a MAX619 regulator, the microcontroller 12F629, two LEDs, one emitting visible light and an infrared one and two push buttons. Connected to the microcontroller's pin 2 (CLKIN) are R1 and C6 that form the RC pair for the PIC oscillator. There's also a 5 pin header to connect the programmer (an ICD2 or another compatible one). The two diodes D1 and D2 will drive the MAX619 ~SHDN when any button is pressed.

schematic

Schematic - Click to enlarge

The power supply's MAX619 is a step-up regulator capable of providing 5V/50mA from a 3V source. The complete circuit consumes 3.5mA on average and the IR LED peak current is 25mA mostly because the PIC cannot drive more than 25mA on its pins.

It is expected that a CR2032 will last some time because the current drawn by the MAX619 is only 10nA. Its recommended input voltage, ranges from 2V to 3.6V but up to 5V are tolerated and small Li-Ion (3.6V) or Li-Po (3.7V) rechargeable batteries are also good choices for powering the remote controller.

As referred above, the PIC's master clock should be adjusted to FOSC=160KHz using R1. Connecting a frequency counter to pin 3 (CLKOUT) and adjusting R6 until 39KHz or 40KHz are displayed. This adjustment is not critical.

The software running in the microcontroller will generate three independent commands for the robot when pressing button 1, button 2 and both at the same time.

The visible LED should be a high brightness model because it is driven with less than 1 mA.

 

List of Components

 

Quantity Part Description
1 BAT1 CR2032 holder
1 IC1 MAX619CSA SO-9 (RS #540-4148)
2 C1, C4 10uF/16V Aluminum electrolytic capacitors (RS #628-4018)
2 C2, C3 220nF/25V 1206 capacitor (RS #669-8436)
1 C6 22pF 1206 capacitor (RS #264-4040)
1 C5 100nF 1206 capacitor (RS #391-214)
2 R2, R4 4K7 resistor 1206 (RS #223-2350)
1 R3 150R resistor 1206 (RS #223-2142)
1 LED1 Any 5mm infrared LED (preferably a narrow beam one)
1 LED2 Any high brightness 1206 LED (visible)
1 ICD2 SIL header 5 pin female
2 B1, B2 Push button N/O smd (omron or similar)
2  D1, D2 BAS32 diode 1206 (RS #100-3432)
1   CR2032 battery

 

PCB

The PCB and Schematic were created using Eagle from Cadsoft. The PCB is very compact, about the size of a keychain and has a hole at the back. The blue line (replace with a wire jumper) and the ICD2 connector are only required for programming the microcontroller. There's no need to add them to the PCB if the PIC was previously programmed.

pcb

PCB

Both tracks and silk screen are available for download in two separate PDF files. Both files have mirror images suitable for photographic or toner transfer methods.

The final PCB completely assembled:

pcb assembled

 

Software

The remote controller uses the same software as the Virtual Wall. It's an assembler program and uses 89 bytes of FLASH and 8 bytes of RAM! There are no interrupts and all timings for the PWM generation are created by counting the instructions time.

The PWM routine gets one command byte (0xA2/0x84/0x88) and rotates it through the C flag. Then the infrared bit pattern is produced, waiting the correct amount of time and another bit is shifted through C. The process repeats itself 8 times, for each bit of the command byte.

flow diagram

Buttons B1 and B2 are connected to pins GP0 and GP1 respectively and change the command to be emitted. They currently generate Spot and Clean command bytes. When both buttons are pressed, the command emitted is the same as the Virtual Wall.

 

The following tables contain the infrared commands that the robot understands. You may use them to further expand this project:

Commands/Patterns Binary representation Hexadecimal
Power 1000 1010 0x8A 
Spot 1000 0100 0x84
Clean 1000 1000 0x88
Max 1000 0101 0x85
Left 1000 0001 0x81
Left/Forward 1000 1011 0x8B
Forward 1000 0010 0x82
Right/Forward 1000 1100 0x8C
Right 1000 0011 0x83
Pause 1000 1001 0x89
Virtual Wall/Lighthouse 1010 0010 0xA2

 

There are other patterns emitted by the docking/charging station, their job is to let the robot position itself in line with the front side of the dock and recharge automatically.

Docking Station Patterns Binary representation Hexadecimal
Behind 1111 0010 0xF2
Left 1111 1010 0xFA
Slightly Left 1111 1011 0xFB
Middle 1111 1110 0xFE
Slightly Right 1111 0111 0xF7
Right 1111 0110 0xF6

 

The firmware for pic12F629 is available for download below.

 

Evaluation

After programming the PIC, the master clock needs to be adjusted to 160KHz. Then power on your iRobot vacuum cleaner and press B2 to start cleaning. My Roomba iRobot 530 also turns on when I press the Clean button, but not always. It's something that needs further investigation

 

Downloads

Files available for download:

 

References

  1. PWM (Wikipedia)
  2. MAX619 datasheet
  3. PIC12F629 datasheet
  4. iRobot Create Open Interface (PDF)
  5. iRobot Serial Command Interface (PDF)

 

Published on Tuesday 2011/05/17, last modified on Monday 2013/06/10