LEDC Fade in Frequency instead of duty
Posted: Mon Dec 28, 2020 11:53 am
Hello,
I am working on a project where I am controlling several stepper motors using the LEDC component. The stepper motors have their own stepper driver which takes in a step signal. On each logic rise the stepper will rotate by a certain amount. The speed of the motor is controlled by the frequency of the signal. So I am just using an LEDC with a 50% duty cycle and adjusting the frequency.
Such motors, of course, have inertia which means you can't ramp them up to full speed immediately but you need fade between frequencies. I know the LEDC has a function to fade in duty cycle but I need to fade in frequency here.
Since a lot is going on on the ESP32 I want to pay attention to efficiency and was wondering what the most efficient way of doing this would be?
The first thing that comes to my mind would be a FreeRTOS task with a queue updating the frequency and pausing itself once it achieved the set frequency but I would be happy to learn whether there is a better and more efficient way of doing this.
I am working on a project where I am controlling several stepper motors using the LEDC component. The stepper motors have their own stepper driver which takes in a step signal. On each logic rise the stepper will rotate by a certain amount. The speed of the motor is controlled by the frequency of the signal. So I am just using an LEDC with a 50% duty cycle and adjusting the frequency.
Such motors, of course, have inertia which means you can't ramp them up to full speed immediately but you need fade between frequencies. I know the LEDC has a function to fade in duty cycle but I need to fade in frequency here.
Since a lot is going on on the ESP32 I want to pay attention to efficiency and was wondering what the most efficient way of doing this would be?
The first thing that comes to my mind would be a FreeRTOS task with a queue updating the frequency and pausing itself once it achieved the set frequency but I would be happy to learn whether there is a better and more efficient way of doing this.