A control platform system is to be designed to aid the gun targeting of the warship to stay in the same direction, irrespective of sea condition and ship level, which the ship is in. This is to improve the accuracy of the target aiming from a moving platform. This project requires knowledge of control and some analogue, digital interface to be able to read the position of the gun-platform and adjusting the gun position to compensate the errors produced.
- Find the position of the gun-platform
- Design the suitable controller
- Translate the controller into difference equation to be programmed or using the PID algorithm
- Feed PWM to motor
- Design the overall hardware
There is two part to this project. First part requires digital interface for reading the position of the gun via accelerometer. The second part is to build the controller which involves control theory for finding the transfer function of DC motor. An improvement to the project, was to display the actual position, desired position and the error.
- Accelerometer - 6 DOF IMU were used for detecting the position of the gun. All the data acquisition was done in the I2Cdev.h library and for reading the tilting angle; MPU6050.h library were used.
- ATMega328 micro-controller chip - The Arduino Uno were built on the breadboard for better accessibility to the pins
- L293D H-bridge - For controlling the direction of the motor and the speed
- Encoder - The position of the motor is read via feedback control from an encoder (100:1 gear ratio encoder motor) that generates pulses depending on the direction of the motor which is detected by interrupt.
- Manual control - A potentiometer were used for this. This was not in the initial design but during prototyping stage. The problem faced with the motor was it always started at zero. Therefore, a manual input were designed so that it can be controlled to the desired position.
- Software - Matlab, servoCad and Arduino 1.0.5
The main concept of merging the codes together were to look at the error produced from the sensor reading and potentiometer reading. Calling it as the desired value and the encoder value as the current value.