Hello List,
I have a use case where i need to control 2 DC-motors using a PID-controller.
The system is to be controlled via BLE, using a nrf52840 with softdevice S140.
As a starting point I used the ble_app_uart example, where instead of the UART I use the scheduler to process the incoming "commands"
in main mode.
The motor is started/stopped/positioned via these commands.
The PID control loop is simple and does not take much time, but is to run at 100 Hz, so I need a timer for that.
Each motor is controlled via 2 gpio pins for on/off/direction and 1 gpio with pwm for motor speed.
There are 4 encoder pins, 2 of which are to trigger a (simple) interrupt routine.
The question is whether running a 100 Hz loop is feasable with the S140 also running.
The communication over BLE is only occasionally and the motor control is only important while there is NO communication with
BLE from the controlling device (smartphone).
In that situation I could tolerate a jitter of 1 to 2 msec
Is this a feasable number?
Thanks in advance,
Sietse
PS. Note that while controlling the motors, power consumption of the cpu is not an issue.