This project documents how to build and construct your own Brushed Motor ESC for Cars and Boats using a Microchip 12F675 PIC and a small number of standard components.
This ESC is an extension of an earlier aircraft ESC and the reader is referred to the earlier ESC for full details of the design.
This ESC grew out of an earlier aircraft ESC. A number of people asked for an ESC with brake and reverse operations that were suited to Car and Boat operations. While the earlier design provided basic reverse facilities I decided not to extend the aircraft design, but rather to revise the design and produce a project targeted specifically at cars and boats.
This ESC operates in a very similar manner to the Team Tekin "Rebel 2" ESC and offers all of the key features of the earlier aircraft ESC as well as push-button programming.
A futher requirement was the desire to be able to use either a relay or an H-bridge to provide motor reverse. This project incorporates both options.
This ESC design offers the following features that are fully explained in the aircraft ESC documentation:
- Safety startup, requires throttle be off to arm ESC.
- Signal loss stop, stops motor on loss of valid signal.
- Low voltage cutoff, stops motor on low battery voltage (optional, not available on H-bridge version).
- Variable rate PWM output to reduce noise a low speeds and increase efficiency at high speeds.
- Programmable throttle response curves with two sample curves.
- Slow start to protect gearboxes.
- Brake, either hard or soft (optional).
- Accurate throttle pulse width measurement.
- Accurate software PWM with rates between 7.6kHz and 2kHz.
- 64 motor speeds for smooth speed control.
In addition the following features are specific to this ESC:
- Push-button configuration of throttle range, brake, etc.
- Configurable brake time prior to switching to reverse, between 0 and 5 seconds.
This ESC has a push button and LED that permit the ESC to be configured. The configuration is stored in the EEPROM on the PIC and will stay set until reconfigured.
The configuration system permits the configuration of the throttle range, the brake to reverse delay, and also the disabling of the reverse function.
Important NoteOn power up the ESC will not arm until the throttle is in the neutral position. It is possible to perform throttle configuration during this time using the configuration system (see below). The ESC also requires the throttle to be in the neutral position to rearm the ESC after:
- Loss of receiver signal;
- After using any of the configuration modes.
It is almost certain that you will need to perform throttle configuration the first time that you use the ESC. This is because it is very unlikely that the factory default options in the ESC will match your radio control unit.
Status LED (Relay version)The status LED is ON whenever the brake is active, and off at other times. The status LED is also used during configuration (see below).
Status LED (H-bridge version)The status LED is ON whenever the ESC is in reverse, and off at other times. The status LED is also used during configuration (see below).
Configuration of the ESC
Brake to Reverse Delay
To set the brake to reverse delay period press the 'program' switch and keep it pressed for the delay period required and the release the button. When the button is first pressed the LED will start to flash on and off rapidly. The maximum delay time that can be configured is approximately 5 seconds, after 5 seconds the LED will show a short on flash and a long off flash. If the button is released during this time the maximum 5 second delay is configured.
To disable reverse in the ESC press the 'program' button and keep it pressed. At first the LED will flash on and off rapidly. Then, after about 5 seconds the LED will change to a short on flash and a long off flash, keep pressing the burron. After another 5 seconds the LED will alter to a long on flash and long off flash, now release the button.
To configure the throttle first ensure that the throttle is in the neutral position.
Press the 'program' button and hold it down. At first the LED will flash on and off rapidly. Then, after about 5 seconds the LED will change to a short on flash and a long off flash, keep holding the burron down. After another 5 seconds the LED will alter to a long on flash and long off flash, keep holding the button down.
After a further 5 seconds the LED will return to flashing on and off rapidly, release the 'program' button.
The LED will continue to flash on and off rapidly. Pull the throttle to the full forward direction and hold it there for a few seconds and then return the throttle to the neutral position.
The LED will change to flashing with a long on and long off, this indicates that the forward throttle settings have been configured. Push the throttle to the full brake/reverse position and hold it there for a few seconds and then return the throttle to the neutral position.
The LED will stop flashing and the ESC's throttle settings are now configured.
Software Development Environment
This software was developed with the MPLAB IDE from MicroChip.
If you plan to use this ESC design and build one yourself you will need to download the MPLAB IDE. There are too many ESC options for all the versions to be available on this Web page. With the earlier aircraft design I provided a few 'common' versions of the software, however, with this ESC I have assumed that anyone building the ESC will select the options and assemble the code for themselves.
After you have installed the MPLAB IDE proceed as follows:
- Create a directory somewhere on your Windows system. the MPLAB IDE does not like path names that are too long (greater than 30 characters or so) - so stick to a simple short name. For example: C:\PIC\CarESC
- Copy the caresc.asm, linear.inc and power.inc files from the links below into your diectory.
- Start the MPLAB IDE.
- Select Project->Project Wizard.
- Click Next.
- Select 'PIC12F675' as the device, click 'Next'.
- Select 'Microchip MPASM Toolsuite' as the Active Toolsuite, click 'Next'.
- Enter a name for your project and then use the 'Browse' facility to set the Project Directory to the directory you created at the first step, click 'Next'.
- Add the 3 files that you copied to the project directory to the project by double clicking each file name in the left hand pane, the files will appear in the right hand pane. Do NOT check the boxes next to the files. Click 'Next'.
- Click 'Finish'.
- The workspace will open and you will see a project window that shows one Source File and two Header Files.
- You should now be able to assemble the PIC code by pressing F10 - this will produce a file called 'caresc.hex'.
- To alter the paramaters double click on 'caresc.asm' in the project window and the assembler source will now appear in a new window, make the changes you require in this window.
- After you have made you changes press F10 to assemble the code.
The MPLAB IDE has full support for simulation that permits you to fully check the operation of the ESC. However, the use of these facilities is beyond the scope of this document. Users who just want to build a 'custom' version by modifying standard parameters of the ESC should have no problem just using the IDE to assemble the code.
The ESC Software
The PWM Engine Generator
This ESC uses a software PWM engine that is machine generated by a Perl program. The source code for this program is available as part of the earlier aircraft ESC. Please consult the other document for details.
Main ESC module
The main ESC module contains all of the ESC application, with the exception of the PWM engine file. This source file contains a number of constants at the top that you can modify so suit your application.
Linear PWM engine
A linear (ie. throttle position proportional to percentage duty cycle) PWM include file is available that implements the 'basic' ESC.
Power PWM engine
A power (ie. throttle position proportional to engine power) PWM include file is available.
ESC Software Options
This ESC has a number of options that you can configure prior to programming the PIC. These options include:
- Enable or disable the push button configuration option (default is enabled);
- Select either relay or H-bridge for reverse (default is relay);
- Enable or disable slow motor start for forward and reverse (default is fast motor start);
- Select the brake mode as either no brake, brake on/off at 100%, brake on/off with a slow brake application (the default), or proportional brake;
- Low voltage curoff point (default is disabled);
- Relay changover delay (default os 0.5sec).
Prior to constucting this ESC you should review the documentation at the top of the caresc.asm source module and alter the configuration setting to produce the combination of options that you require.
There are 2 circuits available that show the ESC in its intended configuration. One circuit uses a relay to provide the reverse functions and the other shows a sample H-bridge design.
Note: These circuits all show a single FET in each position in the curcuit. For large motor currents it will probably be the case that more FETs in parallel are required and appropriate heatsinks considered. The details of this are left to the reader.
A note about the H-bridge
The H-bridge citcuit is provided as a starting point only. It is a simple design using two P-channel FETs and two N-channel FETs. The P-channel FETS have a relativly high On resistance and in most circumstances the use of all N-channel FETs would be more appropriate. Replacing the P-channel FETs with N-channel FETs requires a more complex drive arrangement and this is not documented here.
Where is everything?
The files available for download are:
File Name Description caresc.asm PIC 12F675 Assembler Source linear.inc PIC 12F675 Assembler Include File power.inc PIC 12F675 Assembler Include File rcaresc.gif Circuit diagram for relay reverse hcaresc.gif Circuit diagram for H-bridge reverse
There are no constuction details provided for this ESC. The example shown in the aircraft ESC can easily be adjusted for use with the relay reverse ESC. The H-bridge ESC would require a desgin that was primarily determined by the details of the H-bridge system.