Local Motion
Gromit and Rocky Rhodes have come to help me demonstrate the PSoC 4 driving two servos simultaneously.
I connected two servos to a Pmod CON3 that is subsequently connected to the Pmod compatible port on the Pioneer Kit.
The PSoC comes with two types of PWM Components.
A Timer Counter (TCPWM) version and is standard version.
I've used the standard version and set it to 16 bit mode with one output.
Doing this consumed 2 UDBs each.
To get this up and going quickly I chose some ballpark figures. Without any thinking I;
Used a 100kHz source clock
Set the PWM period to 5000 cycles for 50ms
And set the compare value to 150 for 1.5ms (centre position value)
Most of the count is wasted upon the idle/dead time but what the heck! It was quick and easy to get it up and going.
To change the desired position the compare value can be changed to a value between 10 and 200 for 1ms (max CCW) and 2ms (max CW) respectively.
This configuration is satisfactory for about 99 or 101 different positions. 49 or 50 left, 49 or 50 right and centre.
The formula to calculate the value is
150 +/- desired position value.
The actual rotation angle depends upon the servo used and its maximum deflection at the maximum and minimum acceptable values.
You can connect these two servos to form a simple Pan and Tilt for a small camera or crude steadycam device when used with a gyro.
If you need any more information or help on how to do this yourself just send me a comment.