User:1sfoerster/enes100/Tri-BotHack

Day 1


There are three separate motors with encoders to count shadows (see the black wheel under the circuit board).



The wheels are similar to those on R2-D2:

The wheels have to be taken off first.



There are two circuit boards, one looks dedicated to the motors and the other to the rest of the robot.

The robot runs off 8 AA batteries that are housed in the base of the robot in-between the motors providing an excellent low center of gravity. There is a push button switch near the batteries that turns off and on the robot. So no work is needed here.

Looking for hacks, found this first which describes how to control the motors, but not how to look at the encoders. Appears the encoders are flashing 12 volts, not 5 volts.



The first step is to cut the cables connecting the base to the head. Power is in the base with the wheels, so nothing is lost. The brown/red lines will supply power to the arduino. The ribbon cable will enable the arduino to control the motors.

The black above the red is where the motor controller is housed in the base of the robot. It is barely fits into the housing.

Day 2


The first step was to sand off the pads on the current cpu of the motor controller. This was done with a dremel with a sandpaper tip put on it. This went very fast. Be careful to sand too much off in the future.



The input to the controller was from the head of the robot through the cut off ribbon cable. The output if the controller was to the rest of the board.

The black stuff helps dissipate heat from the controller chip which is underneath the black stuff. The black stuff enables the controller to be made smaller.

The controller is on a separate circuit board than the rest of the motor controller. The sanding job did not threaten the structural integrity of the rest of the circuit board.



The ribbon cable was reused.

Resistors were sacrificed in order to provide good electrical connection into the headers of the arduino.

Shrink wrap was used around the soldered joint between the resistor lead and the thin stranded wire in the ribbon cable.

On the mother lend of the stranded stable was tinned.

Resistor leads were also soldered onto the power leads that went from the motor controller board up to the head. This cable is going to be re-routed to Vin and Ground of the arduino.



The ribbon cable was soldered onto the motor controller.

The upper left corner of the old cpu is angled. This helps orient ourselves. There are 5 solder pads horizontally on the top and bottom. There are 4 solder pads on the two vertical sides. Let's call pin 1, the first pin going counter clockwise around the edge of the bold cpu. Starting at pin one, this is what the colors of the ribbon cable mean according to the web site mentioned above:


 * white, gray and purple are motor direction controls ... arduino tells robot what to do through these wires
 * blue, green, yellow are motor on off controls .. arduino tells the robot what to do through these wires
 * brown, red, orange are the encoder outputs of the motors .. information to the arduino



The first step is to power up the robot while disassembled and test everything. The test steps were:


 * download blink to the arduino
 * apply robot power to the arduino and see if blink still works
 * turn motors on with the blue, green, yellow wires sequentially by plugging them into arduino pin 13

This was done and the motors turned as the LED attached to pin 13 on the board of the arduino blinked youtube video.

Day 3


Ribbon cable resistor leads were cut so they have no chance of touching each other when plugged into arduino.



Wheels were numbered staring at the front (opposite the power switch), left is 1, right is 2 and the back wheel under the power switch is 3.

Matched ribbon cable colors of enable to the motor numbers:
 * enable 1 - yellow
 * enable 2 - green
 * enable 3 - blue

Matched ribbon cable colors to spin direction. All spin clockwise (cw) when open or grounded. When the direction pins are plugged into 5 volts they spin counter clock wise (ccw).
 * ccw 1 - white
 * ccw 2 - gray
 * ccw 3 - purple

Hooked voltmeter up to the encoder pins ... perhaps 20 mV change. There are three wires coming from each encoder to the encoder board. The middle wire in each case is connected to the ribbon cable brown, red and orange wires. Assume the other two are power to the encoder. First checking to see if the encoder is still getting power. Can not see power into the encoders.

There are three encoders, each has an outside brown, and outside orange wire. The inside wire colors differ: red, back and green. Working on the red wire which goes to motor 3. Perhaps it is working, the shadows are running so quickly that the voltmeter can not respond and power is only delivered to the encoder on as needed basis, or is current based. Hooking to oscilloscope. Can not see TTL information coming from the encoders. The encoder wires go straight to the digital chip that was taken out of the circuit with the Dremel sandpaper.

Problem: No power appears to be going to the encoders, no information is coming back from the encoders.

