The Walking Creature

Description:

The walking creature is a project that is programmed on the Raspberry Pi to walk on six legs. It lifts one side of its legs at one time in order to maintain forward movement. The walking creature is designed and constructed based on the engineering design process that is followed in the Coder-Maker program.

Learning Objectives:

The walking creature is an automated system that helps students learn and apply the following:

  • Coding, electronics, and physical science through a hands-on application that can be directly related to real life situations
  • Center of gravity and friction
  • The implementation of the engineering design process
  • Application of theoretical concepts to real life situations

Materials Needed:

  • Raspberry Pi with micro SD card and Raspbian
  • Two micro servo motors
  • Jumper wires
  • Breadboard
  • Bendable metal wires
  • Glue gun and glue sticks
  • Cutter blades or scissors
  • Thin sturdy cardboard (poster or portfolio cardboard)

Setup and Functionality:

The walking creature is a 30*20cm project that is made up of cardboard, 2 micro servo motors, and metal wires . It is able to move forward by the action of the 2 motors. One motor is attached to the front and back legs, which are synchronized, and the middle legs are operated by the action of the second micro servo motor. The front and back legs move forward and backward. This ensures forward movement only due to the action of the middle legs is to raise the side where the legs are moving forward to present the whole creature from moving in place. This will allow only the legs that are pushing forward to touch the floor.

_images/image21.png

Figure 1: Picture of a constructed Walking Creature

Circuitry and Electronics:

The diagrams below show all the wiring and connections of all the componenets used in the walking creature:

_images/image34.png

Figure 2: Diagram of the Walking Creature

Warning

The micro servo motor does not consume much current and can be operated directly on the Raspberry Pi 6V power output. Make sure to use the same type of motor as other types might require a current that the Raspberry Pi cannot handle unless a transistor is added to the circuitry or an external power supply.

Programming:

The walking creature is programmed using Python language:

import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
firstServo = 7
secondServo = 10

GPIO.setup(firstServo, GPIO.OUT)
GPIO.setup(secondServo, GPIO.OUT)
pwm = GPIO.PWM(firstServo, 50)
gwm = GPIO.PWM(secondServo, 50)
pwm.start(7.5)
gwm.start(7.5)


try:
    while True:
        pwm.ChangeDutyCycle(2)
        gwm.ChangeDutyCycle(2)
        time.sleep(0.5)
        pwm.ChangeDutyCycle(5)
        gwm.ChangeDutyCycle(3.5)
        time.sleep(0.5)

except KeyboardInterrupt:
    pwm.stop()
    gwm.stop()
    GPIO.cleanup()

Science Concepts and Skills:

The movement of the legs is controlled by the micro servo motors. The degrees of the angle of leg movement are determined by angle of movement of the motor which works by action of pulses known as pulse width modulation (PWM). It is an amount of repeated pulses at a set time intervals, which determine the angle and direction of rotation.

The servo neutral position is considered to be at 90°, from which it can rotate 90° towards the 0° and 90° towards the 180°.

The creature’s center of gravity has to be well determined in order to work properly. By definition, the center of gravity is “the point at which the entire weight of a body may be considered as concentrated so that if supported at this point the body would remain in equilibrium in any position”. In other words, all the weights around a certain point have to be well distributed around the body of the creature in order to maintain a good balance while walking.

Another aspect is friction. The wire-legs are smooth and will keep on sliding in place as they are smooth and no movement will happen. Trying different materials of various roughness (index of friction) will help us determine the material that will provide the best grip leading to the best movement.

Executing the design of the walking creature might be quite challenging. It requires a lot of patience and trial and error in order to get it walk well balanced.