Serious FOCer (84V VESC 6 based controller)

Electric Motors and Controllers
shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 17 2019 11:29am

Thanks everyone! I'm still open to ideas on how to have easily interchangeable connectors. That was part of the logic in having the separate connector panel as I could design different panels for different connector types/configurations and not have to alter the design of the control board.

john61ct   1.21 GW

1.21 GW
Posts: 3719
Joined: Dec 18 2018 2:06pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by john61ct » Oct 17 2019 11:32am

That's the point of my "one connector" idea, embed the different adaptations into different pigtail harnesses.

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 17 2019 2:48pm

@john61ct I see what you're saying now.

Maybe something like the connectors linked below?
https://www.molex.com/molex/products/fa ... troduction

https://www.molex.com/molex/products/fa ... troduction

john61ct   1.21 GW

1.21 GW
Posts: 3719
Joined: Dec 18 2018 2:06pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by john61ct » Oct 18 2019 9:39am

Yep, that's the idea, all pins needed accommodated in one big block on the board.

Sell / spec one standard default harness, maybe another with long unterminated wires.

DIY users can make up their own to suit their use case

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 20 2019 9:59pm

UPDATE SUMMARY:

Unreliable no-name USB connector is unreliable. The pinout isn’t standard and the datasheet doesn’t say anything about it. USB comms issues now resolved with rigged USB cable and jumpers

Had MISO and MOSI swapped on the DRV SPI comms. DRV was freaking out because of it (throwing every fault possible). I adjusted the code to compensate.

Worked out some more of my stupid code mistakes. Replaced the DRV with a fresh one after a I violated it with dysfunctional code. Got the controller to fire up with only one error. It’s throwing a “high current offset fault” which may(and hopefully) correct itself upon motor detection. The next step is to solder on some power/motor cables and see if I can spin something up.

district9prawn   100 W

100 W
Posts: 278
Joined: Jul 20 2013 10:46pm
Location: Sydney

Re: Serious FOCer (84V VESC 6 based controller)

Post by district9prawn » Oct 21 2019 6:32am

Bummer DRV dead before you even put any power through the mosfets? Hopefully this new drv is more robust than the 8301/8302.

Cold joint on DRV current sense would cause it. This new DRV is leadless right?
Neu 8057 6kW left hand drive hardtail with 18 fet Vesc: viewtopic.php?f=6&t=96754

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 21 2019 10:40am

Yeah the new DRV is leadless and has more fault detection. Really I believe it was a combination of having the MISO and MOSI swapped along with errors in my code that eventually led to the DRV failing. It was sinking a lot of current through some wrong pins which would eventually cause it to fail. I believe that once my errors are ironed out then this device will be fine. Tuning the IDRIVE is also key to keeping it alive and well based on some of TI's e2e forum posts.

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 24 2019 10:04pm

it spins!.jpeg
it spins!.jpeg (127.89 KiB) Viewed 2811 times
And we have lift off!

Just BLDC mode (trapezoidal control). Running FOC motor detection through the wizard yields a sensor error (I’m running it sensorless right now so idk what’s that’s about yet). Doing FOC motor detection through the not-wizard just yields no response and claims bad detection. After the attempted FOC motor detection the current offsets shoot way high. I need to analyze the current sense part of the controller to make sure things are accurate...

