Download Brushed Motor ESC

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Electrification wikipedia , lookup

Power inverter wikipedia , lookup

Power engineering wikipedia , lookup

Induction motor wikipedia , lookup

Buck converter wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Mains electricity wikipedia , lookup

Alternating current wikipedia , lookup

Voltage optimisation wikipedia , lookup

Power electronics wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Brushed DC electric motor wikipedia , lookup

Dynamometer wikipedia , lookup

Rectiverter wikipedia , lookup

Stepper motor wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Fault tolerance wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Transcript
Brushed Motor ESC
27 November 2005
This project documents how to build and construct your own Brushed Motor ESC using
a Microchip 12F675 PIC and a small number of standard components. Various test
systems are also described that allow the investigation of how ESCs function.
The ESC descibed here is primarily for aircraft. There is an associated project that is
designed for cars and boats with features that are similar to commercial ESCs for this
application.
Important Note
This information is provided on a 'as-is' basis. Model aircraft are not toys.
Construction, and use, of this device is at the users own risk.
Most simple PIC programmers do not verify that the device has been programmed
correctly by using high and low supply voltages to the PIC. This type of
programmer is not normally considered a production environment programmer
and there is a risk that the PIC has not been correctly programmed even when the
software says it has been.
Background
There are a number of other projects that have been documented for brushed motor
ESCs. The good starting point for other ESCs is this rcgroups thread. The information
in the Microchip AN847 is also very useful.
Most of these designs are very similar, the variation between designs is typically in the
PIC used to control the ESC, the precise FETs used, and the number of features that the
ESC offers. Some variation is also probably due to the availability and cost of parts.
There were two main reasons that I embarked on this project:


None of these projects used the 12F675, and this PIC has a number of interesting
features. The main one is that being a Flash programmable part it makes a good
vehicle for testing ideas and permitting the ESC to be reprogrammed and
various ideas tested.
None of the other designs offered exactly what I was looking for and in addition
there was a certain challenge in programming a 12F675 to do this task.
Why build your own ESC
Some of the reasons that you may consider using the information here include:

You may well be able to get the mix of features you want at a reasonable price.
Building your own ESC offers opportunity to get exactly what you want.




Repair of a DIY ESC may be easier (in Australia repair of ESCs is nearly
impossible and expensive). For example, if the output FET fails it can be
replaced at modest cost.
It may provide an additional area of interest for those who like to tinker. You
may also want to learn how an ESC works.
If based on a Flash PIC (eg. 12F675) you can modify the ESC software at no
cost. This would included modifying the cut-off voltage, brake type, etc. You
could even modify the software to have the ESC record information regarding
the flight.
You can pick and choose the output FET for required current level while still
getting the same ESC facilities.
Why not to build your own
There are a number of very good reasons why you should not build and fly your own
ESC. These reasons wouldn't stop you from playing with this idea to learn how it all
works.




Reliability of the BEC (and to some extent the ESC) is an important safety issue.
Modern commercial units with all SMT parts have a high mechanical reliability.
There may be very little financial advantage if you have access to reasonably
priced ESCs. Just the time taken to build the ESC is worth something, perhaps
you would prefer to spend if flying!
Purchasing items such as MOSFETs on a one-off basis is relatively expensive.
You may also need to select some components for this design based on what is
available to you at reasonable cost.
The DIY ESC is probably going to be heavier than the SMT based commercial
ESCs. This design built with standard components weighs approximately 25gms
- see below.
What this ESC offers
This ESC design offers the following features:













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.
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 (or fast start if desired)
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.
Automatic low and high throttle setting.
Both braking and non-braking zero throttle positions for use in car applications
(optional).
Lost Model Alarm (optional).


