Discussion regarding strategies to incorporate STEP/DIR into ESC for CNCs

(Read 1945 times)
Hi all,
First off brilliant tutorial by Electronoob! (hmmm how do you tag someone?) - well thought out and prepared simple explanation to a complex subject. Bravo!

Background to Question...
I have been trying to find an affordable alternative to DC servo's,  as i want to move up from Steppers.

However most of the CNC controllers out there use the STEP/DIR protocol to instruct the drivers to move the motors.

There is an open source esc called oDrive https://odriverobotics.com/ that does this very well, but it is again quite costly, even the copy from Aliexpress.

Now the question...
Is there a standard strategy to perform closed loop and correction calculations? 

Process as i see it:
  • controller sends step & dir pulses to Driver.
  • Closed loop controller (CLC) passes these pulses to driver part of circuit.
  • CLC also updates new desired delta / position of axis
  • CLC waits a certain time for axis to move
  • CLC reads encoder to validate that axis has moved to desired position.
if axis has not moved,
  • CLC keeps recording the desired position (with more incoming movement pulses)
  • CLC keeps trying to move axis to newly updated Required position.v
  • if Threshold is exceeded return Error /  fault to controller and E-Stop.

hmm seems decimal list not working!

And is there interest in including this into the ESC project? 
Specifically for Closed Loop Servo using BDLC and Encoders?

Also i noted the oDrive has a Braking Resistor, what is this for and how does one implement this into the ESC?

Sorry for the looooong question

many thanks
RobZ




Another Question :)
how would Reverse be implemented in the ESC?  for RC cars ( and dir in CNCs) ?



So basically you're looking to control brushless motors with PID control? Or stepper motors? I didn't quite get the question. I know the Odrive but I never used it. I'm also trying to improve my ESC to be able to do just that but there are a lot of changes to be made, especially in the code. What you need is to read the position of the shaft frm the encoder and apply a PID code to the motor speed and direction of roration... We need to ameka  lot of tests in order to get good results. If you need somethign fast, just go with the Odrive, it already has all the working libraries and so on...

Good day!



thanks,
I want to use BDLC motors (with encoders) as replacements for stepper motors.
I presume the control will be via PID.
I am not in a hurry.
The Topic is to hopefully discuss the methods how this could be done. 

The second question relates to your current ESC project and code, to implement fwd / rev, i presume I would need to capture min & max ranges of PWM, and set the zero speed in the middle, then if PWM is lower than middle, set the steps of the h-bridge in the reverse order?

(South Africa is going into lockdown on thursday evening, so i need to buy enough components to build your ESC on proto board before then). At least i will have plenty of time to experiment!



Yes, I've already done the bck/fwd rotation of the motor. THe bad thing is taht you loose precision. The PWM is from 1000 to 2000. So instead of having a 1000us range for control you only have 500 for fwd and 500 for bck...



i see, but good enough to start playing, (experimenting) with PWM
i didn't see your PID content before asking, sooo much to learn!
thanks