01/2016-07/2016

Handmade VESC motor controllers

- Under construction -

1. Motivation

Some time ago I found the KiCAD web site, which provides a free open source (FOSS) professional tool for PCB design. A link further the page "Made with KiCAD" was very interesting. Really cool projects published as "Open hardware" can be found. One project catched my eye easily: the VESC DC and brushless motor controller board.

The VESC project of Benjamin Vedder provides an open source motor controller especially for brussless motors (BLDC, PMSM) with a long list of interesting features. It can control sensorless motors with block commutation or sensored BLDC with FOC (Field-oriented-control) with focus to be used mainly on Linux. Benjamin provides with its VESC an impressive professional motor controller. He uses the VESC for his electric longboards and robot projects. There is already a big community making use of his VESC in all kinds of hobby motor control projects, mainly E-Longboards, but even E-Bikes or Quad-Bikes.

2. Why build it yourself?

First I had in mind to buy a ready-made board e.g. from enertion shop but then I thought it might be a good idea to solder the boards myself as it is a good exercise for SMT (surface mounted technology) soldering and to check if I am able to handle soldering the tiny parts. It is also beneficial as if some part on the board gets damaged (blowed up by wrong config or usage) I can repair it myself as I already have the rework station and solder experience at hand.

Oh man, I didn't know how much work this will cause...

But, well, after some time of ordering parts and soldering work finally I finished 3 boards which were working out of the box like a charm... The result with one board after some months of work looks like this:

Pic 1: Self-made VESC with small BLDC, wired Nunchuk and notebook battery (click to enlarge)

The whole game cost me around 530 Euro to order the 3 boards and rework station. But it was worth the work for the soldering experience and learning a lot about the VESC.

3. TODO list

Here are the steps I followed making my own VESC boards:

3.1 Rework station

I searched for several rework stations and finally decided for the Aoyue because they have a reasonable price for hobby use and still offer (for chinese standard) good quality. I didn't want to spend more than 200 Euros for a rework station because I was not sure if I would have use for it again often after the VESC project. All the professional solder stations cost easily over 1000 Euro. Too much for my purpose. Also there are several cheap rework stations on the market (Ebay) from 70 Euro or so but I didn't trust their quality.

I was also up to replace my old Komerci solder station and get one with a smoke absorber because it often annoyed me to hold breath when I was soldering while the smoke searching its way right to my nose... So I decided for the combined rework and solder station with smoke absorber, the Aoyue 968A+ model as it seemed to match my needs perfectly. And also it is quite compact. Other rework stations just occupy the space without having a solder iron included.

Pic 1: Aoyue 968A+ rework station
Pic 2: Aoyue with heat gun and solder iron
Pic 3: Front panel

Very handy it comes with an anlog knob to quickly adjust the temperature for the hot-air gun which is much more convenient than setting it by buttons. Still the buttons for solder iron temperature are acceptable to use and temperature is usually set once for the iron.

I spent around 201 Euro for the Aoyue rework station, ordered from WilTec.de, including some cheap solder flux and solder paste. But I had quite some trouble in the beginning just after unboxing and switching on. First the smoke absorber didnt work. Second during cooling-down of the hot-air gun the whole rework station was vibrating so heavily it was just unacceptable loud. So I sent the box right back to WilTec for repair. They confirmed the problem and fixed it but it caused me needless trouble. Obviously they just forward the original china product to customers and let them do the quality check... Seems poor (or no) quality control at china site (well, should be no surprise). I don't understand why they don't put every shipment from china just right through a quality check in germany first?! Costs too much it seems. Anyway after repair now the rework station works fine.

I just noticed one drawback on the solder iron. The smoke absorber air volume can not be adjusted. Unfortunately it cools down the solder iron tip a bit so its annoying to solder with the smoke absorber switched on. I can turn up the temperature but then the display shows another temp than I am soldering with. Now mostly I switch off the smoke absorber and get back to the habit again to hold my breath when soldering... So maybe it would have been better to buy a separate solder station after all. And also the tube for the smoke absorber interferes with the PCB board when I am soldering smaller parts in an angle (SMT parts terminals).

But overall I am quite happy with the hot air gun handling and its analog temp and air stream knobs for quick adjustment. It's also very handy for other work e.g. when i did a ram upgrade for my router.

3.3 PCB's from hackvana

Bejamin mentioned hackvana for board production. So I ordered 10 boards from hackvana. Because this number has the best volume/price ratio and I didn't know yet how many I'm gonna solder myself. I chose 1oz copper which is completely sufficient for my purpose. The boards where well done - couldn't find any flaw - and after soldering proved to be ok as the boards worked fine.
I paid the boards via TransferWise as I dont wanna use PayPal. Didn't use this money transfer before. I just looked for a way to avoid PayPal. TransferWise was reliable and fast. Had no problems with them. As I was the first to pay by TransferWise Mitch added some remarks on his site for that payment choice. He proved to be a reliable guy and also helpful by mail.

Here are a few photos from the delivered hackvana boards (VESC 4.11 HW):

Pic 1: Fresh ordered PCB's from hackvana
(10 boards minus 2 soldered)
Pic 2: PCB card deck :-)
Pic 3: Two boards showing lower and upper side
Pic 4: Single PCB, upper side - what a beauty!

3.4 Setup STM32 programmer with STlink/v2

3.10 Programming VESC boards

bootloader upload log:

#qstlink2 --cli --erase --write build/BLDC_4_Bootloader.bin
openocd -f board/st_nucleo_f4.cfg -c "set WORKAREASIZE 0x2000" -c "program build/BLDC_4_Bootloader.elf verify reset exit"
Open On-Chip Debugger 0.9.0 (2016-04-04-22:44)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
0x2000
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.250033
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800c000 msp: 0x20000400
** Programming Started **
auto erase enabled
Info : device id = 0x10076413
Info : flash size = 1024kbytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x20000042 msp: 0x20000400
wrote 131072 bytes from file build/BLDC_4_Bootloader.elf in 3.680622s (34.777 KiB/s)
** Programming Finished **
** Verify Started **
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20000400
verified 4256 bytes in 0.098387s (42.244 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
#openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/BLDC_4_Bootloader.elf verify reset" # For openocd 0.9
	

firmware upload log:

#qstlink2 --cli --erase --write build/BLDC_4_ChibiOS.bin
openocd -f board/st_nucleo_f4.cfg -c "set WORKAREASIZE 0x2000" -c "program build/BLDC_4_ChibiOS.elf verify reset exit"
Open On-Chip Debugger 0.9.0 (2016-04-04-22:44)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
0x2000
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v15 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.250033
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
auto erase enabled
Info : device id = 0x10076413
Info : flash size = 1024kbytes
Info : Padding image section 0 with 48704 bytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x20000042 msp: 0xfffffffc
wrote 262144 bytes from file build/BLDC_4_ChibiOS.elf in 7.507280s (34.100 KiB/s)
** Programming Finished **
** Verify Started **
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
verified 140432 bytes in 1.378382s (99.494 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
#openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/BLDC_4_ChibiOS.elf verify reset exit" # For openocd 0.9	
	

back to overview