Open Sensorless BLDC controller

Electric Motors and Controllers

Re: Open BLDC controller

Postby bigmoose » Tue May 15, 2012 7:15 pm

The proto's will work fine either way. If you were to manufacture them and have them used widely in the field, that is when you will see the problem. In the area I work in we must analyze for solder fatigue under vib and shock loads. My comment and advice comes from that experience. Granted, we are talking about environments 6 sigma more severe than an eBike, but the principles hold in general across the board.

... or as others have said to me: "Moose you are ruined for designing consumer products!" :P
bigMoose's electronic pieces & parts (GENUINE IRFB4110Pbf's, Nomex 410, AntiCorrosion Grease, Current Sensors) available HERE.
Thanks to Justin ebikes.ca for securing the board then setting us FREE! Tech Tips in the WiKi: http://endless-sphere.com/w
"Live simply. Love generously. Care deeply. Speak kindly. Leave the rest to God..." all the best, Dave
User avatar
bigmoose
10 MW
10 MW
 
Posts: 2451
Joined: Thu Aug 06, 2009 3:05 pm
Location: Northern Ohio, USA

Re: Open BLDC controller

Postby salty9 » Tue May 15, 2012 11:52 pm

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


Yeah, you gotta make it break quick so they will buy another one. :cry:
salty9
1 kW
1 kW
 
Posts: 484
Joined: Fri Aug 14, 2009 10:14 pm
Location: 42.6°N 122.71°W

BEMF filter and ZC detection

Postby walls99 » Wed May 16, 2012 7:47 am

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:
bemf_filter_3.zip
BEMF filter LTspice
(873 Bytes) Downloaded 103 times
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby walls99 » Wed May 16, 2012 12:20 pm

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! :)


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! I did spend a bit of time to get the solar power management working on my gen 2 controller for solar RC planes but it's still many hours to get everything working...

see below the picture of my first gen prototype
Image
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby bigmoose » Wed May 16, 2012 12:43 pm

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! ...


Congrats on the journey! Those who have walked with you can relate. It "looks" so easy... but it's not, to do the integrated system well.
bigMoose's electronic pieces & parts (GENUINE IRFB4110Pbf's, Nomex 410, AntiCorrosion Grease, Current Sensors) available HERE.
Thanks to Justin ebikes.ca for securing the board then setting us FREE! Tech Tips in the WiKi: http://endless-sphere.com/w
"Live simply. Love generously. Care deeply. Speak kindly. Leave the rest to God..." all the best, Dave
User avatar
bigmoose
10 MW
10 MW
 
Posts: 2451
Joined: Thu Aug 06, 2009 3:05 pm
Location: Northern Ohio, USA

Re: BEMF filter and ZC detection

Postby casainho » Wed May 16, 2012 1:04 pm

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:
bemf_filter_3.zip

Thank you for this information. I did read something about using the PWM OFF time to read directly the Zero Crossing.

Right now I am experimenting to learn and be able to detect the rotor position, using the current sensing as you described. Later I need to implement the startup strategy.
I found that one parts of mosfet drivers are not working as expected (much slow turn on) and I need to find why. A big change is that my ARM works at 3.3V and the original controller worked at 5V, so, the drivers may need 5V logic.

Hmm, I don't know about spice simulation... is there any OpenSource software for it? (I am limiting myself to OpenSource software).
Smart EBike (OpenSource): Dashboard/color display with touchscreen + Motor controller + Battery pack BMS:
  1. hackable/configurable options for advanced users
  2. Bluetooth communications with SmartPhones
  3. wireless communications between each three systems
Project page with documentation and source files: www.smartebike.likesyou.org
casainho
100 W
100 W
 
Posts: 254
Joined: Mon Feb 14, 2011 2:43 pm

Re: Open BLDC controller

Postby S.B.D » Sun May 20, 2012 8:53 am

Hey Walls,

I am finding this thread very educational and learning a lot from it. Your design makes my DIY sensored BLDC controller look like a broken toaster.... :mrgreen:
I'm just starting to understand sensorless detection methods. Can you give a short explanation on your BEMF detection design?
The analog circuit is straight forward and I understand it well. The FW implementation is new to me.
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?
Keep posting and updating..

Thanks,
S.B.D
S.B.D
100 mW
100 mW
 
Posts: 48
Joined: Thu Dec 29, 2011 1:59 pm

Re: Open BLDC controller

Postby walls99 » Sun May 20, 2012 6:35 pm

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?

