Twolegged selfbalancing System Robert Prinz Mark Kuoppola Tifenn
Two-legged self-balancing System Robert Prinz Mark Kuoppola Tifenn Vialatte Sponsored by UVATT Supervisor: Stephen Neville
Tilt Sensor n n Single axis (1 -D) Output: analog (0 to 5 V) Zero Angle Voltage = 2. 5 V Sensitivity = 35 m. V/˚
H-bridge Motor Speed Controller n n Average voltage across armature changes as the duty cycle changes. Direction of the motor can be changed by switching the polarity of the armature (by switching the corresponding MOSFETs). FORWARD MOSFET State Q 4 ON Q 2 OFF Q 1 PWM Q 3 OFF REVERSE MOSFET State Q 3 ON Q 1 OFF Q 2 PWM Q 4 OFF
Overall System Block Diagram Tilt Sensor MC 1488 A-D converter Serial Cable Serial Input Buffer TTL Serial Data PIC Processor Port C Computer Output process Serial Output RB 7 – RB 4 Arc 1489 LED display Motor Controller Output 1: Duty-cycle Real-time operation Matlab Input 1: Tilt Fuzzy logic controller
Fuzzy Logic Controller Solution 2 (selected for testing) n Solution 1 n Classical inverted pendulum: 2 inputs, 1 output Membership functions: q Inputs: Tilt in degrees, change of tilt q Output: motor duty cycle P Z N P PB P Z Z P Z N NB Similar to fuzzy air conditioning system Membership functions: q Input: Tilt in degrees q Output: motor duty cycle
Fuzzy Logic Controller (Cont’d) Overall controller Layout Membership functions Tilt Motor duty cycle Rules in action
Serial Port Communication +12 V 0 V TTL RS 232 ; RS 232 TTL MC 1488: RS 232 line driver MC 1489: RS 232 line receiver n n n Start 0 1 2 ……. 7 Stop -12 V TTL 5 V 0 V Start 0 1 2 Bit Logic TTL RS 232 0 <1. 2 V >+3 V 1 >3. 3 V <-3 V ……. 7 Stop Bit Interrupt on RB 0 Rotate right through carry
System Path: Overview Tilt A-to-D on PIC Membership functions: initial conditions established Union of fuzzy consequents fired by rules PIC duty cycle values updated then output to motor controller PIC sends tilt value to computer Input to Matlab Fuzzy Inference System (FIS) Union of consequents defuzzified (centroid method) External interrupt input on PIC processor Motor controller H bridge pulsed at duty cycle MC 1488 TTL to RS 232 Converter Serial Data Transmission Received bytes buffer on computer Value read from buffer Output value saved to motor-duty MC 1489 RS 232 to TTL converter Output to RS 232 Serial cable New tilt To beginning
System Path: Input Side n n MC 148 8 PIC 8 -bit resolution Tilt voltage correspond to 8 -bit value between 0 and 255 Converts TTL signal to RS 232 Data stream Tilt variable digital serial data stream generated Comm Serial Cable MC 148 8 Motor Duty Initial Conditions Fuzzy Inference System Tilt value PIC
System Path: Output Side MC 148 9 Serial Cable n RS 232 Signal of motor-duty n Quad line receiver Converts RS 232 to TTL data stream PIC n External Interrupt on falling edge of start bit PIC n n Wheels turn, aligning robot Duty cycle input to transistor controlling the H-bridge Data Comm n n Start bit ignored Data bits sampled and saved
- Slides: 10