Glitch counter (optional).
Reverse output (optional).
Low Voltage Cutoff
The ESC monitors the battery supply voltage and turns off the motor when the supply
voltage drops below a preset point. The code as supplied operates the cutoff at 6V, this
is considered a relatively safe point. The LM2940 BEC will operate down to 5.6V so
stopping the motor at 6V leaves some margin for error. Once the cutoff has detected 6V
or less the throttle must be reset to idle before the motor will operate.
The ESC checks the battery voltage every time a servo control pulse is received, or
about every 20msec. These readings are averaged over 4 consecutive samples to get a
more stable battery voltage reading. Under high load conditions it is possible to obtain a
very low reading as the FET switches on, the averaging reduces the chance of a false
voltage reading triggering the LVC. If desired the sample size can be increased. An
alternative would be to increase the filter capacitor on the voltage sense input, however
a software solution permits the filtering parameters to be changed without a hardware
change.
The ESC can be configured with two different low voltage points. In this mode the GP3
input (jumper W1) selects which cutoff voltage is in effect.
Automatic low and high throttle setting
When the ESC is powered on the throttle is assumed to be in the 'low' position. After
power on you must move the throttle to 'high' and then back to 'low'. The ESC will then
arm and sound two short 'beeps' via the motor. This feature assumes that the 'high'
setting has a longer servo pulse width than the 'low' setting. So Futaba transmitters will
still require servo reverse on the throttle channel.
After the 'beeps' have sounded (1.5 seconds) the ESC enters normal operating mode and
will wait for 'low' throttle. This means that if the throttle is advanced during the 'beeps'
the ESC will not spin up the motor. So throttle should not be advanced until the 'beeps'
have finished.
Slow Start
The slow start operates by advancing the throttle 1 step every time the received throttle
setting is higher than the current setting. In practice the means that to go from idle to
full throttle takes about 1.2sec (64 * 0.02sec). If the received throttle is lower than the
current ESC setting the ESC will wait until two consecutive lower throttles and then
immediately reduce the throttle to the selected value.
This behaviour stops one faulty receiver pulse from 'blipping' the engine. With slow
start a faulty 'low' throttle causes the ESC to have to build up to the correct setting using
the slow start, for smooth flight this is to be avoided where possible. A single pulse
filter appears to significantly reduce this problem.
If desired the ESC can be constructed with the slow start turned off. In this case the the
ESC will raise the throttle immediately a higher throttle setting is received.
Soft Brake
The soft-brake option uses the throttle PWM engine to gradually applying the brake one
step every time the idle throttle is received (about every 20ms). This means it takes
approximately 1.2sec for the brake to be fully applied. Flight testing shows that this
works well with the gearbox not being subject to sudden changes in motor speed.
Brake Enable
The brake enable/disable via a jumper is an option of this ESC software. This is
provided mainly to demonstrate that control of the ESC features via a jumper is
possible. One possible use of a jumper is for disabling the brake. It may be convienent
to disable the brake without changing the PIC in some aircraft or possibly when testing
and evaluating the brake.
Programmable Throttle Response Curves
Most standard ESCs convert the throttle setting into PWM rates using a simple linear
mapping. So that 50% throttle corresponds to a 50% PWM. However, a 50% PWM rate
is actually delivering only 25% of the full power to the motor. This is the standard
configuration of this ESC also.
The design of the software for this ESC makes it very easy to alter the mapping from
throttle to PWM rate so that 50% throttle corresonds to 50% motor power.
Of course, other throttle response curves are also possible. Because the generation of the
PWM engine is performed by a Perl program you do not need to be able to program PIC
assembler to try out your own throttle response curves. (You do however need to be
able to write Perl code that converts the throttle value between 0 and 1 into a PWM on
rate between 0 and 1.)
The throttle response curve also determines when the brake is applied (if the ESC is
configured with a brake). This permits applications where some of the throttle positions
have the motor off and the brake off, and other positions have the motor off and brake
on.
Braking and non-braking zero throttle positions
The ESC supports motor off settings with and without the brake applied. (This may be
of use on R/C car applications.)
Typically the throttle at its lowest setting has the motor off and brake on, then as the
throttle is increased it changes to motor off and brake off, and then increasing further
powers up the motor. When the throttle is reduced from the motor on setting it first
enters a region where the motor will coast (ie. motor off and brake off) and then if the
throttle is reduced further the brake will then be applied.
Lost Model Alarm
The LMA is triggered by either loss of throttle input from the receiver for more that 10
seconds or the throttle input being set to a sufficiently negative input (ie. the throttle
trim moved as low as possible).
Suggested hardware for the alert is a simple Piezo Transducer the ESC will produce the
appropriate AC drive for the transducer. Alternaticly a piezo transducer with inbuilt
siren can be used and the ESC produces a simple on/off output. Depending on the
volume level that you require the piezo can be driven directly from the PIC, or via a
buffer transistor from the unregulated battery voltage.
The LMA siren is driven out of the GP1 pin on the PIC with an active high siren signal.
Glitch counter
The glitch counter can be selected as long as there are no other options using the GP3
input (jumper W1) to the PIC.
The glitch counter counts the number of faulty receiver pulses and 'beeps' the count out
on either the motor, or piezo sizen if the LMA facility is configured.