The comparator outputs are "sampled" continuously by the Input Capture module independently of the PWM signal. Interferences from the PWM are filter out by the analog low pass filter and the digital noise filter integrated in the PIC, check section 16.3 of the 18F4431 datasheet for more info.

In running mode, the Input Capture is only enable for the comparator output you expect an event from and only from 15º before the expected zero-crossing until it happens or time's out. see the function below for more info on the Input Capture setup depending on the step/position:

Code: Select all
LOAD_IC     org 0x1000
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby casainho » Sun May 20, 2012 6:56 pm

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.
Smart EBike (OpenSource): Dashboard/color display with touchscreen + Motor controller + Battery pack BMS:
  1. hackable/configurable options for advanced users
  2. Bluetooth communications with SmartPhones
  3. wireless communications between each three systems
Project page with documentation and source files: www.smartebike.likesyou.org
casainho
100 W
100 W
 
Posts: 254
Joined: Mon Feb 14, 2011 2:43 pm

Re: Open BLDC controller

Postby walls99 » Mon May 21, 2012 9:36 am

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.


Here is the LTspice model based on Bearing's model:
motor_sim_0.4.zip
(2.52 KiB) Downloaded 61 times


And the picture:
Image
Last edited by walls99 on Mon May 21, 2012 7:40 pm, edited 1 time in total.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby bearing » Mon May 21, 2012 5:56 pm

Nice!
I'm happy someone made use of that spice model. I see you have made some enhancements too.
bearing
1 kW
1 kW
 
Posts: 449
Joined: Wed Dec 24, 2008 2:14 am

Re: Open BLDC controller

Postby walls99 » Mon May 21, 2012 7:42 pm

bearing wrote:Nice!
I'm happy someone made use of that spice model. I see you have made some enhancements too.

I'm glad you recognized it, I couldn't remember where I found it and give you proper credit for the original model. Thanks!
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Open BLDC controller update

Postby walls99 » Fri May 25, 2012 9:26 am

Progress update:
- PIC clock increased to 40MHz do to more stuff per 50us PWM cycle.
- Implemented and tested temperature monitoring and management for the mosfets
- Implemented regenerative braking
- Stress tested with 90A phase current accelerations up to 4600RPM (~1900W) then 40A regen braking

See below the battery current, voltage and power during the stress test. Note that regen current appears as positive:

Image

Todo:
- Test on my Goped...
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Open BLDC controller testing

Postby walls99 » Sun May 27, 2012 2:49 pm

walls99 wrote:Todo:
- Test on my Goped...

6km of road testing later, I'm happy to report that the controller is working well!

The top speed is 34Km/h as expected. Regenerative braking is also working but the fixed braking phase current makes it too aggressive at speed, so I probably need to control to power rather than phase current to have a more progressive braking experience. However it does feel great to know that some of the kinetic energy is returned to the battery rather than being wasted in heat in the brake disk!!!!

Image
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby dnmun » Sun May 27, 2012 3:20 pm

just exceptional, really nice thread to follow your progress.

i would request you change the title to "open source BLDC motor controller" so it will come up more rapidly on google search since it is the more commonly used term.

really really nice.
dnmun
100 GW
100 GW
 
Posts: 9203
Joined: Mon Jun 09, 2008 1:32 pm
Location: portland, or and loveland, co

Re: Open BLDC controller

Postby casainho » Sun May 27, 2012 4:06 pm

walls99, great news!!

Will you design a PCB for this controller? I would use if it could control my 24V 250W electric bicycle. I could buy the components, assembly and test my board.

Why don't you put the firmware and schematic/board sources on Github (as other Open Source projects)??

dnmun wrote:i would request you change the title to "open source BLDC motor controller" so it will come up more rapidly on google search since it is the more commonly used term.

Good idea but I would also use the words "ebike" on the title for the same reason.
Smart EBike (OpenSource): Dashboard/color display with touchscreen + Motor controller + Battery pack BMS:
  1. hackable/configurable options for advanced users
  2. Bluetooth communications with SmartPhones
  3. wireless communications between each three systems
Project page with documentation and source files: www.smartebike.likesyou.org
casainho
100 W
100 W
 
Posts: 254
Joined: Mon Feb 14, 2011 2:43 pm

Re: Open BLDC controller

Postby walls99 » Sun Jun 03, 2012 2:02 pm

casainho wrote:Will you design a PCB for this controller? I would use if it could control my 24V 250W electric bicycle. I could buy the components, assembly and test my board.
Why don't you put the firmware and schematic/board sources on Github (as other Open Source projects)??


I have designed a custom PCB for my Goped controller, see pictures below. I'm happy to share the design with other who want to use it as a starting point but I wouldn't recommend a straight copy of it.

