Open Sensorless BLDC controller

Electric Motors and Controllers

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: 5223
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: 1646
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 161 times


Image

Hoverboard_blmc_brawn_40.zip
(70.52 KiB) Downloaded 121 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

Re: Open Sensorless BLDC controller

Postby nieles » Sun Sep 23, 2012 8:50 am

hi walls99,

i would like to make a similar inertia dyno for some controller testing.

what material did you use for the flywheel? i would like to use MDF, but i am a little concerned with the centrifugal forces and the flywheel breaking.

very cool project btw!
nieles
1 kW
1 kW
 
Posts: 469
Joined: Mon Jul 14, 2008 5:39 pm
Location: The Netherlands

Re: Open Sensorless BLDC controller

Postby walls99 » Mon Sep 24, 2012 5:51 am

nieles wrote:hi walls99,

i would like to make a similar inertia dyno for some controller testing.

what material did you use for the flywheel? i would like to use MDF, but i am a little concerned with the centrifugal forces and the flywheel breaking.

very cool project btw!

Hi Nieles,
I used 16mm particle board, I'm sure MDF would be fine too, probably better from the balancing point of view. I wouldn't worry about the flywheel breaking but your motor mount! At speed >1000RPM I really had bad vibrations, as seen in the video due to the lack of balancing of my DIY flywheel.
So it was perfect for testing start-up, low speed and regen but not good for high speed testing for more than a few seconds.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open Sensorless BLDC controller

Postby casainho » Mon Sep 24, 2012 5:59 am

walls99, could you please tell me if you think the motor could work (with load, like on a bicycle wheel, starting from 0 velocity) only with current feed-back and not BEMF?

I got my motor running but without BEMF.



I made some simple but interesting tests.

With 15% duty-cycle and 10ms the motor were running very slow (about 12 RPMs, motor Cute85 for 20'' wheel). But I were using the variable power supply and I could change the power applied to motor by defining the voltage supply.

(Case 1) I found that with a lower voltage, like say 15V, the motor don't turn or vibrates/makes noise/small turns. (Case 2) If I rise slow the voltage it starts to turn up to a velocity which seems to be perfect (but slow due to the 10ms), no noise, no vibrations. But if I brake the motor with the hand, it starts to vibrate/make noise and stops...

(Case 3) Continuing, if I rise the voltage (without braking the motor with my hand) the motor starts vibrating/making noise again but this time rising also the current/power used!!! Then I tried to brake and it stopped to make noise/vibrations but the current still high. I had a bit difficult to brake and stop the motor. I rise again the voltage and keeping brake the motor, until I found I couldn't no more brake it!! it turns with strong power, no vibrations nor noise.
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 Sensorless BLDC controller

Postby walls99 » Mon Sep 24, 2012 7:53 am

casainho wrote:walls99, could you please tell me if you think the motor could work (with load, like on a bicycle wheel, starting from 0 velocity) only with current feed-back and not BEMF?

I got my motor running but without BEMF.

I made some simple but interesting tests.

With 15% duty-cycle and 10ms the motor were running very slow (about 12 RPMs, motor Cute85 for 20'' wheel). But I were using the variable power supply and I could change the power applied to motor by defining the voltage supply.

(Case 1) I found that with a lower voltage, like say 15V, the motor don't turn or vibrates/makes noise/small turns. (Case 2) If I rise slow the voltage it starts to turn up to a velocity which seems to be perfect (but slow due to the 10ms), no noise, no vibrations. But if I brake the motor with the hand, it starts to vibrate/make noise and stops...

(Case 3) Continuing, if I rise the voltage (without braking the motor with my hand) the motor starts vibrating/making noise again but this time rising also the current/power used!!! Then I tried to brake and it stopped to make noise/vibrations but the current still high. I had a bit difficult to brake and stop the motor. I rise again the voltage and keeping brake the motor, until I found I couldn't no more brake it!! it turns with strong power, no vibrations nor noise.


It looks like you are running in open loop, so this is the expected behaviour. This mode of operation is not really usable as you can't control timing or torque, however it's a good 1st step to understand brushless motor control :)
BEMF sensing/timing and close loop control is the logical next step but it's also more complicated. Using only current feedback is possible but a lot more complicated, see FOC theory.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open Sensorless BLDC controller

Postby casainho » Tue Sep 25, 2012 7:47 am

