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");
*/

}

}

Advertisements

19 thoughts on “Updated RoboSapien IR Control – Arduino

  1. when running this on an uno rev 3 from arduino 1.0.5 I get the error …

    error ‘class IRsend’ has no member named ‘sendRSV1’

  2. The sketch will compile now thanks… the only problem I have now is not knowing what controller my robosapien is supposed to have ( I got it without one).

    1. Excellent! I bought a few sapiens from eBay – all of them worked – takes a bit of fiddling around – but once you get them working its quite good.

  3. Hello Davy : Many thanks for this excellent Post. I am having much fun with my RoboSapien now that I can store my programs on my laptop and Upload them onto the Robot via a cheap IR transmitter that I baught. No more having to spend hours painstingly entering commands.

    Just one comment : I found that a delay of 5 seconds after each sendRSV1 command (instead of your 2 seconds) works better for me.

    Regards
    Ian

  4. I keep getting error:
    sketch_oct28b.cpp.o: In function `loop’:
    /Applications/sketch_oct28b.ino:13: undefined reference to `IRsend::sendRSV1(unsigned long)’
    /Applications/sketch_oct28b.ino:19: undefined reference to `IRsend::sendRSV1(unsigned long)’

  5. hi! thanks for you information. i just start to play with robosapiens and i found that information from “2010” webpages is missing… looks like the people lost the interest on this toys and forget the webpages… is good to see a “2013” post.

    Thanks!

  6. I have just been trying to get you code working but it won’t compile. I have have installed Kens IR library and his code compiles fine but after copying your modified files I get a series of errors about ‘class decode results’ has no member named ‘overflow’. Any ideas?

  7. Well it could be lots of things – it used to work with just a copy but Ken will have updated his libs and you will need do same. in the CPP there are two methods – sendSRV and decodeRSV – cut and paste those in and then look for anything RSV1 in the .h files and add them into the new code.

    1. Thanks for the reply, unfortunately the new library appears to be quite different from the old one (all the individual remote types are broken out into seperate .cpp files) and making your stuff fit is somewhat beyond me. Don’t suppose you could upload a copy of the old modified library that works? I only want to control a robosapien and don’t care about the new features of the library.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s