ELEC 499B Design Project

Jan – April 2005

Group 3

Two-Legged Balancing System

Progress Report 2

March 7, 2005

To: Kiran Swaroop

Project Coordinator: Adam Zielinski

Team: Robert Prinz 0220135

Mark Kuoppala 0230228

Tifenn Vialatte 0135380

Project Supervisor: Stephen Neville, ECE Deptartment

External UVATT

Organization: University of Victoria Assistive Technology Team

Outline of Final Report

It should be mentioned that the contributions made to each section of the final report are not specific to the person named on the right. Team members aid each other if one has more knowledge about a specific topic than the other, or whenever teamwork is necessary.

The final report will consist of:

1.0 INTRODUCTION (Rob, Mark, Tifenn)

2.0 SYSTEM OVERVIEW (Rob, Mark, Tifenn)

2.1 FUZZY CONTROLLER (Rob)

2.1.1 Inverted Pendulum Fuzzy Logic in Matlab (Rob)

2.1.2 Fuzzy Inputs and Outputs (Rob)

2.1.3 Fuzzy Sets (Rob)

2.1.4 Fuzzy Rules (Rob)

2.1.5 Fuzzy Logic Controller for 2-Legged Balancing System (Rob)

2.2 Control system hardware (Mark)

2.2.1 Fuzzy Controller to USB Interface (Mark, Rob)

2.2.2 Host Computer to Machine Interface (Mark)

2.2.3 Microcontroller (Mark)

2.2.4 Speed Controller (Mark)

2.2.5 Controller Feedback Signals (Mark)

2.2.6 Motors (Mark, Rob)

2.3 CONTROL SYSTEM SOFTWARE (Mark)

2.3.1 Fuzzy Signal Processing (PWM) (Mark, Rob)

2.3.2 Velocity Signal Processing (Mark)

2.3.3 Tilt Signal Processing (Mark)

2.4 Mechanics (Tifenn)

2.4.1 Mechanical Model (Tifenn)

2.4.2 3D Model of the table (Tifenn)

APPENDICES

A. Microcontroller Software (Mark)

B. Fuzzy Logic Matlab Fuzzy Sets, Rules, and Software (Rob)

2.0 SYSTEM OVERVIEW (Rob, Mark, Tifenn)

Block diagram of control system was drawn.

2.1 FUZZY CONTROLLER (Rob)

2.1.1 Inverted Pendulum Fuzzy Logic in Matlab (Rob)

The classical inverted pendulum project, which is included as a demo in Matlab 7, formed the initial basis of the fuzzy logic controller for this project. The ability to balance the upper body weight by moving the legs below it directly parallels this demo. The sensory input consisted so far of only one tilt sensor as that is all we have available at the moment.

2.1.2 Fuzzy Inputs and Outputs (Rob)

The fuzzy input variable thus far includes a virtual tilt sensor placed on the body of structure to determine the tilt of the entire body. The legs move in unison still a this point and so no more than one tilt sensor is required as of yet.

The fuzzy output variable includes

2.1.3 Fuzzy Sets (Rob)

The fuzzy input set includes greatly titled forward, slightly titled forward, just right, slightly titled backwards, and greatly titled backwards.

The corresponding fuzzy output set includes drive quickly forwards, drive slowly forwards, stop, drive slowly backwards, drive quickly backwards.

These fuzzy sets produce the fuzzy patches required for defuzzification. The method of defuzzification selected is the centroid method. This method was selected for its familiarity and simplicity.

2.1.4 Fuzzy Rules (Rob)

The fuzzy rules simply associate the input variable, tilt, to the output variable, drive. The associations are correspondingly outlined above in the fuzzy sets section.

2.1.5 Fuzzy Logic Controller for 2-Legged Balancing System (Rob)