Image

Image

Image

Image

Image
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby Arlo1 » Sun Jun 03, 2012 7:13 pm

Walls I frocking love it!!! Thats easily more powerfull then a 12 fet with 4110s!
Last edited by Arlo1 on Sun Jun 03, 2012 8:18 pm, edited 1 time in total.
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUF
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
[color=#FF0000][b][size=150]Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5227
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Open BLDC controller

Postby kfong » Sun Jun 03, 2012 8:16 pm

Subscribed, Nice work
kfong
1 MW
1 MW
 
Posts: 1648
Joined: Tue Sep 02, 2008 11:34 am
Location: SE Michigan, USA

Open Sensorless BLDC controller summary

Postby walls99 » Thu Jun 07, 2012 12:44 pm

FYI, I have updated the 1st post to add a summary and more details on the story behind this projects.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Open BLDC schematics and layouts

Postby walls99 » Sun Jun 17, 2012 11:13 am

walls99 wrote:I'm happy to share the design with other who want to use it as a starting point but I wouldn't recommend a straight copy of it.


Here are the schematics and board layouts for the brain and brawn of my controller. I have updated them with all the changes I made on my prototype, so use them at your own risk.

Hoverboard_blmc_brain_40.zip
(87.41 KiB) Downloaded 163 times


Image

Hoverboard_blmc_brawn_40.zip
(70.52 KiB) Downloaded 122 times


Image
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC schematics and layouts

Postby casainho » Fri Aug 31, 2012 5:33 am

Hey, thanks for sharing!!

I am planning to buy the components and assembly by hand on a perfboard the power section. I really like the modular way of the system. I also want to use the ARM processor/board I am familiar with and program in C instead of assembly.

I also want modular because I plan to use bluetooh UART module.
Smart EBike (OpenSource): Dashboard/color display with touchscreen + Motor controller + Battery pack BMS:
  1. hackable/configurable options for advanced users
  2. Bluetooth communications with SmartPhones
  3. wireless communications between each three systems
Project page with documentation and source files: www.smartebike.likesyou.org
casainho
100 W
100 W
 
Posts: 254
Joined: Mon Feb 14, 2011 2:43 pm

Re: Open BLDC controller

Postby bearing » Fri Sep 14, 2012 7:52 am

walls99 wrote:I have corrected a few bugs and enhanced some on the synchronization loops to be more stable, please find the updated source code below:

Open_BLMC_1_1.zip

Change log:
    Fixed throttle range in non car mode, 1.1ms = 0 and 1.9ms = 100%, new sync algo in ZC locked state,
    Made brake mode optional, new sync algo for RC locked state, new filter for RC input.


Is this the latest version of the projekt?

I would like to play with this, and then maybe make a board which can drive a 80100 on 80V.
bearing
1 kW
1 kW
 
Posts: 449
Joined: Wed Dec 24, 2008 2:14 am

Re: Open BLDC controller

Postby walls99 » Mon Sep 17, 2012 9:41 pm

bearing wrote:Is this the latest version of the projekt?

I would like to play with this, and then maybe make a board which can drive a 80100 on 80V.


No, it's quite out of date. I'm planning on releasing new soft but I haven't had the time to finalize everything I wanted. They are many upgrade to handle "high power": Torque control, automatic advance timing, sensorless startup, temperature control, regenerative braking...

I've sent you a PM to discuss alpha release, if you're interested?
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open BLDC controller

Postby casainho » Tue Sep 18, 2012 2:36 am

walls99 wrote:
bearing wrote:Is this the latest version of the projekt?

I would like to play with this, and then maybe make a board which can drive a 80100 on 80V.


No, it's quite out of date. I'm planning on releasing new soft but I haven't had the time to finalize everything I wanted. They are many upgrade to handle "high power": Torque control, automatic advance timing, sensorless startup, temperature control, regenerative braking...

I've sent you a PM to discuss alpha release, if you're interested?

Walls99, please share your code on github. There you also have a wiki were you can place the information. Thank you.
Smart EBike (OpenSource): Dashboard/color display with touchscreen + Motor controller + Battery pack BMS:
  1. hackable/configurable options for advanced users
  2. Bluetooth communications with SmartPhones
  3. wireless communications between each three systems
Project page with documentation and source files: www.smartebike.likesyou.org
casainho
100 W
100 W
 
Posts: 254
Joined: Mon Feb 14, 2011 2:43 pm

PreviousNext

Return to Motor Technology

Who is online

Users browsing this forum: No registered users and 6 guests