[SOLVED] Roomba From PRONTO CODE to IR Emitter (IR LED + RAWCODE + ARDUINO)

Hi to all,
I'm trying to use arduino to control a roomba vaccum cleaning robot.
My project has a very simple IR Led and a 100 OHM resistor connected to the board.

I found this pronto code:
http://www.robotreviews.com/chat/viewtopic.php?t=8682#p64966

For clean:
0000 0069 0000 0008 0071 0027 0023 0071 0023 0071 0023 0071 0071 0027 0023 0071 0023 0071 0023 030B

I read all the documentation about Pronto code, and I was able to understand that

Frequency (hz) is: 39478
1 Cycle (ms) is: 0.025330563858351
First burst pair: 0
Second burst pairs: 8
0071 0027 means 0
0023 0071 means 1

So the string to send (3 times) is: 01110111

Well.....

The first thing I though is to use irlibrary... but how? SendRaw(X,Y,Z) with X a vector of hex converter to decimal, Y ?? Z=8???
I made several trials but I could'nt figure it out..

I found a script at:
http://l8ter.com/arduino/index.php

That's generate this code

int pinIRLED = 13;                                      // assign the Infrared emitter/ diode to pin 13
void setup() {
  pinMode(pinIRLED, OUTPUT);                            // set the pin as an output
}
// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
  unsigned long endPulse = micros() + pulseTime;        // create the microseconds to pulse for
  while( micros() < endPulse) {
    digitalWrite(pinIRLED, HIGH);                       // turn IR on
    delayMicroseconds(13);                              // half the clock cycle for 38Khz (26.32×10-6s) - e.g. the 'on' part of our wave
    digitalWrite(pinIRLED, LOW);                        // turn IR off
    delayMicroseconds(13);                              // delay for the other half of the cycle to generate wave/ oscillation
  }
}
void pulseOFF(unsigned long startDelay) {
  unsigned long endDelay = micros() + startDelay;       // create the microseconds to delay for
  while(micros() < endDelay);
}
void takePicture() {
  for (int i=0; i < 2; i++) {
        
        pulseOFF(2862);
pulseON(988);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(2862);
pulseON(988);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(2862);
pulseOFF(887);
pulseON(19733);
  }                                                     // loop the signal twice.
}
void loop() {
  takePicture();                                        // take the picture
  delay(5000);                                          // delay in milliseconds which allows us to do timelapse photography - 1 second = 1000 milliseconds
}

It seems to be wrong (it start with pulse off..) and in fact it doesn't work.. I try to invert pulse on/off (the timing seems to be correct) but it still doesn't work also if I repeat it 3 times (not 2 as the script do )

I have no idea on how I can figure it out and make my project work.. Please help me.

NB I read all the documentation regarding pronto code from remote central and from other website, I manually decodify it, I try to be accurate in defining the right frequency and cycle...

NB2 I don't have the original remote, so I can't use irLibrary to decode the signals

Please, somebody can help me?

Finally I was able to make it works:

#include <IRremote.h>

IRsend irsend;

//unsigned int clean[] = {2650,1100,750,2900,750,2950,700,2950,2700,1100,700,2950,750,2900,750};
unsigned int manu2[32]= {2872,999,897,2872,897,2872,897,2872,2872,999,897,2872,897,2872,897};

void setup()
{
  Serial.begin(9600);
}

void loop() {
 
    for (int i = 0; i < 4; i++) {
      //irsend.sendRaw(clean, 15, 38);
      irsend.sendRaw(manu2, 15, 39);
      Serial.println("Roomba GO~~~~~~~~~~~~~~~~~");
      delay(40);
    
  }
  delay(5000);
}

Manu2 is the best rawcode, derivated directly from Pronto Code (specs found on remote central site).
I hope this will help other people looking for similar solutions

Ciao

Here is a sketch I wrote to send different commands to the Roomba.

For example, enter "136" in the serial monitor, press enter, and the Roomba performs "clean". A list of codes to be sent is also included with the sketch.

probono:
Here is a sketch I wrote to send different commands to the Roomba.

For example, enter "136" in the serial monitor, press enter, and the Roomba performs "clean". A list of codes to be sent is also included with the sketch.

Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range. · GitHub

Testing with my roomba 560 but don't work.
Non va...

ciao

thanks

Cris

EDIT: Ok, ok, works!!!
The problem was the IR LED. I need to use a high power IR LED or use a "normal" IR LED but near roomba.

Thanks probono!

ciao

Cristian

maniiu:
Manu2 is the best rawcode, derivated directly from Pronto Code (specs found on remote central site).
I hope this will help other people looking for similar solutions

Hi maniiu,

Where did you converted the pronto code for clean, to raw code?

i have tested probono Sketch, but the first time iRobot 782 dont started with 4 differently IR LEDs.
I ordered the orginial Remote from iRobot and the buttons should be press one seconds.

for(i=0; i<3; i++)
{
roomba_send(136); // Send "On"
}

for(i=0; i<2; i++)
{
roomba_send(130); // Send "Forward"
}

This code runs fine.
But i dont found a "High Power IR" by the Electronic Distributors.

Hi maniiu,

can you please tell me the Roomba version that you have ?
Do you know if your code works with a roomba 770 ?

Last, how do you connect your IR LED on the Arduino ?

Best Regards