The fuzzy logic controller thus far only produces the output for an inverted pendulum system. More time was spent on hardware and interfacing considerations than expected. Motor selection came late as the source identified became unreliable, and so tuning of the fuzzy sets to actual physical motors was greatly delayed. The fuzzy controller for split leg walking is in development. The controller system should be tested with the hardware at this point to allow for tuning of the fuzzy sets. This is critical before trying to get the split leg walking incorporated into the project. Ultimately, the fuzzy controller may be able to simulate this in Matlab, but time may not allow for split leg walking to be constructed physically in this term.

2.2 Control system hardware (Mark)

Each of the main hardware sections are explained below. Most of the components have been ordered; the tilt sensor is not critical to have now since a dummy can be used to produce a similar signal.

2.2.1 Fuzzy Controller to USB Interface (Mark, Rob)

If Matlab 7.0 doesn’t directly communicate with the USB port then creation of a “mex” file in Matlab will allow for use of a MS Visual C program that interfaces with the USB port.

2.2.2 Host Computer to Machine Interface (Mark)

RF04 and CM02 wireless transceiver pair will be used; one end will have a direct connection via USB cable to the USB port on the host computer. The other end will use I2C communication protocol to communicate with the PIC microcontroller.

2.2.3 Microcontroller (Mark)

A PIC16F876A microcontroller was chosen.

2.2.4 Speed Controller (Mark)

An H-bridge dc chopper is currently being built. The H-bridge provides for PWM signal to the motor. It separates the high power circuit from the low.

2.2.5 Controller Feedback Signals (Mark)

The tilt sensor CXTLA01 by Crossbow Technology Inc. was chosen. Its output ranges between 0 to 5V. This signal will be an analog input to the microcontroller and must be digitized and sent to the RF module, which will transmit to the host computer, namely, the fuzzy controller.

2.2.6 Motors (Mark, Rob)

The motor is the deciding factor for required specifications of most of the other hardware. A 12V electric drill dc motor was chosen because of its cost, size, and speed and torque ratings.

2.3 CONTROL SYSTEM SOFTWARE (Mark)

A PIC16F876A microcontroller is used for

·  Real-time updating and processing the fuzzy control signal

·  Real-time processing of controller feedback signals (from tilt sensor and encoder) so that they can be sent to the host computer in the correct format

The current short term goals are below:

Task / Status
Program on-chip A/D converter / Complete
Use RS-232 communications to ensure accurate values are being stored from the A/D conversions / In progress
Implement timer interrupt to obtain periodic A/D samples / In progress
Implementation of decision rule array / In progress

2.3.1 Fuzzy Signal Processing (PWM) (Mark, Rob)

Determine how to convert incoming signal from fuzzy controller on host computer to a Pulse Width Modulated (PWM) signal for motor control.

2.3.2 Velocity Signal Processing (Mark)

Determine the tasks required to perform velocity signal processing. Quadrature signals X and Y will be inputs to microcontroller. Edge detection will be used to determine direction of motor, and period of the signal, which corresponds to speed, will be found. A signal that contains both direction and speed will be processed and sent to the RF module via I2C port. We may have to use count multiplication for better resolution of the encoder.

2.3.3 Tilt Signal Processing (Mark)

Determine the tasks required to perform tilt signal processing. The output of the Crossbow tilt sensor ranges between 0 to 5V. This signal will be an analog input to the microcontroller and must be digitized and sent to the RF module via I2C port.

2.4 MECHANICS (TIFENN)

2.4.1 Mechanical model

A system of equations describing the 3D mechanical system was developed using Mathcad, to ensure the motors would provide enough torque and get proper size and weight distribution for the system.

2.4.2 3D model

A 3D model of the system was made using Solidworks. The model is used to simulate the action of the motors, as well as provide drawings for the machining. It also allows for ensuring tolerances for the motors are respected.

2.4.3 Material choice

The materials chosen for the table are steel and aluminum: steel will be used for its strength, low price and easiness to weld, and aluminum will be used for the part where weight is important. It is also easier to machine.

2.4.4 Machining

Arrangements have been made to fabricate the structure.