Possible Solutions:
 * find 5 volts on the motor controller board, send to encoder, look at response.
 * find 12 volts on the motor controller board, send to encoder, look at response.
 * chase where the power is suppose to be coming to the encoders
 * work separately with existing encoder outside the case

Testing with outside the base motor. Applying 5 volts to outside orange and ground to the outside results in the middle wire having 5 volts when the coder is open and 0 volts when it is blocked. Can not find 5 volts on the motor controller board. Encoders also run on 12 volts. Encoder is running around 100 ohms. Will draw .12 amps each or about .36 amps .. which will draw down the batteries quickly. At 5 volts, will draw .15 amps total. Motors are running off .18 amps total if all on. Probably the encoders where turned on by the head only when necessary.

Arduino has 5 volt coming out! Can run a cable between it and the the 5 volt line to all three motor encoders.

The three encoder cable bundles from the three motors are all connected on the motor controller circuit board next to each other (see three circles). The grounds are all connected and actively connected to ground (column 3). The 3 power lines (column 1) to the three encoders are all connected to each other, but to nothing else. There is a solder pad at the top for power that a red wire was soldered to. The middle (column 2) runs separately to the ribbon cable colors orange, red and brown.

In the current configuration, power runs from the 12 volt battery pack, to the motor controller, then to the arduino where it is converted to 5 volts. Then the 5 volts are feed back to the motor controller circuit board to power the encoders. If not using encoders, don't connect the other end of the cable to the arduino 5 volt line. This will save batteries.

The encoders are:
 * encoder 1 - orange
 * encoder 2 - red
 * encoder 3 - brown

The encoders average 2.5 volts when the encoder wheel is moved by hand. When stopped, either read 0 volts or 5 volts.

Day 4


Goal is to repeat previousokay success with existing WowWee and mount the arduino.

It was thought that the wheels had to be removed first, but they don't. The hub caps can be popped off if the wheels need to be removed. However the wheels don't even need to be removed.



The first step is to remove the breast and expose the motor controller. This is done by removing screws on the sides between the arms and hips. There are more screws on one side than the other. The motor controller can be seen inside the hips. The component side of the motor controller faces the back of the tribot.



The second area is to remove the chest. Inside the chest is the head controller. The black handle in the back of the tribot does not come off. The chest plate does not come off. The sides of the chest pull apart in the front and separate. The cables to the arms in the picture are to infared sensors. There are no motors controlling the arms.

The cables to the arms do not need to be cut. The cables going up into the head need to be cut. Leave as little cable attached to the head controller as possible. Make the cables coming down from the head as long as possible. Be careful cutting the wires. Carefully pull out the speaker wires from the wiring harness.

The head can be taken off and put back on easily. There is a tiny controller circuit board that manages the LED's and eyebrow movement.

The face itself is taken off to see the possibilities of led's being turned on by the arduino. There are led's for eyes, there is an LED that pops out of the top of it's head, and there are led's down around the mouth.

The black plastic piece inside the head mates with the back of the face to cause the eye brow movement.

The top of the tribot head can be pushed down to trip a switch. The switch is the white piece of plastic that is either at a 45 degree angle when the head is up, or is verticle when the head is pushed down.

There are two white wires attached to this switch. These could be run to the arduino to add a mechanism to turn off the robot, reset the software, or pause the software instead of pushing the power switch.



The head controller is held on by four screws. The vertical distance between the screws almost matches two mounting holes in the arduino. Two of the screws can be used to mount the arduino on the tribot's back.

The goal is to run the ribbon cable, the 12 volt power cable up to the arduino and the 5 volt power down from the arduino to the motor encoders. There is a cable channel that requires soldering ends that plug into the arduino after the cable has been put into the channel. This way the hips can be replaced so that the motor controller is not exposed.

There is no reason to try and put the arms and chest back on the tribot. The only electronics in the arms and chest are the IR sensors and the speaker.

Next the motor controller needs to be taken out of the black hip support. The hips are held together with at least 7 screws of at least 3 types. The hips came apart very easily, but do not appear to be easily assembled. This is the most important stage. Not enough information was captured here to explain what all the issues are.

At this point the day two soldering was repeated. It looks like the ribbon cable length is just long enough to reach the arduino ... but this hasn't been tested yet.

