The illustration above shows ruffly how servo logic will come out if you bit bang directly. Some of the Arduino libraries does this. As each servo uses up to 50ms on a pulse you can in theory service 20 servos in a second. The limitation here is that you bit-bang one channel at the time in sequence.
This second illustration shows how we want it to be with all 32 servos operating in parallel. This way we have a much higher capacity and avoid latency between servo operations.
To achieve this we need to use a table with 32 channels and accurate timing for then we switch on, length of pulse and then we switch off. Switching off is an issue because we need to do it with some accuracy. Our RTOS is perfect for this type of jobs and will achieve 0.1 ms accuracy without any problem.
The 32 x Servo Hat uses 32 pins that can be used for multiple purposes.
- Digital output
- Digital input
- Analogue input
- Analogue output
The servo interface is (1) signal pin, (2) Voltage pin and (3) Ground pin.
As the user set a servo value in Raspberry PI using the easyIPC libraries that value is transferred to the 32 x Servo hat, the value is inserted into the 32 channel entry and the pulse will be corrected to represent the new value. The total time latency should be very low, but up to 100ms from a value is set in RPI and the output is corrected must be expected. I will return on actual latency timing later.