1
\$\begingroup\$

I am trying to send commands to a Robosapien (first generation) using an IR LED hooked up to an Arduino. I have seen web pages on attaching a microcontroller directly to the toy, but what I want to do is just send commands via IR.

I found an article by K. Smith that mentioned that the IR commands sent by the Robosapien remote take the following form:

To send the hex code 85:

The IRout signal is held high until a signal is sent. Then a string of five zeros is sent to signify a command is coming. Then the hex code is sent but instead of sending a ‘1’ a ‘1110’ is sent and rather than a ‘0’ a ‘10’ is sent. So $85 looks like this:

Binary:     1    0  0  0  0  1    0  1
Robosapien: 1110 10 10 10 10 1110 10 1110

So I tried the code below:

int bitTime=833; 
int IROut =  4; 

// The setup() method runs once, when the sketch starts

void setup()   {                
  // initialize the IR digital pin as an output:
  pinMode(IROut, OUTPUT);      

  Serial.begin(9600);
}

void test()
{
  // output high
  digitalWrite(IROut,HIGH);
  delay(1000);

  // 5 zeros
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);

  // send 1110 10 10 10 1110 10 1110

  // 1110
  digitalWrite(IROut,HIGH);
  delayMicroseconds(3*bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 10
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 10
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 10
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 1110
  digitalWrite(IROut,HIGH);
  delayMicroseconds(3*bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 10
  digitalWrite(IROut,HIGH);
  delayMicroseconds(bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);
  // 1110
  digitalWrite(IROut,HIGH);
  delayMicroseconds(3*bitTime);
  digitalWrite(IROut,LOW);
  delayMicroseconds(bitTime);

   // output high
  digitalWrite(IROut,HIGH);
  delay(1000);
}

void loop()                     
{ 
  test();
}

But unfortunately I am not getting any response from the Robosapien. What am I doing wrong?

\$\endgroup\$
1
  • \$\begingroup\$ Uhm... are you using external components to modulate the IR signal over the 39.something KHz carrier? \$\endgroup\$ – Axeman Oct 11 '12 at 14:28
1
\$\begingroup\$

A bit time of 833 µs implies a data rate of 1200 bps. I don't know anything about Robosapien, but my first thought is that this signal is possibly meant to be the keying (envelope) imposed on a higher-frequency (e.g., 38 kHz) IR carrier signal.

Can you provide a link to the K. Smith article for reference?

\$\endgroup\$
3
  • \$\begingroup\$ Precisely. Robosapien AFAIR (I've played with that thing years ago) asks for a 1200 bps signal over a 39.2 KHz carrier. \$\endgroup\$ – Axeman Oct 11 '12 at 14:42
  • \$\begingroup\$ Thanks, Dave. Here is the link to the article: docstoc.com/docs/27902404/Robosapien-Project \$\endgroup\$ – M-V Oct 11 '12 at 15:27
  • \$\begingroup\$ Dave, you've pointed me in the right direction. This is all new stuff to me - I'll look into how to generate the carrier signal. \$\endgroup\$ – M-V Oct 11 '12 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.