PS2 IR Codes

I was trying to find the IR codes for the PS2 dvd remote control, but after a little research, I found these.

X – 0x7AB5B
O – 0xBAB5B
triangle – 0x3AB5B
square – 0xFAB5B
up – 0x9EB5B
down – 0x5EB92
left – 0xDEB92
right – 0x3EB92
L1 – 0x5AB92
L2 – 0x1AB5B
L3 – 0x8AB5B
R1 – 0xDAB5B
R2 – 0x9AB5B
R3 – 0x4AB5B
start – 0xCAB5B
select – 0xAB5B

DVD remote commands

Play – 0x4CB92
Pause – 0x9CB92
Stop – 0x1CB92

The codes are 20 bit sony codes, so can be used with the arduino IRlibrary by this command:

irsend.sendSony(0xXXXXX, 20);

The codes need to be sent twice with a 10ms pause in between the commands.

Hopefully this will help whoever to do what they want with thier projects. I thought about using this with an old psx gamepad and using a atmega328 and battery to make it wireless through IR for the ps2 since they dont have the joysticks anyhow.


Robosapien/WowWee IR arduino library

I got another robosapien in the trash, but this time is a robosapien V1. I didnt feel like tearing this one apart to have to run a cable to it to inject it into it’s brain, so I started messing with the library used here:

The issue was, when using his code, it only worked from the arduino only, and only worked with the original robosapien V1 robot, so I tore apart his code and modified it to add in support for other WowWee products like V2 and roboraptor.

The issue was, his code was locked so that it could only handle sending 8 bit codes(one byte), but the V2 and other wowwee products use 12 bit codes, so a little bit of it had to be changed to handle the 12 bit codes. The IR codes use the same type of data being sent, same 8 bit codes, but uses a 4 bit identifier code that makes that specific remote only work on that robot.

Just download the standard IRremote library here:

and replace the normal files with the ones in this archive:
mirror here:

Here’s a bit of an example for transmitting the codes out from the serial connection/usb.

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;        // pin 3 as IR LED output
int data;
void setup()

