Camilo Martinez Advisor : Dr. Cris Koutsougeras Dept of Computer Science and Industrial Technology Southeastern Louisiana University
Outline Diagram - Controller Encoders- ME210 & I2C Motor Control Air Flow The Main Algorithm Timeline and Deliverables Questions
Basic Diagram Main Encoder Wind Direction Encoder for Arm1 & Arm2 uController Linear Actuator Arm1 Linear Actuator Arm2 Linear Actuator Arm3 Linear Actuator Arm4 Encoder for Arm3 & Arm4
Mbed uController NXP LPC1768 MCU High performance ARM® Cortex™-M3 Core 96MHz, 32KB RAM, 512KB FLASH Ethernet, USB Host/Device, 2xSPI, 2xI2C, 3xUART, CAN, 6xPWM, 6xADC, GPIO
ENCODERS
Rotary Encoder The relationship between Channel A and B pulse is used to determine the direction of rotation.
ME-210 & I2C communication The ME-210 Unicoder encoder provides one physical interface for transmission of commands and status information: I2C. The ME-201 also provides Speed Wheel velocity Total distance travelled Direction
Some code send[0]='.'; //Sync i2c.write(addr, send, 1); // Send command string send[0]=‘E';//Echo i2c.write(addr, send, 1); // Send command string int degrees=0; send[0]=‘W';//Get Angle return 10 bit resolution angle while(1) { i2c.write(addr, send, 1); // Send command string i2c.read(addr, deg, 3); // read the two-byte echo result int range = (deg[2] << 8)+deg[1]; degrees=((360*range)/1023); pc.printf("degrees = %d\n",degrees); }
MOTOR CONTROL
Linear Actuator
H-bridge & The Sabertooth 2 x25 Sabertooth Input voltage: 6-24V nominal, 30V absolute max. Output Current: Up to 25A continuous per channel. Peak loads may be up to 50A per channel for a few seconds
Standard Simplified Serial Mode Sending a value of will command motor 1 Sending a value of will command motor 2. Sending a value of 0 will shut down both motors. Motor1 Motor2 10x01Forward1280x01Forward 1270x7FBackward2550x7FBackward 650x40Stop1280x40Stop Full Stop00x00
MOTOR CODE int main() { com1.baud(9600); while(1) { wait(1); com1.putc(0x01);//motor A com1.putc(0xFF);//motor B wait(3); com1.putc(0x79);//motor A com1.putc(0x80);//motor B wait(3); com1.putc(0x0); wait(3); }
AIR FLOW Study of air flow on a pole. NASA FoilSim is interactive simulation software that determines the airflow around various shapes of airfoils. The software displays plots of pressure or airspeed above and below the airfoil surface.
Air Flow
AutoCAD
ANGLES
The Main Algorithm Maximum flow is from 20 ° to 160 ° Degrees between division of right and left flow 15 ° Flip up on 355 ° - Flip down on 160 ° Arm1 and Arm2 opposite So Arm2 position is Arm1+180
Read the position of the encoder to determine wind direction Flip front panel to 45° left to 90° back and right to 0° degrees. Calculate maximum gap of wind (between 150° ~160°)
Setting the positions for Arms Arm1=Enc1() If Arm1>=0 and Arm1<180 Arm2=Arm1+180 Arm2=Arm1-180 Read Encoders Return Values
Flip Arms Read Encoders If Arm=160 Flip Arm Down Flip Arm Up Start If Arm=355
Questions ?