
J.F.Drew © 2000-2011


Mobile menus click image.
PWM speed control for the VK5DJ beam controller project

Hardware change involves adding two resistors to J6
Many users of this project have asked for motor speed control. Version 12.0 for 2 line display and hardware clock now supports this mode.
The work described here enables speed control of direction motors using Pulse Width Modulation (PWM) of a 20kHz square wave made available on the Menu switch pin 6 of J6. The width of each on period varies depending on a set of criteria. A pulse width of 0 (a zero voltage for 100% of the time) equates to off, while a permanently on voltage represents 100% full power. Pulse widths in between have varying ratios of on to off time and therefore support in between motor speeds.
The PWM signal drives a solid state switch that serves as a speed control for the motor. The period of each pulse determines the motor speed. All motors have a minimum speed and the software allows this minimum to be set in menu item 39 as a percentage of full speed. The default is 50%.
The actual speed control circuitry is left to your design skills although once we have at least a user willing to share I will add a circuit diagram to this page.
Operation is determined by the ModeA relays in (or by direct connection to the relevant TIP31Cs).
Mode A uses a pair of relays for each direction - one relay determining which way the power is applied and the second relay deciding whether power should be applied.The PWM only controls speed. If you are already using ModeA then you only need the motor speed system connection as I will describe shortly.
Because there is only one PWM port available (PortC.2) it has been necessary to share the PWM output for both Azimuth and Elevation. Therefore the PWM is always determined by the slowest of the outputs. Once the slow direction reaches its turn off point the other motor will speed up to the required speed for its current position. A small price to pay.
When an antenna direction is >10 degrees away from the needed direction the motor will run full speed (subject to the comment above) but when it reaches 10 degrees it will begin to slow until at 1 degree difference it will be moving at the minimum speed and then at 0 degrees the motor will stop..
Menu items
37 determines the output mode. A choice of 4: ModeA relay, ModeB relay, Yaesu, PWM+ModeA
To use PWM set this item to PWM+ModeA then set Menu item 39 to the % of full speed required as the minimum. The default is 10% but this is for testing purposes and you may need to find a value between 30%-50% to ensure reliable motor starts.
Once PWM mode has been set in menu item 39 the menu will ONLY be available on switch on. (Put the menu switch on then apply power). This is because the menu pin is taken over by the PWM function once the initial screen is passed and so has become an output.
WARNING: if you plan to access the PWM mode you MUST make the following change to hardware.
(1) Remove the menu switch wire going to pin 6 of J6
(2) Solder two 470 ohm resistors to pin 6 of J6. (See photo above)
(3) The free end of one resistor goes to the menu wire
(4) The free end of the second resistor, the PWM output, goes to a wire to your speed control system. In my case it went to the motor tag board on the rear panel.
If you do not do this modification and you operate the menu switch during PWM operation you will directly short the PWM to ground via the menu switch and almost certainly damage the PWM port - effectively ruining your 18F4685. YOU HAVE BEEN WARNED.
If you do not use PWM mode and you never switch on this function in Menu item 37 then you will not need the hardware modification.
Drive
I imagine that the amount of drive available from the PWM is quite small - the signal has the limitations of the 470 ohm resistor and as the PWM signal is 0-5volts then only a few mA are available. You will need at least a darlington output transistor to switch a relatively modest motor.