

walls99 wrote:casainho wrote:1. Why did you code in assembly and not in C? C would be easier to understand (at least for me) but I must say your comments on the code are great - thanks.
Sometime I ask myself the same question when I try to re-read my own code. The practical answer is that C would be better for many good reason but not fast enough on the PIC 18F. Also, I'm doing this project for fun and I like the challenge!
walls99 wrote:casainho wrote:Could you please give a look to the schematic KU63 controller I am using and provide your opinion about it?
I did, it's very similar in principle to my controller. It's simple and low cost, so definitely a good starting point.
walls99 wrote:casainho wrote:Could you please tell me what strategy I could use to startup the motor in sensorless (my motor don't have hall sensors).
Check above Positioning by current sensing
walls99 wrote:The permeance varies significantly from one electric position to the other and the permeance is minimum for the electrical position that is aligned with the mechanical position. Also with this type of low inductance motor, the 6 positions scanning is fast enough not to reduce the starting torque (~500us in my case). This approach gives me ~90% of the full potential star-up torque at 5ms sampling rate and it's good for speed up to 100RPM where the BEMF is strong enough to detect Zero Crossing...
See below the position sensing cycle, the current is maximum when the permeance is lowest:
The principle is simple, I'm using the standard 6 steps of the trapezoidal control for BLDC Motors, energizing each step for a fixed time (~50us in my case) and measuring the current delta for each step. The step with the highest current delta is is the most likley to be aligned with the mechanical position of the rotor. From there, I energize the mechanical position + 2 steps or 120 degrees advance in constant current/torque mode, wait for 5ms and repeat the 6 steps scan + 5ms drive until the motor speed is fast enough to cover the 2 steps advance in less than 5ms. At this point I switch to the BEMF sensing method.

casainho wrote:I really think we need a kind of Arduino on e-bicycle controllers, I mean, an OpenSource and well documented controller. Also with commercial success.

Lebowski wrote:casainho wrote:I really think we need a kind of Arduino on e-bicycle controllers, I mean, an OpenSource and well documented controller. Also with commercial success.
I don't think this is possible. Once you get to a stage where you're project
is worthwile the big China companies will start producing it leaving you as
a developer out of the loop. Why would they give you money when all they
need is freely available on the internet ?




Arlo1 wrote:Hey Walls. With my controller project I did it all in the open. I didn't licence it as an open source don't know much about that. I will be working on the code more this winter.

bigmoose wrote:Lebo, a quick tip FWIW, vertical mount leaded components tend no to be optimum in high vibration and shock environments.

Lebowski wrote:bigmoose wrote:Lebo, a quick tip FWIW, vertical mount leaded components tend no to be optimum in high vibration and shock environments.
Let's hope for the best then, it'll be the only way in which it's all going to fit....

Lebowski wrote:bigmoose wrote:Lebo, a quick tip FWIW, vertical mount leaded components tend no to be optimum in high vibration and shock environments.
Let's hope for the best then, it'll be the only way in which it's all going to fit....

Arlo1 wrote:Lebowski wrote:bigmoose wrote:Lebo, a quick tip FWIW, vertical mount leaded components tend no to be optimum in high vibration and shock environments.
Let's hope for the best then, it'll be the only way in which it's all going to fit....
I realy think its best to be modular have the brain on one board and the powerstage seprate. Then people are able to build it to suit their needs and replace blown power stage parts with less trouble.

texaspyro wrote:Lebowski wrote:bigmoose wrote:Lebo, a quick tip FWIW, vertical mount leaded components tend no to be optimum in high vibration and shock environments.
Let's hope for the best then, it'll be the only way in which it's all going to fit....
Unfortunately, hoping for the best is no substitute for doing it right. Even the Chinese realize the problems that those vertical parts can cause. Potting or lots of RTV'd components might help.



bigmoose wrote:
... or as others have said to me: "Moose you are ruined for designing consumer products!"

casainho wrote:Could you please explain your BEMF circuit, logic behind it? How do you use the output of this circuit in the firmware?

Arlo1 wrote:Hey Walls. With my controller project I did it all in the open. I didn't licence it as an open source don't know much about that. I will be working on the code more this winter.
I made mine modular so we can make any power level with it we want. I like things in the open. I just want to get my off the ground to encourage more people to build them and to try to help prices come down. I love what I have learnt and cant wait to learn more.
On the other hand lebowski is right he has a skill and put a lot of time into his code so that is worth money to him. I would like to see lebowski sell chips and full controllers to maybe help with his financial need when his job ends in a few months. So I in no way want to hurt his sales if anything I will try to make a few items to help sell kits for him!
SO when I get back to the code this fall I will work on it open source and hopefully get peoples help. If not no biggie But I see a steep learning curve ahead and will likely take 5 years? to get the features lebowski has and will not likely be the same I will write code for different options on my way. As for why I will do this open source? Because I don't know enough to sell my code. IN 5 years maybe but by then I will maybe write code for something else to make money. At the end of the day I just want to go fast!


walls99 wrote:I started to play with BLDC motors back in 2007, my first controller used sine wave open loop control. So it took me about 5 years, working maybe few hundred hours per year, to get where I'm today! ...

walls99 wrote:casainho wrote:Could you please explain your BEMF circuit, logic behind it? How do you use the output of this circuit in the firmware?
The BEMF circuit is a standard voltage divider + low pass filter + virtual neutral comparator for Zero Crossing detection feeding the Input Capture module of the PIC. There is a lot of literature available about the Zero Crossing principles. I suggest you read this 2000+ post thread DIY BLDC controller.
The low pass filter is designed to limit the phase lag to below 30º for the maximum RPM, so it can be compensated for by adjusting the phase advance in software. I also make use of the PIC digital noise filters to reduce the interference from the PWM signal.
See attached, the BEMF filter LTspice:


S.B.D wrote:Do you sample the comparator outputs when PWM is low? What digital filtering are you implementing?
I read a Microchip app note about majority voting algorithm and FIR filtering...what do you use?
LOAD_IC org 0x1000

casainho wrote:Walls, could you please share with us some pictures from the simulation?? Maybe some pictures can help us learn how it works... like I am curious to see the result signal after the filter and input to microcontroller.
Thank you.


Users browsing this forum: No registered users and 2 guests