If there have been no glitches a single long beep will sound.
If there have been more than 99 glitches two long beeps will sound.
For between 1 and 9 glitches than number of short beeps will sound. For
example, 4 glitches will sound four short beeps.
For between 10 and 99 glitches the LMA will beep out the tens and then the
units with a pause between them. A unit of zero is indicated by a long beep. For
example, 13 glitches would be 1 short beep, a pause, and then 3 short beeps; 10
glitches would be 1 short beep, a pause, and then 1 long beep.
Reverse Output
The reverse output is available when there is a spare output pin on the PIC. This reverse
implementation is a simple reverse function that is designed primarily for cars (or
boats). As such the reverse facility should only be enabled with the the car throttle map
(THROTTLEMAP = 3).
The reverse output will toggle state when the throttle is held in the brake position for
more that 5 seconds. The output can be used to drive a relay, or could be used as a
control input to an H-bridge for electronic reverse.
The output signal (GP1) is low (0 volts) for 'forward' and high (+5 volts) for 'reverse'.
Why use the 12F675?
The Microchip 12F675 offers a number of interesting facilities that are used in this
design. These facilities permit a much better ESC to be designed than is possible with a
12C5xx PIC, without the complexity of designs using larger PICs.





Internal 4MHz oscillator. Not having to rely on an external crystal, or similar,
for the processor clock keeps the RFI produced by the PIC to a minimum.
Two timers. The 12F675 has two timers and what is more important one of
them is a 16-bit timer with external count enable control. This feature permits
accurate timing of the throttle pulse width to within 1usec. In addition the
12F675 offers interrupts on the 8-bit timer that permit accurate software PWM
in parallel with other operations.
A/D Converter. The on chip A/D converter simplified the low voltage cutoff
detection.
Comparator. The 12F675 also offers a comparator that can be used as an
inverter when required (and pinout limits permit).
Flash Programmable. The 12F675 can be reprogrammed and therefore is an
excellent PIC for experimenters.
ESC Challenges
There are a number of important challenges in designing an ESC:




