I am really keen to use FOC to give me good motor control and have a few projects lined up to use this.
Unfortunately I’ve had a couple of false starts with this sytem but have returned to my first project and I’m really hoping to make a go of it this time.
This first project was, I thought, relatively simple in that I simply want to spin the motor at an RPM, ideally between around 50-2000RPM and update periodically based on input from a speed sensor of some description - For now just a single hard-coded value.
I have been working with a friendly AI bot to help me along but it seems to be getting out of its depth and throwing anything at it without much rhyme or reason.
Ultimately the project will define the speed value via processing another input such as ADC, I2C, SPI or GPS but for now, to keep things simple, I’m using a hard-coded value.
Also for simplicity I want to drive the motor initially in open loop mode, hence not currently using an encoder although I have one available (tested and working).
I initially deployed a sketch and wired up the motor (IFlight IPower Motor GM3506 130T) and drive board (SimpleFOC Mini v1.0) as AI suggested, uploaded the program to the ESP and nothing happened!
It seems logical to me to take a step backwards, take the drive board and motor out of the equation and check if I’m even getting the derired output from the ESP, my take on this is that if I don’t get to that point anything downstream is irrelevant?
My expectation is that, if the program is doing its job, I should get a PWM output on each output?
The PWM will have var
I have done this today via 'scoping the output connections and I don’t see any activity on them.
I did also issue some code to place a simple PWM output on these pins and this did work indicating that the pins are PWM capable.
Indications on this page:
seem to indicate that my ESP32-S3 can use any pins for MCPWM (Motor Control PWM?) and that timer and pin association is performed automatically by SimpleFOC.
It seems that even simpler boards (S2, C3) can alternatively use LEDC for PWM but presumably it is not required for me to look further into this as my board should be good with MCPWM.
I have tried using pins 4, 5 & 6 and 35, 36 & 37 each time with no success.
I am programming via the Arduino IDE and have linked to the latest SimpleFOC library and ESP board manager so hopefully have the best available?
My take on this at the moment is:
My expectation of the ESP producing the PWM output is wrong.
There is a problem with the code.
There is a problem with my ESP (I do have an alternative available, ESP-WROOM-32)
I’ve reproduced the text of the sketch below. I’m new to this so may have missed some detail, please don’t hesitate to ask. As always thanks in advance for any help.
