News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Sensored brushless DC motor control

Started by david, Nov 11, 2024, 09:21 AM

Previous topic - Next topic

david

Hi All,
Has anyone tried sensored BLDC motor control with a PIC?  It doesn't look too difficult but I don't think there would be any cost advantage as the market is full of cheap 300-500W controllers.  Main objective would be for form factor and more consistent configuration.  Many of the parameters of the controllers are factory configurable but finding out what you're going to get is near impossible and likely to change with future orders.  Most of the controllers I've seen for hub motor use tend towards high parts counts with multiple BJTs for Mosfet drive whereas there are many excellent half bridge and even triple half bridge chips that make this so much easier and smaller.
Producing the required waveforms for 6 step trapezoidal drive with PWM is simple enough but I have no idea if start up is an issue for Hall sensored motors or how much filtering the Hall feeds may need.
I'd be keen to hear from anyone who may have been down this road before, particularly about testing methods that don't require a fire extinguisher and a bucket for dead FETs.  I have made up a 3 phase Hall generator so I can put the main logic chip through it's paces at various speeds but it's still not the same as connecting up a motor.

Cheers,
David

Stephen Moss

Sort of in that I used an Arduino (inherited) as part of a teaching lab one electric vehicle drive and the Arduino has an AMTEL Micro-controller.

It drives the inputs to some Infineon Motor Shields each with 2 half bridges, those specific shields are no longer available although there is currently an alternative with 3 half bridges so you can drive all three DLDCM phased from a single board that has the same interface, H/L for switching the half bridge output to the High/Low side and In(hibit) where the PWM signal is connected. The alternative would be one with a microcontroller on it, but then control is via SPI- I have not really looked into those as possible replacements yet.

The PWM for the DLDCM comes from a single output and is switched via a Quad AND so that no PWM signal is provided to the Phase that is off, but I use two other PWM outputs (synchronized from the same Timer). One drives a brushed DC motor acting a load, i.e. simulate going up hill, the other is the clock for a logic analyzer for debugging the PWM/control signals & a test point to check the PWM is running with an Oscilloscope.

I have no filtering on the Hall outputs from the DLDCM, they just go straight into the Arduino and are read directly.
I don't really appear to have any problems with starting the motor, from memory I think I just check the hall sensors to know which outputs to switch initially and set the modulation depth quite high as a 1Kg disc is mounted to the shaft so I give it a good kick to get it moving. As soon as it starts to move normal commutation switching based on the hall output state applies and the PWM modulation depth is adjusted as required.   

The one problem with using the Arduino is that the default PWM frequency from the AMTEL device is 33KHz and I calculated that for the Motor Shield we are using it should be 22KHz max, it is possible to alter it but not easy as for the AMTEL device it requires changing from an 8-bit modulation depth value to a 16-bit one (0-400) and changing the frequency change the power into the motor so a lot of value refactoring is required to account for that.

I don't know if that is of any help.

basparky

Hi, I have made a wheelchair controller which has two bruschless 250W 24V sensored motors in it. It uses a dspic33EP256MU810 and the IR2136 mosfet driver. Did encountered some troubles with Hall sensor feedback noise due through high start currents but overall a nice setup. I used some hardware filteirng and software filtering for the hall sensors. This software filtering was possible because of the low speed of the motors in this case.
 
I also have another project with a single 250W 36V sensored Bldc motor which uses a dsPic 33FJ128MC706A and the IR2136 mosfet driver. ALso issues with hall sensor feedback which costs me a few Mosfets and so on:(

I simply made a test rig with the motor mounted and started from scratch. After having the hall sensors right things are pretty straight forward. I do admid i have a bucket with broken parts after a few of these projects;)
Happy to share some schematics or code here if you want.



Fanie

Sounds like a cool project basparky !
And well done for getting it done too.