walls99 wrote:It looks like you are running in open loop, so this is the expected behaviour. This mode of operation is not really usable as you can't control timing or torque, however it's a good 1st step to understand brushless motor control :)

Yes! I need to feel to understand.

walls99 wrote:BEMF sensing/timing and close loop control is the logical next step but it's also more complicated. Using only current feedback is possible but a lot more complicated, see FOC theory.

I would like to work on a robust start-up scheme. I read about yours (you shared before on this post) but my hardware lacks a current sensor, it just reads very high current value (probably the maximum current). Could you please share your thoughts about this system that don't reads current, only the maximum? how do you think it works? PLEASE see my controller schematic PDF and here more info about the controller.

Could you please share your thoughts about the BEMF circuit of this controller?

Since the controller don't have current sensor, I am thinking in trying to start-up the motor by making it rotate at slow and constant speed (10ms commutation in my motor) and going increase the duty-cycle up to get rotation/signal of BEMF. I must care about maximum current or I may miss the BEMF circuit but short-circuit the motor with maximum current/duty-cycle. What do you think about this idea?
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 Sensorless BLDC controller

Postby walls99 » Tue Sep 25, 2012 8:05 am

Hi Casainho,

I'm afraid you are a bottom of a steep learning curve and I don't really have time to help you with the basic principle of sensorless BLDC control, there is a lot literature out there for that. I'll keep an eye on your progress here and help if I can.

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

Re: Open Sensorless BLDC controller

Postby casainho » Tue Sep 25, 2012 8:08 am

walls99 wrote:Hi Casainho,

I'm afraid you are a bottom of a steep learning curve and I don't really have time to help you with the basic principle of sensorless BLDC control, there is a lot literature out there for that. I'll keep an eye on your progress here and help if I can.

Thanks.

Ok, thank you. I will keep reading your work that you share here. Thanks for sharing.
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 Sensorless BLDC controller

Postby casainho » Fri Oct 05, 2012 3:26 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?

I am reading your firmware V1.1 and I want to learn with it. Some years ago I wrote code in assembly for PICs and AVRs, it is nice to read your code and remember those times and also see how you did you resolve the questions about BLDC ;-)

Thank you for sharing the source file with the comments. Please fully comment your new code, if possible. Thank you.

My current notes to your firmware/system:
- Timer1 is used for measure throttle impulse time; CCP1 is used to detect start and stop of throttle impulse.
- Battery/system low voltage detection resets the system.
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 Sensorless BLDC controller

Postby casainho » Mon Oct 08, 2012 4:31 am

Hello Laurent.

Could you please tell me what is:
1 - the meaning of AUTO_STEP and STEPPING_ON flags on BMC_STATUS variable? When they are 1, what system is supposed to do?
2- Windmill strategy for start-up you mention on the code is the same as you explained here? viewtopic.php?f=30&t=36479&start=15#p534016

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 Sensorless BLDC controller

Postby walls99 » Tue Oct 09, 2012 2:28 am

casainho wrote:Hello Laurent.

Could you please tell me what is:
1 - the meaning of AUTO_STEP and STEPPING_ON flags on BMC_STATUS variable? When they are 1, what system is supposed to do?
2- Windmill strategy for start-up you mention on the code is the same as you explained here? viewtopic.php?f=30&t=36479&start=15#p534016

Thank you.


The "Windmill" strategy start-up relies one the motor already rotating and simply waiting for a few ZC to synchronize the timing loop. This requires the user to push the motor/vehicle to start.
The start-up by position/current sensing is an active way to start the motor by exciting the motor as if hall sensor where used.
STEPPING_ON enable/disable stepping. Stepping need to be off during windmill start-up
AUTO_STEP is a flag that indicates the next step is updated automatically based on the timing of the BEMF zero crossing.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open Sensorless BLDC controller

Postby casainho » Tue Oct 09, 2012 10:52 am

walls99 wrote:The "Windmill" strategy start-up relies one the motor already rotating and simply waiting for a few ZC to synchronize the timing loop. This requires the user to push the motor/vehicle to start.

Ok, thanks.

walls99 wrote:The start-up by position/current sensing is an active way to start the motor by exciting the motor as if hall sensor where used.

This is not implemented on the latest firmware V1.1 you shared, right?