void loop() {
  while (Serial.available()> 0) {
    data = Serial.parseFloat();
    // Serial.println(data);

The send irsend.sendRSV1 command can be changed to irsend.sendRSV2 to send the alternative codes for V2, robo raptor, or almost any of the wowwee robots. You’ll have to convert the hex addresses to decimal to input them, but you can easily do that with a python script or whatever. To just mess around with it, I was using the calculator on windows/linux and setting it in advanced/programming mode and clicked the hexadecimal circle, typed in the command on the site, then clicked decimal and it would show the decimal number.

Here’s a list of all commands for a bunch of the wowwee robots:

Robosapien V1 codes:

Robosapien V2 and other wowwee robots:

on the V2 page, the 3xx is the 0011, aka the robot identifier code, to change to another robot, just change the 3 to whatever robot you are trying to control.

I hope that everything works good for everyone, It’s experimental still, but it works for me at least.

Updating firmware on USBASP from eBay

I got a USBASP off of ebay over christmas, but when trying to use it, avrdude and arduino would complain about the sclock not being able to be set. After a while of looking it up online, I found out that the issue was with an old firmware, so after a little research, this is what I discovered and what I had to do to update it.

This guide is for linux, if you want a guide for windows, here’s one that is the equivalent of it:

First, install the megaisp sketch on an arduino, then hook the arduino to usbasp by connecting the arduino’s pins, to the 10 pin header on the usbasp programmer, using this diagram to hook it up:

My connections were
 Arduino    USBASP
 5V ———– 2
 GND ——– 10
 13 ———— 7
 12 ———- 9 (MISO)
 11 ———- 1 (MOSI)
 10 ———  5 (RESET) 

Just make sure to have it unplugged from the usb port while doing all of this. Also, you’ll need to short the program pin, on mine, it was pin 2 but you may need to check yours to see what yours is. I used a piece of wire on mine shortly to short them together, just by putting the wire through the holes and wrapping the wire around the whole USBASP programmer.

Then try to use this command in the command prompt, if everything goes correctly, it’ll say something like “AVR: ready to accept commands” or something like that:

avrdude -c avrisp -P /dev/ttyACM0 -b 19200 -p m8 -v

If it complains about “AVR: not found” or something like that, then check your wiring, or check your programmer’s chip to make sure it has the ATMEGA8, and if not, change the “m8” to whatever chip is used.

If everything works fine and it is ready to accept the commands, you can download the updated firmware from the site. Here’s the link:

Just download, extract, and use this command to update the firmware:

avrdude -c avrisp -P /dev/ttyACM0 -b 19200 -p m8 -U flash:w:usbasp.atmega8.2011-05-28.hex

If everything went according to plan, you should be able to just unplug the USBASP from the arduno and plug it into the computer , all ready to go.

Here is the one that I purchased and that the pinout worked on:

usbasp programmer

Also, if you have one of these, and you notice that it doesnt work sometimes, just unplug it and wait a few mins, then try again, mine tends to misbehave if you unplug it and plug it in a few times, I think mine just spazzes out sometimes.

Program an Arduino using your sound card

New Addition to the Robot Circus

Well, there’s a new robot in town, it’s name is Mouse. I named it mouse because of the fact that when I was first putting it together, the big wheels and the base reminded me of a weird mouse with the wires sticking straight out the back of the base. I made it over the last few days using my 3d printer and some extra servos/arduino/printboard. It tends to go in large circles because of the fact that I dont know what the centers are on the servos for the arduino programming. Ive always used them with PIC chips, which I figured for this little bot, I’d change it up a little to learn something new. Other than the large circles issue, it runs around the camper here and if something gets in its way, the ultrasonic sensor on top picks it up and tells the robot to turn around and run away.

Here’s some pics of it sitting on my resistor cabnet waiting for me to press the go button:



Its based off of the miniskybot 2.0, which is a basic printbot. The robot is an educational robot designed by a guy over in spain, but uploaded the robot as open source for anyone to use and modify as they wanted.

With a 9v backpack holder hot glued to the back of the robot, here’s the 9v backpack

I also used a custom printshield which seperates the 9v from running into the 6v servos, and used the 6 AAA batteries that are designed into the base of the robot to power the servos with, then 9v battery for the arduino and sensors. I did it like this so motors didnt get too much power, and it helps prevent power dips when its running which would normally cause the robot to reset itself.

If anyone wants the pcb layout for the printshield, I can upload the files, and/or the mirrored pdf file to use for toner transfer method.

Will be bringing him to a certain gyro shack and letting him loose as soon as I can get over there 😛

Robosapian v2 PC control/New Toy

I know I havnt posted any posts in a while, but been busy working with a new project. I recently came across a robosapian v2 that someone tossed in the trash, that I rescued and got working again. The only thing is, he had no remote, so this is what I did to get control of him using the computer.

I rewired him and replaced all of the original and crumbling wires, and cleaned out the battery compartments since the batteries had exploded inside of him, then I found the wire running from his IR sensor to the motherboard inside of his back. I cut the wire and added a normally closed mono headphone jack, the type that when nothing’s plugged in, it shorts the two contacts together. The contact that gets disconnected, I ran to the IR sensor, then the other, I ran to the motherboard so the tip of the headphone jack will connect into the motherboard when it’s plugged in, and will disconnect the IR sensor so there is no false signals coming from the IR sensor in the head while it’s plugged in, then it will connect back up the IR sensor in the head when the headphone jack isnt plugged in. I put the headphone jack into his back, he usually has something that looks like a button on his back and front, but I just popped the one out on his back, and drilled it out slightly to put the jack in it, and now it looks like it was just designed into it by default.

Then I took an arduino and on a protoboard I found for dirt cheap on ebay, I soldered another headphone jack to it with 3 pin header so you can use it as you wish. I then used a 1.8k ohm resistor and a 3.3k ohm resistor to hook up a voltage divider between pin 13 and gnd, and the divided voltage went to the tip of the headphone jack on the protoshield.

Using this code below, I am able to send commands to the robosapian v2 by a python program called that I found online, Ill post a link to it below also. I had to modify the code slightly because newer arduino software deprecated a few things that was in the old code.

// rs_commander.c - Arduino-based serial port controller for Robosapiens
// Modified: 9/15/10
// Author: Ben Bongalon (
// Adapted from Karl Castlet's code
// I refactored it a bit and added support for the Robosapien V2 and
// other models (untested).
// Robosapien's model types. Credit to AiboPet's BoneYard
#define RS_MODEL_ROBOSAPIEN_V1   0x00
#define RS_MODEL_ROBORAPTOR      0x01
#define RS_MODEL_ROBOPET         0x02
#define RS_MODEL_ROBOSAPIEN_V2   0x03
#define RS_MODEL_ROBOREPTILE     0x04
#define RS_MODEL_RSMEDIA         0x05
#define RS_MODEL_ROBOQUAD        0x06
#define RS_MODEL_ROBOBOA         0x07
#define RS_BIT_HIGH    1
#define RS_BIT_LOW     0
// User-configurable parameters
int RSModel = RS_MODEL_ROBOSAPIEN_V2;  // your Robosapien model
boolean RSEcho = true;          // echo commands to host PC?
int irSignalPin = 2;             // Infrared wire connects to this Pin
int ctrlPin = 13;                // Generate the pulses on this Pin
volatile int RSIRCommand;        // Single byte command from IR
volatile int RSBit=9;            // Total bits of data
boolean RSIRCommandReady=false// IR command was received?
int bitTime = 833;               // bit width in microseconds (1/1200 second clock)
#define INTER_CMD_TIME    10     // msecs before sending next command
// Encode a binary '1' or '0' on the wire
void WriteBit(int bit)
  digitalWrite(ctrlPin, HIGH);
  delay_ticks((bit == RS_BIT_HIGH) ? 4 : 1);
  digitalWrite(ctrlPin, LOW);
// Send a byte down the wire (MSB first)
void WriteByte(byte b)
    WriteBit( (b & 0x80) == 0x80 );
    WriteBit( (b & 0x40) == 0x40 );
    WriteBit( (b & 0x20) == 0x20 );
    WriteBit( (b & 0x10) == 0x10 );
    WriteBit( (b & 0x08) == 0x08 );
    WriteBit( (b & 0x04) == 0x04 );
    WriteBit( (b & 0x02) == 0x02 );
    WriteBit( (b & 0x01) == 0x01 );
// Start each Robosapien commands with a preamble
void WritePreamble()
   // Pull down the I/O line for 8 ticks
   digitalWrite(ctrlPin, LOW);
   // Send the Robosapien model type (not needed for the orginal Robosapien)
   if (RSModel != RS_MODEL_ROBOSAPIEN_V1) {
     WriteBit( (RSModel & 0x08) == 0x08 );
     WriteBit( (RSModel & 0x04) == 0x04 );
     WriteBit( (RSModel & 0x02) == 0x02 );
     WriteBit( (RSModel & 0x01) == 0x01 );
// Add N clock ticks of delay
void delay_ticks(int ticks)
// Receive a bit at a time.
void RSReadCommand()
  delayMicroseconds(bitTime + bitTime/4);      // about 1 1/4 bit times
  int bit = digitalRead(irSignalPin);
  if (RSBit==9) { // Must be start of new command
    RSIRCommandReady = false;
  if (RSBit<8) {
    RSIRCommand <<= 1;
    RSIRCommand |= bit;
  if (RSBit==9) {
void RSSendCommand(int opcode)
  WriteByte(opcode & 0xFF);
  digitalWrite(ctrlPin, HIGH);
  if (RSEcho) {
  delay(INTER_CMD_TIME);    // buffer time before processing next command
// Initialize the serial port, GPIO pins and interrupts
void setup()
  pinMode(irSignalPin, INPUT);
  pinMode(ctrlPin, OUTPUT);
  digitalWrite(ctrlPin, HIGH);
// Main program loop
void loop()
  // If a command was received from the IR remote, relay it to the robot
  if (RSIRCommandReady) {
  // otherwise, check the serial port for new commands sent by computer
  else if (Serial.available() > 0) {
    int opcode =;

And here is the link for

Ill try to post pictures later, but dont feel like tearing him all back apart again atm. 😛

ps, if your having trouble with the code I posted, just grab the code from the site with robomoco, under the part 1 link,  and look for “serial.print(opcode, BYTE” and change it to “serial.print(opcode)”, then it should compile fine.

PySerial autofind serial port

here’s a small script that I found somewhere online, and heavily modified to auto search for and connect to the first serial port it can find, skipping the built in serial port for last.

import serial
locations=[‘/dev/ttyACM0’, ‘/dev/ttyACM1′,’/dev/ttyACM2’, ‘/dev/ttyACM3′,’/dev/ttyACM4’, ‘/dev/ttyACM5′,’/dev/ttyUSB0′,’/dev/ttyUSB1′,’/dev/ttyUSB2′,’/dev/ttyUSB3’, ‘/dev/ttyUSB4’, ‘/dev/ttyUSB5’, ‘/dev/ttyUSB6’, ‘/dev/ttyUSB7’, ‘/dev/ttyUSB8’, ‘/dev/ttyUSB9’, ‘/dev/ttyUSB10′,’/dev/ttyS0’, ‘/dev/ttyS1’, ‘/dev/ttyS2’, ‘com2’, ‘com3’, ‘com4’, ‘com5’, ‘com6’, ‘com7’, ‘com8’, ‘com9’, ‘com10’, ‘com11’, ‘com12’, ‘com13’, ‘com14’, ‘com15’, ‘com16’, ‘com17’, ‘com18’, ‘com19’, ‘com20’, ‘com21’, ‘com1’, ‘end’]

for device in locations:
serialport = serial.Serial(device, 2400, timeout = 0)
if device == ‘end’:
print “Unable to find Serial Port, Please plug in cable or check cable connections.”