Day 5


Put cable in tray, soldered ends on the cables from motor and head, assembled the hips, put arduino on, had problems with cables from the head getting pressed into the pins sticking out the bottom of the arduino. Had to open up the spinal column and re-route cables from head. Took apart the head and torso twice to accomplish this.

Hooked one cable from the switch to the arduino and then hooked the other end of switch to pin 12. Ran the button program. When pin 12 was pulled to 5 volts, button program definately lit up the onboard LED. But turned off at random. Moving hand in the air near the arduino acted like a bad infared receiver with the button program randomly turning the LED off and on.

Then hooked three motors to the arduino and tried to get all three turning at once. Could not. Had strange pulse when initially powering on with the WowWee batteries. LED on the arduino would blink and the wheels would not turn. Replaced the batteries and two out of the three wheels would turn when running off batteries. But all three would turn (slowly) when running off USB power. All three would turn rapidly when both USB power to the arduino and batteries of the Tribot were turned on. This suggested a grounding problem.

Ran a cable from the battery ground to the arduino with the red wire already mentioned and all three wheels turned, just running of the batteries. Battery ground was identified by looking for a two wire cable coming up from the motors/batteries at the bottom, thicker than most of the wires and colored red and black.

The red and black were spliced with blue and black cable. The black and blue power cable was run up to the arduino. Now all three motors spin. The initial light blinking start up is still going on.

Hooked a 10K pull down resistor to the switch and the button program works now with the head. In photo can see the 10K resistor, the 5 volt line going to the head switch, the return wire from the head switch going to the 10K resistor which is plugged into ground. There is another white wire going to pin 3 from the top of the resistor that is going to be pulled high by the switch, and then pulled to ground by the resistor.

Established a color standard for the arduino pins to be used in software. The first three are motor on, next three motor enable, third three motor encoder.
 * 12 yellow (ribbon)
 * 11 green (ribbon)
 * 10 blue (ribbon)
 * 9 white (ribbon)
 * 8 gray (ribbon)
 * 7 purple (ribbon)
 * 6 orange (ribbon)
 * 5 red (ribbon)
 * 4 brown (ribbon)
 * 3 white (head switch)

Wrote a /MotorTest/ the spins tight the robot CCW, CW, forward, backward, spins one motor at a time. Backward doesn't work and CCW lurches all over the place. Think that motor direction 1 (pin 9 is not working). Checked connectivity between arduino and motor controller and there were no problems. It is possible that the robot may not have a direction control on the robot right wheel. Only two wheels are needed to do everything. May have to wait until build another to see if all three motor direction controls work.

Day 6
Used old robot was originally working on, added wheels, head, duplicated the switch functioning. Problem with motor 1 was fixed by correcting bugs in the software. Was changing the direction of the motor after it was turned on. Have to change direction before turning on the motor. Modified the program so that all demo programs are exercised after the head is pressed.

youtube video

Added cable so that 5 volts goes to head and the encoders.

Wrote this program to test the encoder: /EncoderTest/. Expecting the pin 13 LED to blink four times for each wheel revolution and then pause for two seconds either off or on. LED starts off, wheel starts to spin and the LED stays on no matter what. Edited the program, and can see changing high to low, but not detecting four or more transitions per revolution. Goes high or low after motor pauses for 2 seconds. Possible Solutions:
 * experiment with code
 * hook up scope
 * add pull down resistors

Day 7
Hooked up [Digilent EE board] running Wave Form software to look at the pulse train coming from the wheel 1 encoder. Looks like a pulse width of .25ms. So the encoder is spinning much faster than the motor .. about 2000 times per revolution of the wheel.

So now the goal is to count three encoders simultaneously. Found this [web site] that looks uses interrupts of the amtel chip on the arduino. Can get encoder to flash numbers on screen, but looks like it is a two wire encoder. The ball bot has one wire encoders. Running /Encoder1/ this software (modified to turn on motors in void setup) can get 0 1 0 1 pattern for motor 2 and 0 -1 0 -1 patter for motor 1. So trying something else. Looking at encoder code on the arduino playground. All the code is comparing two pins before incrementing a counter.

Next Steps

 * keep working on the software to demonstrate the switches and encoders
 * design mounting mechanism for switches