Accurate timing of the throttle control pulse.
Accurate PWM generation to ensure the motor speed is even.
Obtaining a high enough PWM rate at low motor speeds to ensure that the motor
does not operate in discontinuous mode and produce unacceptable noise and
vibration.
Maximising power efficiency. This is assisted at high motor speeds by reducing
the PWM rate to minimise the switching losses.
Accurate timing
Radio control control pulses are 1.500msec wide at the centre position and with a swing
of approximately 0.500msec in either direction for full stick movement. A reasonable
assumption for throttle controls is that throttle 'off' is a pulse width of 1.150msec and
'full on' is 1.850msec.
If you wish to obtain 64 possible motor speed settings then each motor speed represents
0.012msec of control pulse width and the ESC must measure the pulse with sufficient
accuracy and resolution to permit determination of the throttle position.
There are two main techniques for measuring the throttle pulse width: a software
counter or a hardware counter. If a software counter is used great care needs to be taken
to ensure that there is sufficient measurement resolution, and operating a software PWM
at a reasonable rate at the same time is almost impossible. The best method is to use a
hardware counter, and in this case the 12F675 offers an externally gateable 16-bit
counter with 0.001msec resolution.
Software PWM
The major difficulty with performing PWM in software is obtaining an accurate stable
frequency while the PIC is performing other tasks. Normally interrupts would be used
to obtain reasonable accuracy, however, interrupt response and entry/exit overheads
make it difficult to use interrupts when either the FET on or off time is short.
This ESC uses a combination of software timing and timer based interrupts to generate
the PWM.
This is achieved by having the PWM code written by another piece of software.
A Perl program contains all the details regarding the processor timing and generates PIC
code to implement the PWM engine. This permits the selection of PWM frequency on a
continuously variable basis, and also the implementation of user designed throttle
profiles.
Further details regarding this PWM generation software is below.
The PWM engine uses software timing to generate short pulses and the timer with
interrupts to generate long pulses. This permits the main ESC application to be written
without concern for precise timing.
Is it any less expensive?
Under some circumstances there are considerable savings to be had by building your
own ESC, however, most of the time there isn't much cost advantage.
The following table shows some current (7 December 2003) prices for commercial
ESCs (purchased by mail order) and DIY prices.
Purchase 18A ESC (JETI JES-180) A$50
Purchase 8A ESC (GWS-ICS-300) A$30
Build 13A ESC no brake (1A BEC) A$24
Build 13A ESC with brake (1A BEC) A$30
Build 25A ESC no brake (1A BEC) A$30
Build 25A ESC with brake (1A BEC) A$36
As can be seen there isn't a lot of saving, and the DIY version is probably heavier and
may be less reliable and crash-proof.
The major cost item are the FETs, and the ability to obtain good quality (ie. low
resistance, high current) FETs at a reasonable price is the most important issue.
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. Common versions are provided here, but it is almost certain that you
will want to adjust some of the parameters to suit your requirements - after all that is
half of the reason for building your own ESC.
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\ESC
Copy the esc.asm, linear.inc, power.inc and carpower.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 4 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 'esc.hex'.
To alter the paramaters double click on 'esc.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.
Note: when the code is assembled the appropriate circuit type (one of ESCA, ESCB or
ESCC) will be placed as text into the .HEX file along with the software version and the
module name. This text is intended to be visible when you load the .HEX file into the
PIC programmer software and allows you to check that the PIC is configured for the
circuit type you have.
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 this design. Users with
Windows systems may want to consider using ActivePerl to run this application.
You don't need to understand, or be able to run, this program in order to use the ESC.
The PIC assembler code that is provided will do everything that most people require.
You only need to be able to run this program to generate custom throttle profiles, adjust
PWM rates or make similar changes.
Important Note: if the soft brake feature of the ESC is used then the soft brake uses the
same PWM engine as the throttle. Thus, the brake will be gradually applied with the
same duty cycles as the throttle.
The program contains some documentation concerning the constants that you can
modify.
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.
Car Power PWM engine
A power (ie. throttle position proportional to engine power) PWM include file is
available that is suitable for car use. This throttle map has a zero throttle region and a
brake region so that the brake is only applied when the throttle drops below the zero
throttle region.
Circuits
Test Circuits
There are 3 test circuits provided that show how to configure the PIC and a handful of
parts to demonstrate the capabilities of the ESC software.
Production Circuits
There are 2 production circuits available that show the ESC in its intended
configuration. All production circuits provided include low voltage cutoff. Operation of
an ESC without such a cutoff is considered too dangerous in a model aircraft
environment.
Where is everything?
The files available for download are:
File Name
Description
Ver 1.9: Perl program to compute PIC code to implement
throttle.pl
PWM functions and the mapping of throttle position to
PWM duty cycle.
esc.asm
Ver 1.12: PIC 12F675 Assembler Source
linear.inc
Ver 1.8: PIC 12F675 Assembler Include File
power.inc
Ver 1.5: PIC 12F675 Assembler Include File
carpower.inc
Ver 1.4: PIC 12F675 Assembler Include File
Assembled ESC code and listing for use where circuits call
esca.hex,esca.lst
for 12F675-ESCA (linear throttle map)
Assembled ESC code and listing for use where circuits call
escb.hex,escb.lst
for 12F675-ESCB (linear throttle map). Note: this version
has the hard brake.
Assembled ESC code and listing for use where circuits call
escbs.hex,escbs.lst for 12F675-ESCB (linear throttle map). Note: this version
has the soft brake.
Assembled ESC code and listing for use where circuits call
escc.hex,escc.lst
for 12F675-ESCC (linear throttle map). Note: this version
has the hard brake.
Assembled ESC code and listing for use where circuits call
esccs.hex,esccs.lst for 12F675-ESCC (linear throttle map). Note: this version
has the soft brake.
Assembled ESC code and listing for use where circuits call
esccsp.hex,esccsp.lst for 12F675-ESCC (power throttle map). Note: this version
has the soft brake and power throttle map.
testrig.gif
Rev C: Circuit diagrams for various test configurations
escnobrake.gif
Rev D: Circuit diagram for production ESC without brake
escbrake.gif
Rev I: Circuit diagram for production ESC with brake
Rev A: Circuit diagram for production car ESC with brake
esccar.gif
and no LVC
Rev B: Suggested veroboard/versa strip layout for
boardtop.gif
production ESC with brake - top view
Rev B: Suggested veroboard/versa strip layout for
boardbot.gif
production ESC with brake - bottom view
Notes
Glitch filtering
The ESC provides glitch filtering to stop the occasional input glitch from affecting the
ESC outputs. Users may wish to alter these filter values to fit their preferences. This
note explains how to do this.
From the ESC's viewpoint there are two types of glitches: those that represent a lower
throttle setting than that which is currently in effect and those that represent a higher
throttle setting that the current one. These two types of glitch are handled differently.
With the slow start option selected glitches for higher throttle settings are managed by
the slow start code. A single glitch for a higher throttle setting will cause the ESC to
increase the throttle by 1 step - this is the normal slow start operation. A single step
throttle increase is not noticable in most situations and so no special processing is
required.
With the fast start option selected glitches to higher throttle settings would cause an
immediate increase and can result in noticeable changes in throttle. For this reason the
ESC requires a number of consecutive input pulses before the throttle is changed. By
default this value is set to 4, so 4 consecutive input pulses are required to increase the
throttle. This value can be changed by altering the constant (uppulse) in the Main
parameter section of esc.asm.
Similarly glitches to lower throttle settings require a filter to ensure that the throttle is
not decreased erroneously. Coupled with the soft start option an eroneous throttle
decrease causes a significant problem. For this reason the ESC requires a number of
consecutive input pulses before the throttle is changed. By default this value is set to 4,
so 4 consecutive input pulses are required to decrease the throttle. This value can be
changed by altering the constant (downpulse) in the Main parameter section
of esc.asm.
Other versions
There are many versions of the ESC software that can be generated from the source
files, far too many versions to have all of them appear on this web page. However, the
following versions are provided as some typical useful configurations.
ESC with power throttle map, soft brake and 6V/9V selectable LVC
This is software version suitable for the full ESCC circuit that provides the following:







