100 likes | 564 Views
Two-legged self-balancing System. Sponsored by UVATT Supervisor: Stephen Neville. Robert Prinz Mark Kuoppola Tifenn Vialatte. Tilt Sensor . Single axis (1-D) Output: analog (0 to 5V) Zero Angle Voltage = 2.5V Sensitivity = 35 mV/˚. H-bridge Motor Speed Controller.
E N D
Two-legged self-balancing System Sponsored by UVATT Supervisor: Stephen Neville Robert Prinz Mark Kuoppola Tifenn Vialatte
Tilt Sensor • Single axis (1-D) • Output: analog (0 to 5V) • Zero Angle Voltage = 2.5V • Sensitivity = 35 mV/˚
H-bridge Motor Speed Controller • 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).
Tilt Sensor MC 1488 Serial Cable Real-time operation Matlab Serial Input Buffer A-D converter TTL Serial Data Input 1: Tilt PIC Processor Computer Port C Output process Fuzzy logic controller Output 1: Duty-cycle Serial Output RB7 – RB4 Arc 1489 LED display Motor Controller Overall System Block Diagram
Fuzzy Logic Controller Solution 2 (selected for testing) Similar to fuzzy air conditioning system • Membership functions: • Input: Tilt in degrees • Output: motor duty cycle Solution 1 Classical inverted pendulum: 2 inputs, 1 output • Membership functions: • Inputs: Tilt in degrees, change of tilt • Output: motor duty cycle
Fuzzy Logic Controller (Cont’d) Overall controller Layout Membership functions Tilt Motor duty cycle Rules Rules in action
Serial Port Communication +12V 0 V -12V Start 0 1 2 ……. 7 Stop • TTL RS232 ; RS232 TTL • MC1488:RS232 line driver • MC1489: RS232 line receiver TTL 5 V 0 V Start 0 1 2 ……. 7 Stop Bit Bit Interrupt on RB0 Rotate right through carry
System Path: Overview PIC sends tilt value to computer MC 1488 TTL to RS232 Converter A-to-D on PIC Tilt Serial Data Transmission Membership functions: initial conditions established Input to Matlab Fuzzy Inference System (FIS) Received bytes buffer on computer Value read from buffer Union of consequents defuzzified (centroid method) Union of fuzzy consequents fired by rules Output value saved to motor-duty Output to RS232 Serial cable MC1489 RS232 to TTL converter External interrupt input on PIC processor PIC duty cycle values updated then output to motor controller Motor controller H bridge pulsed at duty cycle New tilt To beginning
Tilt value System Path: Input Side PIC PIC MC 1488 Converts TTL signal to RS232 Data stream Data Comm • 8-bit resolution • Tilt voltage correspond to 8-bit value between 0 and 255 Tilt variable digital serial data stream generated Serial Cable PIC MC 1488 Motor Duty Initial Conditions Fuzzy Inference System
System Path: Output Side MC 1489 PIC Serial Cable • Quad line receiver • Converts RS232 to TTL data stream • External Interrupt on falling edge of start bit RS232 Signal of motor-duty PIC Data Comm • Duty cycle input to transistor controlling the H-bridge • Start bit ignored • Data bits sampled and saved • Wheels turn, aligning robot