I need to read more and learn about the need of demagnetization... Could you please explain the ADV_TABLE -- "Calculate the advance value using a table (hardware dependant)"??
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 Sensorless BLDC controller

Postby casainho » Thu Oct 11, 2012 6:08 am

Hello Laurent.

I am looking at the schematic components values, as I am trying to understand it better and make a BOM. I am thinking if I can invest on this board/project and use it to control my electric bicycle of 48V and motor of 500W (but for start I will test with my old system of 24V and 250W motor). Do you know if this board/system is able to control my motor of 48V (Q100 350W motor)??

If I invest, I will need to do it also for buying a PICKit2 for programming and debug the firmware, as I will want to make the firmware in C and not assembly as you did. I will develop on Linux. I will also add the Bluetooth module to UART RX and TX lines.

How did you produced your PCBs? Do you have experience with a service for PCBs? Can you recommend a service for PCBs?
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 Sensorless BLDC controller

Postby walls99 » Sat Oct 27, 2012 1:03 pm

casainho wrote:Hello Laurent.

I am looking at the schematic components values, as I am trying to understand it better and make a BOM. I am thinking if I can invest on this board/project and use it to control my electric bicycle of 48V and motor of 500W (but for start I will test with my old system of 24V and 250W motor). Do you know if this board/system is able to control my motor of 48V (Q100 350W motor)??

If I invest, I will need to do it also for buying a PICKit2 for programming and debug the firmware, as I will want to make the firmware in C and not assembly as you did. I will develop on Linux. I will also add the Bluetooth module to UART RX and TX lines.

How did you produced your PCBs? Do you have experience with a service for PCBs? Can you recommend a service for PCBs?


You will have to make a few software and hardware adjustment to run my design at 48V. It's currently set up for 30V and use IRLP3034 instead of IRFP4368. However this e-bike hub motor is not really difficult to drive and can't handle 100A, so you are probably better off using an simple e-bike controller...

For my PCB, I use PCB-POOL.
User avatar
walls99
10 W
10 W
 
Posts: 96
Joined: Wed Mar 11, 2009 5:34 am
Location: UK

Re: Open Sensorless BLDC controller

Postby casainho » Sat Oct 27, 2012 1:42 pm

walls99 wrote:You will have to make a few software and hardware adjustment to run my design at 48V. It's currently set up for 30V and use IRLP3034 instead of IRFP4368. However this e-bike hub motor is not really difficult to drive and can't handle 100A, so you are probably better off using an simple e-bike controller...

For my PCB, I use PCB-POOL.

Thank you. I were reading your assembly code and I did understand a few more things, but is hard. I changed my ideas and for now I will go with hall sensors, is much more easy and will also let me understand better how all this work/should work.

I have now the schematic and firmware almost done (in C). Here some pictures of my working prof of concept (KU63 controller adapted to be controlled from external microncontroller LPC2103):

Image

Image

Image

As you can see, I am using the same current sensor (ACS756 50A) as you do - thanks for sharing!

Before adding the current sensor (ACS756 50A):
Image
Last edited by casainho on Sat Oct 27, 2012 1:45 pm, edited 2 times in total. View post history.
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: Positioning by current sensing

Postby casainho » Thu Nov 01, 2012 6:47 am

walls99 wrote:
barryfzr wrote:I had decided to go down the sensor route though with an Austria Micro Systems As5040(or lower spec 8bit output) which can provide the commutation signals direct.

I was also planning to use position sensor to have full start-up torque but I found that position sensing by current measurement works very well with this type of motor. 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:

Image


Last time I wanted to go with Hall sensors and avoid BEMF since it is difficult to start with. But quickly one Hall sensor of my motor stoped to work -- maybe I made some short circuit with it. I am now back to BEMF and I were able to reproduce your results.

On my motor Cute 85, 24V, 250W, I can energize it by 100us and found the position of rotor/sector. Interesting is that my results are a bit different from yours, because energizing 100us I only get current on 2 sectors (one getting more current than the other). Using like 500us I will get current in all sectors however the current on the 2 aligend/"strong" sectors will be to much high!

Here is a screenshot of my scope:
Image
Yellow: current signal
Blue: mosfet gate voltage
Attachments
energize.jpg
energize.jpg (75.55 KiB) Viewed 541 times
Last edited by casainho on Thu Nov 01, 2012 6:50 am, edited 1 time in total. View post history.
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: kenkad and 1 guest