Slow motor start
Soft brake that is permanently enabled.
6V and 9V LVC jumper selectable (using the GP3 jumper), jumper off selects
6V and jumper on selects 9V.
Auto calibrate throttle range.
Power throttle map.
LMA disabled.
Glitch counter disabled.
Option
SLOWSTART
BRAKE
BRAKEENB
Setting
1
2
0
REVERSE
0
LOWVOLTS
6000
LOWVOLTSALT 9000
PULSE_LO_HI
0
THROTTLEMAP 2
LMAFREQUENCY 0
GLITCHENB
0
ESC with power throttle map for car use
This is software version suitable for the full ESCC circuit that provides the following:








Fast motor start.
Soft brake that is permanently enabled.
6V LVC
Auto calibrate throttle range.
Power throttle map.
Both braking and non-braking zero throttle, the throttle moves from motor
off/brake on to motor off/brake off to motor on.
LMA disabled.
Glitch counter disabled.
Option
Setting
SLOWSTART
0
BRAKE
2
BRAKEENB
0
REVERSE
0
LOWVOLTS
6000
LOWVOLTSALT 0
PULSE_LO_HI
0
THROTTLEMAP 3
LMAFREQUENCY 0
GLITCHENB
0
If you do not require a low voltage cutoff in an R/C car the ESC can be configured
without an LVC. In this configuration the ESCB circuit will be used.








