Arduino and the Robot

Overview

The Arduino will be used to send send Infra-Red code to the robots control board rather then controlling each motor due to hardware restrictions of the Arduino.

Background

There has been a small break since the last blog as work has been on getting robot understanding the electronics and configuration. The Arduino is receiving the commands from the Kinect correctly however only receives one byte at a time and now need to send the right command to the robot.

Activity

The Arduino needs to send commands to the robot depending on what the Kinect program has sent to it. The meant linking the robot with the arduino. The robot that has been used in a Robosapien by WowWee Version 1. Based of previous work completed by other modifying the robot the schematics were briefly documented and help to understand how to wire the Arduino to the robot. By hijacking the Infer-Red sensor on the robot, the Arduino board could send IR codes to the robot to control the robot. Due the number of motors on the robot the Arduino would need 26 digital ports to control each motor. As the UNO version Arduino (being used) having only 5 this was not a viable option. The IR codes to send to robot were sourced from Karl Castleton  http://playground.arduino.cc/Main/RoboSapienIR. The image below shows how I have connected the wires from the Arduino to the robot. The Blue wire attached the the IR wire and black to the ground.



The Arduino is based on C and the method to send the IR code to the robot can be seen below. The IROut variable is the pin on the Arudino that will send the IR code that is connected by a header wire the the white wire on the robot.

void RSSendCommand(int command) {
  digitalWrite(IROut,LOW);
  delayMicroseconds(8*bitTime);
  for (int i=0;i<8;i++) {
    digitalWrite(IROut,HIGH);  
    delayMicroseconds(bitTime);
    if ((command & 128) !=0) delayMicroseconds(3*bitTime);
    digitalWrite(IROut,LOW);
    delayMicroseconds(bitTime);
    command <<= 1;
  }
  digitalWrite(IROut,HIGH);
  delay(250); // Give a 1/4 sec before next
}

A small delay is initiated to allow for the command to remain in the same order. Without the Kinect program a delay would be needed between each command however within the Kinect program it only sends a new commend ever 500ms.
The next step is to develop a way to send the command from the Kinect program to the arduino while working with the restriction of only 1 byte being sent at any one time.

Comments

Popular Posts