Must have for raspberry pi media center

Must haves if you use Raspberry pi as a media center:

Yatse: android app for using an android tablet/phone as at tv remote for xbmc.

http://www36.zippyshare.com/v/41818295/file.html

OpenElec: best xbmc system Ive found on the raspberry pi.

http://openelec.tv/get-openelec/download/viewcategory/10-raspberry-pi-builds

tubeplus plugin: greatest plugin ever for xbmc, allows you access to almost every movie and tv show from around the world for free. It searches the web for links for various sites like putlocker and such that match the show you’re looking for and streams it directly to the raspberry pi.

https://github.com/anilkuj/xbmc-addons/tree/master/plugin.video.tubeplus

just click the zip button and save it to a thumb drive or whatever, then goto settings, addons, install addons from zip file, and point it to that zip file. after a few mins, it’ll install and you’ll be able to access it under the main menu by going to video, video plugins, tubeplus

Advertisements

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.