Fast motor start.
Soft brake that is permanently enabled.
LVC disabled.
Auto calibrate throttle range.
Power throttle map.
Both braking and non-braking zero throttle, the throttle moves from motor
off/brake on to motor off/brake off to motor on.
LMA disabled.
Glitch counter disabled.
Option
Setting
SLOWSTART
0
BRAKE
2
BRAKEENB
0
REVERSE
0
LOWVOLTS
0
LOWVOLTSALT 0
PULSE_LO_HI
0
THROTTLEMAP 3
LMAFREQUENCY 0
GLITCHENB
0
If you require a reverse option for a R/C car application the ESC can be configured as
follows: In this configuration the ESCC circuit will be used, regardless of whether the
LVC is enabled.









Fast motor start.
Soft brake that is permanently enabled.
LVC disabled.
Auto calibrate throttle range.
Power throttle map.
Both braking and non-braking zero throttle, the throttle moves from motor
off/brake on to motor off/brake off to motor on.
Reverse activated by brake applied for 5 seconds.
LMA disabled.
Glitch counter disabled.
Option
Setting
SLOWSTART
0
BRAKE
2
BRAKEENB
0
REVERSE
1
LOWVOLTS
0
LOWVOLTSALT 0
PULSE_LO_HI
0
THROTTLEMAP 3
LMAFREQUENCY 0
GLITCHENB
0
How to build one
So after all that you would like to try constructing one of these, what do you do?
Here is a suggested method of constructing a ESC with brake and low voltage cutout
using standard components. This procedure will work for the basic ESC without a brake
- however, the component layout is left as an exercise to the reader!
Similarly you can delete components such as the brake off jumper if you wish. Deleting
the brake off jumper permits the board to be made smaller - see the construction
examples at the end.
This layout with standard components weighs 25gms when assembled (this is without
the power connectors and heatshrink, however, it does include 25mm of power cables, a
switch and 300mm servo lead). With the heatshrink and a pair of Deans Ultra
connectors the ESC weighs 32gms.
Note: The images shown in this procedure are using the Rev A layout, your layout will
be slightly different - just follow the procedure and the diagrams.
Think First!
Before commencing construction give some consideration to the cooling of the LM2940
regulator used for the BEC. The TO-220 package has a metal tab that is connected to
ground (0V). This device can dissipate some power without any heatsink, however the
the amount of power dissipated is a function of the battery voltage and the power
consumption.
The LM2940 specifications show a 60 degree C per watt package temperature rise in
still air. With careful construction there will be some ventilation with air flow, and some
heatsink via the PCB and this will tend to reduce package temperature. In practice 1W
power dissipation should represent no problem. Where higher power dissipation is
expected consideration should be given to cooling the LM2940 regulator.
For example, using an 8-cell pack (say 10V) powering the ESC, two HS-81 servos,
receiver and an Aiptek pencam (total 200mA at idle, 500mA peak) the idle power
dissipation is 1W ((10V - 5V) * 0.2A), peak dissipation would be 2.5W. This
combination operates fine with no special heatsinking provision.
If you elect to leave out some of the features, for example the brake off jumper or the
power switch, you may well be able to reduce the size of the veroboard.
Step 1
Obtain some FETs. You will need one N-channel and one P-channel FET in TO-220
packaging. The N-channel FET should have an Rds(on) of < 0.010 Ohms at 5 volts Vgs.
Make sure that you read the data sheet carefully, the 'headline' figure is often at 10 volts
Vgs, you need to look further for the figure that is typically given for 4.5, 4.8 or 5 volts.
Suggested N-channel FETS are: IRF2203N, IRF3706, IRL1404. The P-channel (brake)
FET is not as critical and something like an IRF9530 or IRF9540 is suitable. The design
relies on the Drain/Source diode in the P-channel brake FET to protect the N-channel
FET, so if you remove the brake (or use a small FET or large motor) you will need an
additional diode as shown in the no brake design.
If is also possible to use SO-8 packaged FETs, such as the IRF7456, however this
requires better soldering skills and also a different board layout. For a DIY ESC I would
suggest sticking to the TO-220 packaging - they will dissipate plenty of power and are
easy to install.
You may also need to obtain a Schottky Diode (D1). This is mandatory for the ESC
without a brake and optional for the ESC with a brake. The Schottky diode should be
rated at at least 3A for use with motors upto Speed 400 in size (at about 12A maximum
motor current), larger motors would require a larger diode.
With the design using a brake it may be sufficient to rely on the diode in the brake FET,
however this depends on the rating of your FET. If in doubt install the diode as this will
increase the safety margin.
Do not reduce the size of C6 (3.3nF). This capacitor is there to ensure that the brake
FET does not turn on due to noise while the motor drive FET is on. If both FETs turn on
at the same time it will be catestrophic. If in doubt it is safe to increase this capacitor to
5.6nF or even 22nF to ensure that there is not chance of the brake FET being turned on
at the wrong time.
Step 2
Obtain all the other parts. Note that the PN100 can be substituted with a 2N2222,
BC549, BC547 or similar. It is important to use a low dropout voltage regulator - stick
to the LM2940. It is probably worth using a socket for the 12F675 as you will want to
play with the first ESC you build - spend a few extra cents and purchase a 'machined'
socket with the round pins.
Step 3
Print off the bottom view of the veroboard layout and cut a piece of board the same size.
Note that the outer set of holes on the diagram are designed to be the ones you cut
along. I normally cut with a knife along the holes on both sides of the board and then
snap along the line I have just cut.
Remove the copper tracks in the positions indicated by the green lines on the bottom
view - like this:
Step 4
Now turn the veroboard over and use the top view of the layout, the top wiring is
indicated by the blue lines.
Solder the components onto the board in the following order:







