Updated RoboSapien IR Control – Arduino

There is a brilliant hack for these http://playground.arduino.cc/Main/RoboSapienIR.  I wired this up – but I ended cutting up the poor thing – so I thought I could try it with an IR transmitter instead to do the same thing.  Also means you dont have to ruin your soldering iron punching a hole through the body 🙂

I decided to use the Ken Shirriff IR library.  Its  work of genius.

http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html

But it didnt have one for Robosapien. The way it works is pretty cool – but you need a couple of days hack time to figure it out.  The codes from the sapien controller seemed to be in single bytes – so with some effort I managed to get it to transmit those codes.  I tried it on 6 sapiens I bought for a school project.

I updated three of the library files.  I have not included the whole library – just the updated files – so best way is to downloaded Ken’s library and then just replace with these files here

You’ll need an IR Transmitter with an Arduino board.  Something like this http://emartee.com/product/42200/  This project looks like the sort of thing you want to do: http://jerrylparker.com/?p=94

Wire it up with Pin 3 and make sure you hold the transmitter close to the Robots head.  These arduino ones dont have much power and I found the transmitter needed to be within 10-15cm.  However the idea is to be able to replace the onboard controller with Arduino – so you can still do that and without hacking up the toy.

I mapped out the buttons to codes – so in the Arduino sketch – use commands like  irsend.sendRSV1(142);  The sketch is at the bottom.  Its pretty simple.  I had done two types – ones where you have a set sequence.  The other was to initiate the sequence from a PC.  Hence the Serial.read().  I use Processing for that stuff – its amazing as well.

This was done in Excel – which you can download here.  This is the simple pasted version.

 

Button Controller Function Presses Arduino Code
12 Red Turn Right 1 128
1 Red Right Arm Up 2 129
4 Red Right Arm Out 2 130
5 Red Tilt Body right 1 131
2 Red Right Arm Down 2 132
3 Red Right Arm In 2 133
11 Red Walk Forward 2 134
15 Red Walk Backwards 2 135
14 Red Turn Left 1 136
6 Red Left Arm Up 2 137
9 Red Left Arm Out 2 138
10 Red Tilt Body Right 1 139
7 Red Left Arm Down 2 140
8 Red Left Arm In 2 141
13 Red Stop 1 142
19 Red Master Command Program 1 144
20 Red Program Play 1 145
16 Red Right Sensor Program 1 146
18 Red Left Sensor Program 1 147
17 Red Sonic Sensor Program 1 148
12 Green Right Turn Step 1 160
1 Green Right Hand Thump 1 161
4 Green Right Hand Throw 1 162
5 Green Sleep 1 163
2 Green Right Hand Pickup 1 164
3 Green Lean Backward 1 165
11 Green Forward Step 1 166
15 Green Backward Step 1 167
14 Green Left Turn Step 1 168
6 Green Left Hand thump 1 169
9 Green Left hand Throw 1 170
10 Green Listen 1 171
7 Green Left Hand Pickup 1 172
8 Green Lean Forward 1 173
13 Green Reset 1 174
19 Green Master Command Program 1 176
20 Green Wake Up 1 177
16 Green Right Sensor Program Execute 1 178
18 Green Left Sensor Program Execute 1 179
17 Green Sonic Sensor Program Execute 1 180
12 Orange Right Hand Strike 3 1 192
1 Orange Right Hand Sweep 1 193
4 Orange Burp 1 194
5 Orange Right Hand Strike 1 195
2 Orange High 5 1 196
3 Orange Right Hand Strike 1 197
11 Orange Bulldozer 1 198
15 Orange Oops 1 199
14 Orange Left Hand Strike 3 1 200
6 Orange Left Hand Sweep 1 201
9 Orange Whistle 1 202
10 Orange Left Hand Strike 1 203
7 Orange Talk Back 1 204
8 Orange Left Hand Strike 1 205
13 Orange Roar 1 206
19 Orange All Demo 1 208
20 Orange Power Off 1 209
16 Orange Demo 1 1 210
18 Orange Demo 2 1 211
17 Orange Dance Demo 1 212

/*

Based on IRSend demo from ken Shirriffs library - this sends simple commands to a RoboSapien V1 using
and IR Transmitter with Arduino

*/

#include <IRremote.h>

IRsend irsend;
IRrecv irrecv(11);

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

void loop() {

irsend.sendRSV1(142);
delay(1000);

if (Serial.read() != -1) {

Serial.println("started");
irsend.sendRSV1(129);
irsend.sendRSV1(199);

/*
irsend.sendRSV1(129);
irsend.sendRSV1(129);
delay(1000);
irsend.sendRSV1(169);
delay(2000);
irsend.sendRSV1(162);
delay(2000);
irsend.sendRSV1(173);
delay(2000);
irsend.sendRSV1(196);
delay(2000);
irsend.sendRSV1(206);
delay(2000);
irsend.sendRSV1(199);
delay(2000);
Serial.println("Done");
*/

}

}