Recent Changes - Search:



edit SideBar


1. We used the motor sensor feedback to control Elmo's arm.

ARM SENSOR OUTPUT: When his arm points straight up (like he's raising his hand), that's 0 degrees, and it shorts red to orange. If his arm reaches backwards (like he's stretching), that's -20 degrees, and it shorts brown to orange. If his arm is straight out in front of him (like a zombie), that's 90 degrees, and it shorts yellow to orange. Lastly, if his arm is down at his side, that's 150 degrees, and it shorts green to orange.

CONNECTING SENSOR TO ARDUINO: We connected the orange wire to the GND output on the arduino. The other four wires each went to input pins. To activate the input pin pull-up resistors, set the pin as an input pin:

pinMode(4,INPUT); // sets pin 4 as an input

then enable the pull-up resistor by writing a "high" to the pin:

digitalWrite(4, HIGH);

To use the feedback signal, we turn on Elmo's arm motor, then "watch" for one of the four wires to be pulled low. Letting his arm rotate forever, we hooked up LEDs to the sensor output and watched them light in sequence as his arm passed each of the four angles (-20, 0, 90, and 150). To test how well we could control Elmo's arm, we wrote some code on the arduino to "teach" Elmo the following routine: 1) begin arm at 0 degrees, 2) rotate down to 90 degrees, then 3) swing back to -20 degrees. This wasn't 100% successful. It would work 90% of the time, then sometimes, Elmo's arm would rotate too far. One possible cause of failure is that we used "switch case" conditionals to watch for the wires being pulled low. "While" loops are more appropriate, but we had trouble implementing them.

2. We tried to implement speed control.

Speed control of a motor is acheived using PWM (pulse width modulation): instead of holding the H-bridge enable pin "high," you send a square wave, and play with the square wave's "high" time (i.e. pulse width), to control the average current delivered to the motor. Smaller pulse width means less average current, which means less torque for the motor, and therefore a slower motor speed.

To use PWM with the arduino, connect one of the PWM pins to the H-bridge enable pin. Configure that pin as an output pin, and send a PWM signal to it:

pinMode(3, OUTPUT); //sets pin 3 as an output pin

analogWrite(3, 125); //output a PWM signal on pin 3 that is high about half the time

//the pulse width is any value between 0 (completely off) and 255 (completely on)

Unfortunately, Elmo's designers gave his motors just enough torque to overcome friction and gravity. Attempting to move his arm at anything less than max speed results in unreliably jerky movements, or simply getting his arm stuck. Looks like we'll have to give up on speed control, unless we completely replace Elmo's motors....

Turning on the motor without PWM:

pinMode(3, OUTPUT); //sets pin 3 as an output pin

digitalWrite(3, HIGH); //output a high on pin 3

3. We finished studying Elmo's electromechanical anatomy.

Elmo has one arm motor, and one leg motor. The leg motor has the same style angular sensor as the arm, though we haven't charted it out yet.

Elmo's unmotorized arm is part of his fur -- lose the fur, lose the arm. But Elmo's unnmotorized leg is attached to his motorized leg by a spring. As the motorized leg rotates, it forces the unmotorized leg to rotate in the opposite direction, allowing Elmo to perform a movement as if he's trying to walk. When Elmo's arm is in the 0 degree position (like he's raising his hand), a gear locks his legs in place. When the legs are locked, the leg motor bends Elmo's torso. That is why his arm is raised everytime he bends over, or when he tries to stand up.

There is one more sensor on Elmo: a gyroscope located in the middle of his back. The gyroscope senses whether Elmo is standing up straight, flat on his back, flat on his stomach, or on his stomach but at an angle (for when he's pushing himself up off his stomach). Unfortunately, the gryoscope cannot sense when Elmo is on his side.


  1. When upright, yellow is shorted to brown.
  2. When prone, red is shorted to brown.
  3. When supine, green is shorted to brown.
  4. When pushing himself up from the prone position, orange is shorted to brown.

4. Since we were moderately succesful at controlling Elmo's arm with feedback, we tried to synchronize two Elmos, first with a push-button switch, than with a wireless "start" command. The result was completely random -- sometimes one Elmo would move, sometimes the other would move, and only once did they both move. Next time, we'll try synchronizing a movement that doesn't rely on feedback.

5. Our goal for next time is to recreate the movements Elmo was originally intended for. Although these movements may not be desirable for the final piece, they are a good starting point for movements that we know are possible. We also need to come up with more reliable code for using the motor sensor feedback.

Edit - History - Print - Recent Changes - Search
Page last modified on September 24, 2008, at 12:33 PM