The wire top (blue) links, ignore the '-Mot' connection at this point.
The resistors
The IC socket
The transistors
The capacitors
The one insulated wire link shown in yellow on the layout diagram
The servo connection wires and the switch if you want one.
You should end up with something like this:
Step 5
Now turn the board over and place the LM2940 and the two FETs on the back of the
board. Note that in all cases the metal part of the device is mounted away from the
copper side of the veroboard. If you want to you can use a small piece of double sided
mounting tape between the package and the board.
Before you attach these components check for solder shorts where they shouldn't
be. Try running a sharp blade along the gap between the tracks to ensure that there are
no shorts - now is the time to find them!


With the LM2940 bend and trim the pins and insert them through the holes,
solder the pins on the copper side. The pins need to be trimmed so that the pins
do not stick through on the top side.
Follow a similar procedure with the FETS. However, leave pin 2 (the middle
one) long so that it sticks through onto the top side.
Then add some additional heavier wire (as indiciated in red) along the +Bat and -Bat
connections to the FETs. This can be soldered on the gap between the 1/2 strip left after
you cut the board and the first full strip on the veroboard. Then attach the +Bat, -Bat
and +Motor wires to the board/wire.
This should look something like this:
Step 6
Turn the board back to the top side and join the two legs of the FETs that are sticking
through the board together with some heavy wire. Then attach the -Mot wire to this.
Step 7
Now you should have the entire ESC assembled. So now we can check out the ESC.
Proceed as follows:






Make sure the ESC is not plugged into your receiver.
Make sure that there is no PIC in the socket.
If you have a switch on your ESC turn the switch to the off position.
Connect the motor to the ESC and then connect the ESC to a battery. If the
motor starts or anything starts to get hot immediately remove the power - you
have a wiring/construction problem.
Turn the switch on and using a multi-meter check the voltage between pins 1
and 8 of the IC socket, you should see 5V. Also check the voltage on the power
pins of the servo connector and ensure that it is 5V. Check the voltage between
the servo signal (pin 1) and ground of the servo connector - there should be
nothing.
Turn off the switch and remove the power.














Insert a correctly programmed PIC - for the full design you need the 'ESCC'
version. Double check that you have the PIC in the correct way and that pin 1 of
the PIC is in the correct place.
Apply power and turn on the switch. If the motor starts or anything starts to get
hot immediately remove the power - you have a wiring/construction problem.
Double check the power supply voltage on the Servo connector - we don't want
to destroy the receiver!
Turn off the switch and remove the power.
If you installed the brake disable jumper put a jumper on the pins to disable the
brake.
Turn on your transmitter and set the throttle to minimum.
Connect the ESC to a receiver, apply power and turn on the ESC.
Move the throttle control to maximum and back to minimum.
Check that there are two 'beeps' from the motor to indicate the auto ranging is
complete.
Gently move the throttle up, the motor should start spinning. Check the
temperature of the FETs if they are warm you have a problem. If the motor FET
(U4) is hot there may be a problem that the brake FET is not correctly installed,
or if you are constructing a non-brake ESC that the diode is not correct installed.
When the throttle is moved back to minimum the motor should gently slow
down.
Remove the brake off jumper and try advancing the throttle to get the motor
spinning and then move the throttle back to minimum - the motor should stop
with a jerk if you are using the hard brake. If you are using the soft brake
version the the motor stops more quickly than with the brake off but gently
rather than with a jerk.
Turn off the power.
As a final test connect a set of servos and other components (for example,
camera) to the receiver and then turn the power on. Monitor the temperature of
the LM2940 - leave the ESC on the bench for 10 minutes to ensure that the
LM2940 does not get too hot and shutdown.
Step 8
Congratulations - you now have a fully functional ESC.
You should be able to use a short length of 25mm heat shrink to cover the ESC. As you
shrink the heat shrink you can cut a hole to allow the brake off jumper pins to be visible.
You can also cut a hole for the PIC so you can change the programming. However,
make sure the PIC is firmly in place - if it pops out mid-air then you will be flying a
glider.
More construction examples
Revision A prototype with switch, brake off jumper. This initial revision had the brake
and motor FET mounted 'on the end' of the board.
This is a revision B board under construction. This board does not have the brake off
jumper. The bottom view diagram shows how an entire set of holes has been removed
and two of the cuts moved. This reduces the length of the ESC by 0.1 inch.
The top view of the assembled Revision B board, note again the deleted set of holes on
the top view diagram.
The bottom view of the assembled Revision B board. This view shows the mounting of
the LM2940 and FETS.
Final view of the ESC after covering with heat shrink tubing.
The prototype Revision A ESC mounted on an AP Slow Stick. The soft brake works
well in this configuration, the prop stops in about 1.5 seconds.