If I may... 250W sounds a bit lame.  I'll be ashamed to even give something like that to my 187 year old mother !
No seriously.  My humble opinion is one should always strive for higher and better.
If we didn't, we'd still be stuck on floppies and a few mb hard drives.  Back then we couldn't imagine how you are going to fill all that silicone up eh !
At least we could all play space invaders.

https://www.youtube.com/watch?v=gWYRhaOd1PE
Insane 80hp Electric mobility scooter from HELL!

the "from HELL!" is only there to con you into watching the video.

For longer range trips on your chair, do consider a Hayabusa engine.
https://www.youtube.com/watch?v=1z43muPetNc
Fastest MOBILITY SCOOTER!

Well, if you have a large house you can still make the bathroom in (less) time  :o
You can always afterwards apologize for the noise.

Fanie

There is a way to get more out of an electric motor than 3 phase control and that is to use all the poles at the same time instead of only 2/3rd.  Then with sensors you determine when and how to switch.
The biggest restriction is to get the correct metal combination that can switch poles at a high rate.
Explained in the first video.
https://www.youtube.com/watch?v=j2IBnKouLDg
KLD oneDrive Electric Vehicle Propulsion System
https://www.youtube.com/watch?v=8KZJUdvEFdU
KLD Fox 11 Morning and Afternoon Clips with teasers

david

Stephen,
Many thanks for sharing your experiences there.  It sounds like a very interesting lesson and set up you have.  My only experience with motor drives is PWM of brushed motors for RC boats.  These were typically an 8 pin micro directly driving one TO-220 FET.  At full power these would draw around 20A at 12V with a 58A start up.  I thought direct drive was a bit dodgy but the FET never got hot and I never lost a micro.  I've since moved on to brushless motors in models but wouldn't even think about trying to make them because I can buy a finished controller for under $10.  The current foray in to bigger brushless motors is still exploratory as I gather information about it before deciding if it's just another dumb idea of mine.
Thanks again.

Cheers,
David

david

#6
basparky,
A special thanks for kind offer of code and schematics.  In the last few days I have acquired a heap of schematics off the web and the bootstrapped half bridges look like the best option to minimise parts count and area.  The 3 phase half bridge device you have selected is perhaps an even better option and one I'll look in to further.
I have briefly entertained the idea of a full complimentary half bridge, using P and N channel Fets. This simplifies drive requirements and removes the need for bootstrapping supply lines.  I suspect one of the models sold on Aliexpress may be using this approach as it has very few parts compared to most of the hub motor controllers I've opened.  The risk is that switching times may be slower than when using a decent gate driver and there are less options in low RdsOn P ch Fets.
From your experience with Hall sensors I think it would be advisable for me to at least allow some filtering in hardware.  Of course RC filtering also adds phase shift, adding offsets between rotor and stator so there must be limits to this.  Lots to learn still.  Thanks again for your reply and offers of help.

Cheers,
David

david

Gidday Fanie,
Those first two links are absurd but sadly a 222W.H Lipo battery isn't going to last long with a 60kW motor.  Certainly something to look forward to in the not too distant future.

The other more serious links look interesting but I'll have to follow them up later in the day.  There's certainly no issue with electric motors but still some way to go for batteries to approach the specific energy of gasoline.  Of course electric motors are considerably more efficient so batteries only need to have about 30% of the energy density to be considered on par.
Best wishes from the assh bottom of the world.

David

 

basparky

Quote from: Fanie on Nov 11, 2024, 06:41 PMThere is a way to get more out of an electric motor than 3 phase control and that is to use all the poles at the same time instead of only 2/3rd.  Then with sensors you determine when and how to switch.
The biggest restriction is to get the correct metal combination that can switch poles at a high rate.
Explained in the first video.
https://www.youtube.com/watch?v=j2IBnKouLDg
KLD oneDrive Electric Vehicle Propulsion System
https://www.youtube.com/watch?v=8KZJUdvEFdU
KLD Fox 11 Morning and Afternoon Clips with teasers

Awesome! but where do we start to make such motor ourself?;) Is there anymore information available from this kind of motor configuration?

midali

