Here’s a silly project! 🙂
The original version 1 Robosapien toy robots are a dime a dozen now, and can be commonly be found at thrift stores, garage sales and the like. Even though they are “old”, they actually make a really great beginner platform for Arduino/microcontroller hacking.
The designers made it actually very easy to hack, and the most common way is to simply simulate the hand-held IR remote with a microcontroller. (Don’t forget, you don’t actually need the remote for hacking purposes. Robosapiens are very cheap if it’s “missing”!)
The “simulated remote” method is great since there’s no motor, mechanical, or complex electrical interfaces needed. (other than two wires!) Any function on the hand control can be easily emulated by a board like an Arduino, and the hand control has literally dozens of functions covering movement, actions and sounds.
In this example, we’re using the Arduino-compatible LEDuino board, and leveraging the LED display to show the analog input values being returned from the Sharp IR distance sensors that have been mounted on the robot.
The huge benefit of this display method is that you can watch the analog values change from up to ten feet away, which is an incredibly handy debugging feature! A typical LCD display would be too cumbersome, and simply too hard to read in a situation like this.
The photo below shows the LEDuino, battery, and two L/R Sharp IR sensors on a little “tray” on the rear of the robot, and another longer range Sharp sensor facing forward. The yellow and black wires are the only connections to the Robosapien! (You may read elsewhere that the Robosapien runs at 3.3V, thus requiring a voltage divider circuit, but using a direct 5V output from the ATmega didn’t seem to effect it in any way…)
The hook-up is fairly simple:
- The black wire is a ground, the yellow is Arduino D2 (digital I/O number 2), going to the Robosapien control board IR input header.
- The front Sharp IR range sensor is connected to Adruino analog input 5 (A5). Using: ground, 5V, and signal
- The right-hand Sharp IR range sensor is connected to Adruino analog input 6 (A6). Using: ground, 5V, and signal (yes, there is an analog 6 and 7 if you use the 32-pin TQFP ATmega MCU! 😉 )
The Arduino sketch has three primary functions; update the LED display, monitor the Sharp IR distance sensors, and transmit simulated IR codes to the Robosapien.
The sketch included here is quite crude. It watches (and displays) the value returned from the front sensor, and when it reaches 450 (higher number is closer), it stops the robot and initiates a left-hand turn, watching, and displaying the right-hand sensor value to see if there is a descending trend, which means that we have passed perpendicular, and are now turning away from the wall, and it’s safe to move forward again.
The corresponding Arduino sketch is here: LEDuino_Robosapien.pde
This Robosapien walks a bit like a drunken sailor, and tends to veer to the right, but it works fairly well regardless! The video below shows the complete run from the start. Notice how the display appears to “count up”. That is actually the A/D value of input A5, as provided by the front Sharp range sensor. The closer you get to an object (the wall!) the higher the voltage is returned.
When it stops near the wall based on a front-sensor A/D value of 450 (about a foot away), it then enters a loop which it turns left for one second, then stops to re-check the right-hand distance sensor. (the super-wobbly L/R Robosapien movement would probably mess-up the readings on the fly) If the right-hand sensor A/D value starts to drop, that means it’s now safe to start forward again.