Ads 468x60px

  • Sample Text

Circuit Walking Robot Microcontroler

My project is a walking robot. The robot is powered by two NiMH battery packs (four AA cells each). One battery pack will power the motors and the other will power the microcontroller. The voltage level of each battery pack will be monitored individually by the voltage level sensor circuits. When the batteries fall below the preset level, they can be recharged with the onboard battery charger.
The robot uses three servos to control the walking motion and one servo to control the scanning motion of the ultrasonic rangefinder. The rangefinder is used to detect the distance between the robot and an object. An infrared LED and receiver module will detect any drop off directly in front of the robot. The Motorola HCS12 microcontroller will control the various sub-systems and any calculations.
clip_image002
The robots detailed schematic and parts list is included at the end of this document. All references that follow correspond to the designators from the schematic and parts list.
clip_image004
Power Supply
The robot is powered by two NiMH battery packs (four AA cells each). The supply current of the batteries are 1800 mAh. One battery pack (B1) will power the motors and the other (B2) will power the microcontroller. The supply lines are filtered with two 10 µF capacitors (C1 and C2), one on each line. The batteries are connected to the circuit through a double pole, double throw switch (SW1).
The motor supply line includes two fuses (F1 and F2). The fuses are used to protect the motors from drawing too much current if they become stalled. P11 connects the voltage level sensor to the motor battery pack.
The microcontroller battery pack supplies the IR sensor module, the ultrasonic rangefinder and the microcontroller with +5V. P12 connects the voltage level sensor to the microcontroller battery pack.
Servo Motors
The four servo motors (M1-M4) are controlled by the microprocessors (U1) pulse width modulator through the optoisolators (U2A&B and U3A&B). The pulse width modulator (PWM0-PWM3) sends a pulse train to each motor at 55 Hz. R3 – R10 are biasing and current limiting resistor for the optoisolators. The optisolators are used to limit noise to the microprocessor from the motors and to protect the microprocessor from any back electromagnetic force from the motors.
The motors have a 180° range of motion. The degree of motion is controlled by the width of the pulse sent to it from the pulse width modulator. When the optoisolator receives a signal from the microcontroller, the IR LED (LED1) turns on. The LED is optically coupled to the transistor. The output signal is then sent to the motor via the connector pins P1-P8.
clip_image006
Rangefinder
The Devantech SRF04 Ultrasonic Rangefinder is used to detect any obstacles in the path of the robot. The rangefinder utilizes one .1µF capacitor and one 220µF capacitor to filter noise from the supply line. The rangefinder receives a 15 Hz trigger pulse from the pulse width modulator (PWM5). This signal is also monitored by the input capture (IOC0) feature on the microcontroller, which captures the time the signal goes low. The echo return pulse is connected to the input capture (IOC1) of the microcontroller. The input capture of the echo pulse captures the time the return pulse goes from a high to a low, which is used along with the trigger input capture time to calculate the distance to an object.
Infrared Sensor Module
The IR sensor module includes R1, R2, Q1, LED1 and the IR receiver. R1 and R2 are biasing and current limiting resistors for the transistor and IR LED. The transistor (Q1) receives a 40 kHz pulse train from the pulse width modulator (PWM6). Since the receiver module will not work properly with a continuous signal, the cathode of the IR LED is connected to PWM4 and generates a 15 Hz signal to control the amount of time the 40 kHz pulse is applied to the receiver module. This signal is monitored by the input capture (IOC2) which generates an interrupt service routine when the signal is low.
The IR receiver module uses a 4.7µF capacitor (C13) to filter any noise generated on the supply line. The output from the receiver module is connected to Port T3. This signal is monitored once every second to determine if there is a drop off in the robots path. If the signal is high when polled, there is a drop off and the robot will reverse its motion.
clip_image008
Microcontroller
The Motorola HCS12 microcontroller (U1) is used to control all sub-systems (as described above) and make decisions based on calculations. The microcontroller is clocked with a 16 MHz crystal, which is stepped up to 24 MHz bus speed with the phase lock loop circuit. The HCS12 includes an enhanced capture timer, an 8 or 16­bit pulse width modulator, two serial communication interfaces, three serial peripheral interfaces, an inter IC bus (I^2C) and up to 91 I/O lines.
The BDM connector (P13) is used to communicate with the microcontroller and is included for future programming or software updates. The MAX6314 (U4) low power supervisory circuit is designed to monitor the power supply in microprocessor and digital systems. When the supply voltage drops below 4.6V, the MAX6314 will send a low voltage signal to the HCS12 reset pin 42, thus resetting the microcontroller.
Voltage Level Sensors
There are two battery level sensor circuits that work identically. One is used to monitor the motor battery pack and the other monitors the microcontroller battery pack. R14 and R24 (on the motor board) and R6 and R8 (on the microcontroller board) act as a voltage divider. With R24 and R8 being adjustable, the voltage level at which the LED’s begins to flash can be chosen.
The MAX951 (U2 and U3) includes a 1.2 V zener diode as its reference. This reference is compared to the input voltage from the voltage divider circuit (pin 5). If the voltage falls below the reference, the output of the comparator (pin 7) goes low and reverse biases diode (D1 and D2). This allows the other half of the circuit to come into play. R1- R4 (microcontroller board), R9 – R12 (motor board), C1, C2 and the internal op-amps of the MAX951 form a 1 Hz oscillator that drives LED1 and LED2 through R7 and R16, respectively. When the battery voltage level falls below the preset level, the LED of the individual circuit will begin to flash at rate of approximately 1Hz.
clip_image010
Battery Charger
The battery charger will be powered with a 12V, 1A wall transformer. The LM317 (U4) adjustable voltage regulator is used to protect the circuit from damage caused by over voltage. R21 and R23 are used to set the proper output voltage (9V) from the LM317 for charging the four AA battery packs. R15 limits the current to the shunt regulator (V+) to between 5 and 20 mA. The shunt current powers the MAX713 (U1). R18 sets the charging current through the batteries. *PGM0 and PGM1 are used to set the number of series cells to be charged, while *PGM2 and PGM3 determines the maximum time allowed for fast charge. Q1, D3 and R22 are configured for a maximum power dissipation of 2.35 W.