Brushless motor control with Electronic Speed Controllers.
As opposed to brushed DC motors that can be controlled with an H-bridge (such as the one described in an earlier tutorial), the brush-less DC motors powering the thrusters used in our ROV require the use of an Electronic Speed Controller (ESC). Without getting into the details of brushed vs brush-less DC motor operation, let's just say that brush-less motors require a more complex control system as opposed to the relatively simple H-bridge circuit that can be used with brushed motor designs. This more complex control system is often handled by using an external ESC that is interfaced between the motor and microcontroller unit (MCU). The ESC accepts signals from the MCU which it then uses to control the rotational speed and direction of the motor. ESCs themselves are far more complex than this embarrassingly simple explanation, but it will suffice for now.
The specific model of ESC that we will be using is the AfroESC 30A model. I personally purchased them from Blue Robotics. The documentation provided by Blue Robotics can be found here.. Additionally you can find the documentation provided by the manufacturer here. On a side note, there have been two revisions to this ESC model during the course of the project. My experience relates only to the first two versions with the only noticeable difference on the second version being the physical addition of a heat sink and the removal of the 5v output line (which is not used for our ROV anyway). I currently have no experience with the latest model and therefore can't comment on any operational differences. I would imagine that it essentially works the same as the previous two versions (but so some homework first.)
By reading the data sheet, you will find that the ESC can communicate with the MCU via the I2C and UART serial protocols as well as PWM. We will be using PWM signals as the method of communication with the device. If you are unfamiliar with the PWM module found on the PIC16F1937 MCU (our MCU of choice) you may want to look at the PWM section of my H-Bridge tutorial. Unlike in the H-Bridge tutorial, we will not be using "full bridge" output mode but rather a single PWM output. I will cover this in more detail later in the tutorial.
Controlling the ESCs is very similar to controlling a stepper motor in that they receive a square wave signal and control the speed and direction of the motor based on the pulse widths of the square wave. Specifically, the range of forward and reverse speeds of our thruster motors will be determined by the following PWM pulse widths:
Stopped 1500 microseconds
Max forward 1900 microseconds
Max Reverse 1100 microseconds
The ESC data sheet from Blue Robotics also specifies signal voltage range and maximum frequency of 3.3v-5v and 400 Hz respectively. Additional information can be found in the manufacturers data sheet as well.
Knowing the range of signals required to control the 6 thrusters on my ROV I first went about the construction of a joystick control mechanism and the accompanying code for the micro controller to run the circuit and send the signals to the under water vehicle. We will begin to explore the process of how this was done in the next section of the tutorial.