-
Bldc Controller Software카테고리 없음 2020. 2. 12. 04:47
IMPORTANT UPDATE I have written a new post about my open ESC on and also updated the hardware significantly. If you haven’t built it yet and if you are planning to order parts for it, please refer to that page. I will only leave this page for reference in case you have built it before I wrote the new post and updated the hardware. Also, If you have built the ESC before, the tutorial and software on the new page also applies to the old hardware.
Updated 2014-12-08For about three years I have been working on a custom motor controller (also known as an ). I have spent hundreds of hours on writing code and I have made many minor and four major revisions of the printed circuit board (PCB). Now I finally have something that I can publish. Sudo apt-get install qtcreator qt-sdkqmakemakesudo apt-get install qtcreator qt-sdkqmakemakeNow you should be able to start the program and connect to the motor controller. A short tutorial to run a motorIn this section I will describe how to run an motor in sensorless mode from Ubuntu Linux. The reason for using an outrunner is that the parameters in the github project are tuned to work with most of my outrunners that I have at home.
Adjusting MCPWMCYCLEINTLIMIT in the mcconf file can affects the timing and should be tuned for each individual motor.Note: The start-up torque in sensorless mode is higher than on most sensorless hobby ESCs, but the algorithm to start the motor will cause a delay before closed-loop commutation can be used. This delay is not desirable when e.g. Building a sumo robot such as, so in such applications a sensored motor and the sensored mode is recommended.
Required steps. Add your user to the dialout group as described. Log out and log back in.
This is done in order to access the serial port emulated by the USB interface of the motor controller. If you don’t any 3g modem on your computer, remove the modemmanager package. This is because otherwise there will be many seconds delay before the Qt program can access the USB port since modemmanager is interfering (I’m sure that this can be solved in some other way).benjamin@benjamin-UX31A:$ sudo apt-get remove modemmanager.
Install a toolchain for compiling and uploading the STM32F4 code. See post for a tutorial.
Download the ChibiOS-version with a minor USB modification:. This modification disables the voltage sensing on the VBUS pin because that pin is used for something else. Compile and upload the program to the motor controller. How to use a discovery board as a programmer can be seen. Assemble the PCB. The component position sheets above are very useful for that. Connect the outrunner motor and a power supply to the BLDC controller.
Download the STM32 code. Set the path in the makefile to where you have extracted ChibiOS. Compile and upload the program. Compile and start the Qt BLDC tool as described above or on the github page. A window like this one should appear:. Make sure that the USB cable is connected and the correct port is chosen in the tool, e.g. If you have other devices that show up as serial ports, the BLDC controller might get another one such as /dev/ttyACM3.
See the dmesg output when connecting the USB cable to see which device is assigned to it:benjamin@benjamin-P5K:$ dmesg tail 8198.248058 usb 1-5.3: new full-speed USB device number 6 using ehci-pci 8198.357182 usb 1-5.3: New USB device found, idVendor=0483, idProduct=5740 8198.357185 usb 1-5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 8198.357188 usb 1-5.3: Product: ChibiOS/RT Virtual COM Port 8198.357191 usb 1-5.3: Manufacturer: STMicroelectronics 8198.357193 usb 1-5.3: SerialNumber: 270 8198.395006 cdcacm 1-5.3:1.0: This device cannot do calls on its own. It is not a modem. 8198.395038 cdcacm 1-5.3:1.0: ttyACM0: USB ACM device 8198.395503 usbcore: registered new interface driver cdcacm 8198.395506 cdcacm: USB Abstract Control Model driver for USB modems and ISDN adapters. Connect to the BLDC controller with the connect button. The lower right corner of the GUI should say Connected.
Use the right and left arrow keys or the buttons in the GUI to run the motor. Activate the real-time sampling (with the checkbox in the main tab) to see the currents etc. In real time. Study the code and use/adapt the interfaces for your own application.This entry was posted in, and tagged,. Bookmark the. Hi Benjamin, I looked at different ESCs, Hobbywing Xerun, ESC32 and for the latter I even started to make some code modifications in the STM32 firmware.I have the feeling yours would be the better start though as the ESC32 is meant for multirotor and I have a car like application. I have browsed through the source code and my main additional requirements would be1.
Closed loop down to zero rpm with a sensored outrunner. The intention is to have super smooth low speed operation and active breaking. To be more precise1.1. The motor startup should not spin the motor to a minimum rpm, it should use forced commutation initially and then switch to proper commutation.
I have seen that in sensorless mode you do have a min rpm.1.2. Requires active breaking, imagine the car would roll downhill by itself with 100rpms, the target rpm is 20 or even zero. So it needs to break actively using regenerative breaking as long as possible and a zero speed apply an initial break force.2. As silent as possible. This is the area I am uncertain but a sinusoidal PWM I would have high hopes for.Anybody interested in joining forces? Anybody interested in a cablecam camera rig?Would greatly appreciate your thoughts-WernerOh, if somebody has a spare board ready to run (I cannot solder SMD) for sell, please contact me. Hi Benjamin,Congratulation!
You made a great piece of software and hardware.Very impressive. Thanks for sharing.I have a Nucleo STM32F401 and I’d like to make a shield for it based on your board to control an outrunner in a closed loop motion project.It seems that we can get all the STM32F4 pins on the morphos connectors.It will be usefull to use the STlink USB connection to run your nice Qt supervisor.In which file is the port config for using PA2 and PA3 in place of PA11 and PA12 for USB?I have to redirect also SENS1 from PA2 to another free port.I get an PARSEERROR on loading “BLDC4.kicadpcb” from GIT, but no problem with your pcb (from ). This is a very interesting project.
I have an ebike application and was looking for suitable FOC controller for some time now, I even attempted my own project with AT90WPM3B (8bit AVR with advanced power stage controller). Found some purchasable controllers, but all of them are either too big or have too many problems, or both. Some explode on heavy startup, others have too low PWM frequency and can’t work with low inductance outrunners, etc So I really hope you will succeed with this.A short question about your MCU choice (STM32F4xx). To my knowledge, it has no analog comparators, meaning that cycle-by-cycle current limiting is harder to achieve and is being done in software.
That usually adds some delays and could end up as a problem, especially with low resistance and inductance motors (for example 10mΩ 15μH). AFAIK, only STM32F303xB/C has this functionality in hardware. Have you considered this part?
I have built a controller but I have problem connecting it tothe usb port. Hi Benjamin,Impressive work!
I am currently doing a quadcopter project and I am going to build a motor controller instead of using ESCs. My motor is rated at 15A, 1100kv. I am planning to use DRV8301 with CSD18502KCS N-channel power MOSFET, and dsPic33E microcontroller. That would give me the max current at 14A. What do you think about this?Also if I were going to use some of your technique, can I design 4 motor controllers in a single board?
That means I have 1 microcontroller, 4 DRV8301/02, and 24 MOSFETs on a single board. Do you think it is possible or do you have any suggestion? And your continuous current is 50A, it would be too much to drive a 15A motor, what would you do to design a lower output current motor controller?One more thing is that I am trying to draw the schematic using Eagle CAD, but I couldn’t find components such as DRV8301/02 and mosfets. Do you have any ideas to find these components library? I know you are using KiCad, and I’m considering using this too, but do you think I can find all the components in KiCAD?Thanks so much. Hi Benjamin,And what a great project!I’d like to know if you have knowledges of references (books, websites, articles) from where it is possible to a lot of the motor (bldc) specific information and strategies.Especially information about designing driver circuits, and running the bldc most efficiently. I’v read a lot of different articles from IEEE and another database (i dont quite remember the name).
It seems like i only get “half” of the facts from these articles.I did make a BLDC controller which worked, not very efficiently anyway. But i’m about to design one for a larger project, for which i’d like some “professional” insight. Cool project! I’ve been looking into trapezoidal projects/examples, as the sinusoidal or foc is more than my 8-bit 8051 can handle. Long story 😉I suppose pwm isn’t needed if you aren’t varying the speed/torque, but if you are, do you have any thoughts on the most common PWM techniques (bipolar vs unipolar, complimentary vs independent)? I have implement three different PWM techniques and I prefer the synchronous one (having one switch on and pulsing between the upper and lower switch on the other phase).
If you don’t want to use braking you can use current control and limit the current. I’m using variable switching frequency to get good samples at low duty cycles. For commutation, I have implemented both zero crossing with delay and integration (both with adjustable timing) and I prefer integrating the voltage because that works better at lower speeds.
Bldc Motor Controller Circuits
Integrating the voltage is a bit tricky at low speeds for some motors since some of the input voltage can be seen on the floating phase. If you’ve already tried that,then I don’t know what would be the cause.Have you tried DRV8301?It’s similar to DRV8302 but it has a SPI interface to set the parameter and more current gain option,otherwise they are identical.And the prices are pretty much the same.Also,you could compare your board with BOOSTXL-DRV8301 and maybe you can find some clues.TI has released the schematic/layout on that website so actually I’m designing a new driver board based on your board and BOOSTXL board.Thank you for your work!Malcolm. Dear Benjamin,I’ve a question according to the use of the VESC in regenerative breaking mode as you discussed here with Alvaro on August 2nd-4th, 2014 who likes to charge a baterie with th VESC. Two days later you wrote:“The braking mode actually switches the MOSFETs exactly the same way as when accelerating, but with a duty cycle that is lower than the corresponding back-emf voltage of the motor. This works because the switching mode is synchronous. This way, the motor windings will be used like the inductors in a boost converter and the current/voltage can be controlled quite accurately. However, if the motor is driven faster than the corresponding battery voltage, the body diodes will start conducting no matter what.
Therefore you have to make sure to use a battery with high enough voltage.”How I’ve to understand “if the motor is driven faster than the corresponding battery voltage,”? Is it just the easy kv calculation kv.rpm must be smaller than the batterie voltage Vbatt, or must the duty cycle be taken into account? Kv.rpm.duty cycle kv = 60Hz. 60sec/min. / 14 / 5V = 51.5.
Batterie voltage is 12V. The maximum speed in generator mode is 3000 rpm, what shoul give about 58V.Will the battrerie be destroied due to the too high voltage or is it possible to reduce the voltage by reducing the duty cycle to e.g.
25% by wiriting a custom application?Thanks for helpmaxi. Maxi, if the motor is driven so fast that the back emf rises above the battery voltage, the battery will charge no matter what you do with the duty cycle. Decreasing the duty cycle has the opposite effect – it will increase the voltage output when acting like a generator, which is why you can use regenerative braking down to very low speed. When you construct a system with a battery and generator, you have to make sure that the generator output (RPM / KV) does not rise above the battery voltage. The are some tricks that you could do with FOC and field weakening, but it will not help much in the general case, and it will waste power. I also recommend using higher battery voltage than 12V to make the VESC and the rest of the system more efficient. Dear Benjamin,I soldered my board everything is OK and config BLDC Tool works well, but went I connect a small load the drv8302 had died, and I used alot drv8302 but all of it have same problem, I don’t know what reason is???The difference between my project and your app is 2200uf 50V panasonic capacitor and schottky diode, and I think the problem is schottky diode, do you think so???
Schottky diode using to current isolation between FET power and driver power, don’t you?And anyone have a same problem can help meThanks in advance.