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:

http://daverobertson63.wordpress.com/2013/05/05/updated-robosapien-ir-control-arduino/

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:

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

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

http://www18.zippyshare.com/v/95213422/file.html
mirror here:
https://drive.google.com/file/d/0BwYG1PFb3ZByaTAxMlJZS2pIM1E/edit?usp=sharing

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()
{
  Serial.begin(9600);
}

void loop() {
  while (Serial.available()> 0) {
    data = Serial.parseFloat();
    // Serial.println(data);
    irsend.sendRSV1(data);
    irsend.sendRSV1(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:

http://www.aibohack.com/robosap/ir_codes.htm

Robosapien V2 and other wowwee robots:

http://www.aibohack.com/robosap/ir_codes_v2.htm

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.

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:

Image

Image

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.

http://www.thingiverse.com/thing:63165

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

http://www.thingiverse.com/thing:26599

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 😛

My New Assistant

Well, I finally got an assistant for printing off stuff, and my little hobby projects, and so far, he’s pretty cool but doesn’t do much other than stand around. I’ve been working on getting him for the last week and finally yesterday, everything came together, and now I have my own assistant. 😛

I figured I’d post a pic of us working on a dremel saw stand:

Image

I hope everything works out alright and the arrangement lasts for a while. 😛

 

Anyways, he’s a Mark II, which you can easily find him on thingiverse, and I know that the pieces didnt fit together all the way on mine, but he’s still pretty cool anyways. I just glued him with some high temperature hot glue, which fuses with the plastic and everything for a permanent bond.

Papercraft Robots

I know I havnt posted in a while, and found these and figured I’d share them. I know a bunch of people would love to have thier own johnny 5 robot toy to sit on thier desks, but no real toys were made except the robot V, but I found something that’ll work in exchange. 😛

Here’s your own Johnny 5 robot using papercraft:

http://randyfivesix.deviantart.com/gallery/25829387

And those who are big fans of the movie “The Black Hole” growing up, here’s one for you too, your very own vincent:

http://tektonten.blogspot.com/2011/11/vincent-robot-paper-model.html

http://www.modell-art.de/gast14.php

and here’s the download link for the zip file since the link’s messed up:

http://www.modell-art.de/down/vincent.rar

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 robomoco.py 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 (ben@borglabs.com)
// 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);
  delay_ticks(1);
}
// 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);
   delay_ticks(8);
   // 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)
{
  delayMicroseconds(ticks*bitTime);
}
// 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
    RSIRCommand=0;
    RSBit=0;
    RSIRCommandReady = false;
  }
  if (RSBit<8) {
    RSIRCommand <<= 1;
    RSIRCommand |= bit;
  }
  RSBit++;
  if (RSBit==9) {
    RSIRCommandReady=true;
  }
}
void RSSendCommand(int opcode)
{
  WritePreamble();
  WriteByte(opcode & 0xFF);
  digitalWrite(ctrlPin, HIGH);
  if (RSEcho) {
    Serial.print(opcode);
  }
  delay(INTER_CMD_TIME);    // buffer time before processing next command
}
// Initialize the serial port, GPIO pins and interrupts
void setup()
{
  Serial.begin(9600);
  pinMode(irSignalPin, INPUT);
  pinMode(ctrlPin, OUTPUT);
  digitalWrite(ctrlPin, HIGH);
  attachInterrupt(0,RSReadCommand,RISING);
}
// Main program loop
void loop()
{
  // If a command was received from the IR remote, relay it to the robot
  if (RSIRCommandReady) {
    RSSendCommand(RSIRCommand);
  // otherwise, check the serial port for new commands sent by computer
  else if (Serial.available() > 0) {
    int opcode = Serial.read();
    RSSendCommand(opcode);
  }
}

And here is the link for robomoco.py

http://borglabs.com/projects/robosapien-v2/using_robomoco

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.

Cute robots



My top list of favorite cute robots

PS. The first one isnt from batteries not included as much as we wish it was 😛

Links for PIC based robots

Here’s a few links Ive found that shows basic PIC based robots and how they’re made. There’s also a few PBP example programs to show how to use the language.

http://melabs.com/samples/index.htm

http://www.picbasic.co.uk/forum/forumdisplay.php?f=4

http://www.rentron.com/Micro-Bot/index.htm

http://web.archive.org/web/20041020030528/http://www.geocities.com/SiliconValley/Orchard/6633/robots.html

http://www.cornerstonerobotics.org/picbasic.php