Have a look at the Silicon Chip (
Silicon Chip Electronics Magazine for Hobby Electronics, Computing, Kits and Projects.) magazine, March 2008 page 33.
They have a 2200 uF low ESR capacitor across the battery, a 100 Volt 220 nF MKT polyester cap across the motor (diode also), a 100 Volt 100 nF MKT polyestercap across the switching MOSFETs (& a Zener).
They also attenuate and filter the EMF before it goes to the PIC analogue input.
Also, the point that someone made about the gnd connections is vital.
The heavy currents cause voltage drops across the tracks so you must ensure that these do not cause noise in the PIC gnd line.
Of course, they also have a 470 uF in parallel with a 100 nF monolithic cap across the PIC Vdd/Vss pins.
Where did you obtain info on the PIC programme algorithm?
I have been thinking about this issue and would like to know how to determine the PWM Duty Cycle when the motor load changes.
For example, say it is controlling an electric drill.
When you start the drill and adjust the speed to say 1000 RPM and then start drilling. The speed will decrease and so the PIC has to adjust the DC to compensate.
Obviously, the increase in the DC is a function of the decrease in the EMF. But how is it calculated?