I’ll figure out what’s going on with FOC for this thing…else I’ll have to change its name :(

drdrs   10 mW

10 mW
Posts: 23
Joined: Jun 10 2018 11:55am

Re: Serious FOCer (84V VESC 6 based controller)

Post by drdrs » Oct 24 2019 11:03pm

Which part of the not-wizard is failing, RL or the flux linkage? I recall being able to get the R and L measurements to work but having to tweak the omega/ERPM parameter to get the flux linkage to work.

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 25 2019 8:06am

It doesn't even make it through the RL. This may take some analysis in lab with am oscilloscope to see what's going on

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 25 2019 12:06pm

Just got FOC to work! Turns out it was an issue with the DRV8323R initialization code. When the code executes to set the current amplifier gain it also writes values that cause the current sense reference voltage to be Vref(3.3V) instead of the proper Vref/2 for bidirectional current flow measurement (crucial for FOC). I fixed it in the drv8323h.c file, compiled, and ran it. Now I gotta highlight the issue on the Github for the firmware so it can fixed for everyone.

SRFirefox   100 mW

100 mW
Posts: 35
Joined: Apr 24 2019 7:27pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by SRFirefox » Oct 25 2019 12:14pm

Excellent work! That's pleasantly little debugging to get a motor spinning, let alone under FOC. Looks like all of the design review time with Marcos and the care you took in the design phase is paying dividends. I can't wait to see how this FOCer performs under load!

P.S. Are you using a microUSB plug or a USB-C for the onboard connector? Can I vote for C if you haven't decided yet?

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 25 2019 12:21pm

I got micro USB on there right now. I originally was trying for USB C but then I was told about some certain resistors that have to go with it to identify orientation and then I got scared and then I abandoned it... I just need to go back over the design review notes that address this and look into how to correctly implement USB C. I'm sure it's not hard, I just didn't want to deal with it at the time.

SRFirefox   100 mW

100 mW
Posts: 35
Joined: Apr 24 2019 7:27pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by SRFirefox » Oct 25 2019 1:03pm

Check out ST's application note 5225. Section 10.1 describes the bare minimum to convert a USB 2.0 device to use a USB-C connector. In this case, you can simply use Vbus on its four pins as your 5V source, though it's not shown in that diagram.

https://www.st.com/resource/en/applicat ... 536349.pdf

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 25 2019 1:12pm

Perfect! Looks like "Legacy device using USB Type-C™ receptacle" is the exact diagram I need. Time to work this into the design.

john61ct   1.21 GW

1.21 GW
Posts: 3719
Joined: Dec 18 2018 2:06pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by john61ct » Oct 25 2019 1:36pm

https://hackaday.com/tag/usb-pd/

https://github.com/ReclaimerLabs/USB_PD

Sorry below not clickable
Screenshot_20191025-143536.jpg
Screenshot_20191025-143536.jpg (55.77 KiB) Viewed 2748 times

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 27 2019 10:38pm

image.png
image.png (175.52 KiB) Viewed 2687 times
Did some quick testing to verify hall sensor input and gather data at light load. This is just a little 350W hub motor with 236uH of inductance. Results aren't bad I guess. Will be do doing some tweaking in the DRV initialization to dial in slew rates and fault protection thresholds.

wil   10 W

10 W
Posts: 66
Joined: Apr 05 2014 12:29am
Location: Sydney, NSW, Australia

Re: Serious FOCer (84V VESC 6 based controller)

Post by wil » Oct 27 2019 11:30pm

It's out of scope of this project, but if you had a controller setup for USB C PD and ran power through a motor phase to use as a boost convertor you could have a nice little 100 watt charger available anywhere.

shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 28 2019 6:32am

That would be cool. I've seen other motor controllers that have charging functions. Does any one have any documentation on how to use a motor controller as a buck and/or boost converter for charging applications?

nieles   10 kW

10 kW
Posts: 682
Joined: Jul 14 2008 5:39pm
Location: The Netherlands

Re: Serious FOCer (84V VESC 6 based controller)

Post by nieles » Oct 28 2019 8:02am

the adaptto controller can function as a boost converter (input voltage lower than min pack voltage) i cant find any documentation on this, but its pretty straight forward.

the way they it works: disconnect a phase leads so you have access to the H-bridge
battery stays connected in the same way as if it were a motor controller.

on the the phase leads input your power supply(Ud) with caps (Cd) in parallel and inductor (L) in series. (referenced to BAT-)
Uo is the battery.
T1 is the bottom switch T2 is top switch
Image

john61ct   1.21 GW

1.21 GW
Posts: 3719
Joined: Dec 18 2018 2:06pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by john61ct » Oct 28 2019 9:33am


shaman   1 kW

1 kW
Posts: 319
Joined: Dec 10 2018 7:03pm
Location: Fort Worth, TX, USA

Re: Serious FOCer (84V VESC 6 based controller)

Post by shaman » Oct 28 2019 1:55pm

@nieles So an external inductor would be needed? I was hoping to be able to utilize one of the motor phases as the inductor in the buck converter topology. Since the controller assesses the inductance of the motor, an ideal switching frequency could be found to make it work...maybe.

nieles   10 kW

10 kW
Posts: 682
Joined: Jul 14 2008 5:39pm
Location: The Netherlands

Re: Serious FOCer (84V VESC 6 based controller)

Post by nieles » Oct 29 2019 5:59am

depending on the inductance and max phase current possible you *could* use the motor winding's.
there are several parameters that need to be considered:
pack voltage (given)
charge current
PSU voltage
Inductor value
max switch frequency
max inductor current (inductor saturation current?)

i did some calculations on all this for an LDC bias supply for a project at work. when i have some time i will find my notes or spreadsheets on this for you.

nieles   10 kW

10 kW
Posts: 682
Joined: Jul 14 2008 5:39pm
Location: The Netherlands

Re: Serious FOCer (84V VESC 6 based controller)

Post by nieles » Oct 29 2019 6:02am

if you look at the wiring diagrams for the nucular controller you see he uses the motor winding's. if things overheat he suggests an external inductor in series.

i would at least add some input capacitors, but i don't see them in the nucular schematics. theoretically you can use the output caps of the PSU.

Feist92   10 mW

10 mW
Posts: 31
Joined: Sep 12 2017 5:27pm

Re: Serious FOCer (84V VESC 6 based controller)

Post by Feist92 » Oct 31 2019 1:52pm

So glad to see you've got this spinning a motor!
Definitely put my name down for one :thumb:

Post Reply