Hi David ,

   Look IFX007 from Infineon . Its half bridge , P+N , driver , feedback for curent, thermal protection, overload protection, a wide voltage accepted : 5-40V . I use it for brushed motors up to 280W .
   The BLDC project with PIC is very interesting....Good luck !


david

Quote from: midali on Nov 12, 2024, 03:44 PMHi David ,

   Look IFX007 from Infineon . Its half bridge , P+N , driver , feedback for curent, thermal protection, overload protection, a wide voltage accepted : 5-40V . I use it for brushed motors up to 280W .
   The BLDC project with PIC is very interesting....Good luck !



Hi midali,
What a beast of a chip.  It looks ideal for brushed motors. 
For the brushless project I'm looking long and hard at the IR2136 driver, as suggested by basparky.  The other option I'm considering is the DVR8300D from TI.  I also found a pin for pin Chinese knock-off of this - JY213L.
I've still got a long way to go but my enthusiasm is growing.  Code errors will be much more spectacular than writing a display driver.
Thanks for mentioning that device - now filed.

Cheers,
David

midali

Some time ago I tried to do an BLDC ESC with the A4933 driver from Allegro and had no succes. I'm amateur in programming and I didn't know how to finalize it.

I have about 30 pieces left in stock, if it helps you, I'll send them to you gladly, it doesn't cost anything.

david

#12
Hi midali,  that's another impressive chip and would seem to have everything you need.  Looks like it also does the PWM/commutation gating also, both high and low side.
It's a very kind and generous offer but I have just ordered a few of the attached boards for doing software development.  These are using 3x half bridges and a Chinese chip JY01 which does all the gate drive logic timing and the PWM.  I will check the boards out as received and then remove the Chinese chip and connect (hopefully) my own PIC controller chip in to the half bridge logic inputs.
The second attachment shows my early attempts - the top 3 traces are commutation with PWM (high side drive), the next 3 traces are commutation only (low side) and the last 2 traces are 2 of the 3 Hall sensor inputs (generated by another PIC)
This is so far very simple code and will be my starting point before tuning for maximum smoke....
Thanks again for such a kind offer but I fear postage alone would be well in excess of the boards I have on order.
What a shame you didn't get your boards running - it looks like a really good chip.

Cheers,
David

basparky

Quote from: david on Nov 13, 2024, 10:23 PMHi midali,  that's another impressive chip and would seem to have everything you need.  Looks like it also does the PWM/commutation gating also, both high and low side.
It's a very kind and generous offer but I have just ordered a few of the attached boards for doing software development.  These are using 3x half bridges and a Chinese chip JY01 which does all the gate drive logic timing and the PWM.  I will check the boards out as received and then remove the Chinese chip and connect (hopefully) my own PIC controller chip in to the half bridge logic inputs.
The second attachment shows my early attempts - the top 3 traces are commutation with PWM (high side drive), the next 3 traces are commutation only (low side) and the last 2 traces are 2 of the 3 Hall sensor inputs (generated by another PIC)
This is so far very simple code and will be my starting point before tuning for maximum smoke....
Thanks again for such a kind offer but I fear postage alone would be well in excess of the boards I have on order.
What a shame you didn't get your boards running - it looks like a really good chip.

Cheers,
David

Hi David, I have been using that board also in my setups. Very cheap and had good succes. For me impossible to build such a cheap bldc controller myself. Hope you succeed with replacing the YU01. PLease let me know you r progress:)

david

Hi basparky,
I've only today ordered the boards along with some spare Mosfets so haven't yet tried lifting the JY01 chip yet.  I'll run the boards as they are to get some data off the system before removing the controller chip.  The JY01 probably does all we need but I would like to try dynamic braking by turning on all low side FETs (at lower speeds) and that's mainly why I need my own controller.
You're right about the cost.  I would be lucky to buy 1 Mosfet locally for the price of the entire board.  It's just a pity the Hall sensor version of that board doesn't come with a heat sink but I'll sort something out.

Cheers,
David