The Original Keepon Fix
This page describes the first iteration of the MyKeepon Museum Project robot hack. We have since moved on to better methods, but this page is up in case you want to perform the original fix, which involves using the built-in motors from the MyKeepon toy.
MyKeepon has four degrees of freedom (DOFs) using three DC motors. We number these motors arbitrarily:
- rotate clockwise and counterclockwise on a base (motor 1)
- lean left and right; bob up and down (motor 2) - motor two's control is switched between its two DOFs using a small geared rocker mechanism.
- lean forward and back (motor 3)
Here are images of the robot's motors before many of the internal elements were removed:
Because our application only required motion with no external inputs, we removed the microphone and speakers along with the control board and the existing wires to the motors. Because we were going to power the motors externally, we also removed the battery housing and power port. This left a large empty space in the lower half of the base (below the white rim).
We soldered a wire to each lead of each motor and connected the motors directly to an Arduino Motor Shield which is designed for running up to four DC motors. Each pair of wires from the robot's motors was inserted to one set of terminals on the Motor Shield. The Motor Shield was paired with an Arduino Uno board. We powered the Arduino Uno over a USB connection to a computer, and powered each Motor Shield using a 4.5V AC to DC adapter plugged into the wall and wired directly to terminals on the Motor Shield itself. The USB connection to the computer allowed us to send serial commands to the Arduino boards.
To set up multiple motors, each robot needs its own Arduino Uno, Motor Shield, Motor Shield power adapter, and USB A-to-B cable to connect the Arduino to the computer. We also used a USB hub to connect multiple robots to the computer. This image diagrams our hardware setup:
A few pieces of code are necessary to enable communication between the computer, the Arduino boards, and the motors. To start, we followed the excellent tutorial from Adafruit on how to run DC motors using Arduino Motor Shields.
In order to send motor commands from a computer to the Arduinos over a serial connection, we wrote the following Python script that defines a move command. Importing this script automatically opens up a serial connection on the first available port. You can then call "move(int, int, int)" to broadcast move commands over the serial connection.
On the Arduino side, we wrote a sketch that listens on the serial connection and executes the commands that come in by issuing the appropriate calls to AFMotor.