Sampling signal from a remote.

Hi all, I'm trying to sample the signal from a RF remote but i'm not really good programming...

I'm using this code:

void setup()
{
pinMode(7, INPUT);
Serial.begin(9600);
}


void loop()
{
unsigned long high;
unsigned long low;
high = pulseIn(7, HIGH);
low = pulseIn(7, LOW);
Serial.print("HIGH: ");
Serial.print(high);
Serial.print("    LOW: ");
Serial.println(low);
}

And I get (with the same botton):

first time:

HIGH: 669    LOW: 643
HIGH: 721    LOW: 642
HIGH: 668    LOW: 649
HIGH: 722    LOW: 649
HIGH: 669    LOW: 642
HIGH: 721    LOW: 643

second:

HIGH: 669    LOW: 649
HIGH: 722    LOW: 649
HIGH: 668    LOW: 648
HIGH: 722    LOW: 648
HIGH: 669    LOW: 642
HIGH: 722    LOW: 643

third:
HIGH: 668    LOW: 642
HIGH: 722    LOW: 642
HIGH: 669    LOW: 642
HIGH: 722    LOW: 642
HIGH: 674    LOW: 642
HIGH: 722    LOW: 642

So i created this code:

void setup()
{
pinMode(7, OUTPUT);

}
void loop()
{
  
  /*
HIGH: 668    LOW: 642
HIGH: 722    LOW: 642
HIGH: 669    LOW: 642
HIGH: 722    LOW: 642
HIGH: 674    LOW: 642
HIGH: 722    LOW: 642
*/

digitalWrite(7,HIGH);
delayMicroseconds(668);
digitalWrite(7,LOW);
delayMicroseconds(642);


digitalWrite(7,HIGH);
delayMicroseconds(722);
digitalWrite(7,LOW);
delayMicroseconds(642);

digitalWrite(7,HIGH);
delayMicroseconds(669);
digitalWrite(7,LOW);
delayMicroseconds(642);

digitalWrite(7,HIGH);
delayMicroseconds(722);
digitalWrite(7,LOW);
delayMicroseconds(642);

digitalWrite(7,HIGH);
delayMicroseconds(674);
digitalWrite(7,LOW);
delayMicroseconds(642);

digitalWrite(7,HIGH);
delayMicroseconds(722);
digitalWrite(7,LOW);
delayMicroseconds(642);
delay(2000);

}

The led on the remote blinks faster then when I normally press a button and it doesen't work...

The GND of the remote and arduino are common.
I've connected the DATA pin on the TX module of the remote to the pin 7

Where's the problem?
Sorry for my bad english!

IR devices needed to be able to filter out the sun (which is IR). The standard is a 38kHz sqaure wave. A logic "1" is not "ON," it is flashing --very-- fast at 38kHz. Your LED is not flashing this fast. The reason that the IR receiver spits out what it does is because it has a demodulator. If it sees 38kHz flashing, it changes this in to a solid logic one.

Check out this site:
http://www.ladyada.net/learn/sensors/ir.html
for a tutorial on controlling IR devices.

Good Luck!

Sorry, I forgot to say that the remote is radio!
I have connected the arduino pin to the data pin of the TX module.

So how are you reading it? Sending commands to it?

This is the back of the remote, here you can see the TX module:

I'm trying to copy the signal sent to that module because I want to control it directly from the arduino.

Sorry for my english

OK. I get it. I think your problem is that all commands take time. Take a look at the link I posted above... You'll see that digitalWrite() is not used, the PORT command is used along with << and >>.

Uhm, now I'll look at it... I hope it'll resolve!

Ok, i get this

Ready to decode IR!



Received: 

OFF 	ON

0 usec, 17572 usec
660 usec, 1280 usec
720 usec, 640 usec
1360 usec, 1300 usec
720 usec, 1300 usec
700 usec, 640 usec
1360 usec, 640 usec
1360 usec, 660 usec
1360 usec, 640 usec
1380 usec, 640 usec
1360 usec, 640 usec
1380 usec, 640 usec
1360 usec, 640 usec
1360 usec, 1300 usec
720 usec, 640 usec
1360 usec, 640 usec
1360 usec, 1300 usec
740 usec, 640 usec
1360 usec, 640 usec
1360 usec, 1300 usec
720 usec, 1280 usec
680 usec, 13404 usec
660 usec, 1300 usec
700 usec, 640 usec
1380 usec, 1280 usec
720 usec, 1300 usec
700 usec, 640 usec
1380 usec, 620 usec
1380 usec, 640 usec
1360 usec, 640 usec
1400 usec, 620 usec
1380 usec, 640 usec
1360 usec, 640 usec
1360 usec, 640 usec
1380 usec, 1280 usec
720 usec, 640 usec
1360 usec, 640 usec
1380 usec, 1280 usec
740 usec, 640 usec
1360 usec, 640 usec
1380 usec, 1280 usec
720 usec, 1300 usec
660 usec, 13364 usec
660 usec, 1300 usec
700 usec, 640 usec
1380 usec, 1280 usec
720 usec, 1300 usec
700 usec, 640 usec
1380 usec, 620 usec
1380 usec, 640 usec
1360 usec, 640 usec
1400 usec, 620 usec
1380 usec, 620 usec
1380 usec, 640 usec
1360 usec, 640 usec
1380 usec, 1280 usec
720 usec, 640 usec
1360 usec, 640 usec
1360 usec, 1300 usec
740 usec, 640 usec
1360 usec, 640 usec
1380 usec, 1280 usec
720 usec, 1300 usec

But now the code for send the code modulates at 38Khz... And i don't know how is modulated in my remote...

(Send code from LadyAda)

// This sketch will send out a Nikon D50 trigger signal (probably works with most Nikons)
// See the full tutorial at http://www.ladyada.net/learn/sensors/ir.html
// this code is public domain, please enjoy!
 
int IRledPin =  13;    // LED connected to digital pin 13
 
// The setup() method runs once, when the sketch starts
 
void setup()   {                
  // initialize the IR digital pin as an output:
  pinMode(IRledPin, OUTPUT);      
 
  Serial.begin(9600);
}
 
void loop()                     
{
  Serial.println("Sending IR signal");
 
  SendNikonCode();
 
  delay(60*1000);  // wait one minute (60 seconds * 1000 milliseconds)
}
 
// This procedure sends a 38KHz pulse to the IRledPin 
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait
 
  cli();  // this turns off any background interrupts
 
  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRledPin, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(10);         // hang out for 10 microseconds
   digitalWrite(IRledPin, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(10);         // hang out for 10 microseconds
 
   // so 26 microseconds altogether
   microsecs -= 26;
  }
 
  sei();  // this turns them back on
}
 
void SendNikonCode() {
  // This is the code for my particular Nikon, for others use the tutorial
  // to 'grab' the proper code from the remote
 
  pulseIR(2080);
  delay(27);
  pulseIR(440);
  delayMicroseconds(1500);
  pulseIR(460);
  delayMicroseconds(3440);
  pulseIR(480);
 
 
  delay(65); // wait 65 milliseconds before sending it again
 
  pulseIR(2000);
  delay(27);
  pulseIR(440);
  delayMicroseconds(1500);
  pulseIR(460);
  delayMicroseconds(3440);
  pulseIR(480);
}

Maybe you can get/find/build a frequency counter to figure out the carrier frequency (it's probably AM). Then you can build an AM transmitter controlled by your arduino.