Shunt Sizing

Discussions regarding the Field Oriented Control (FOC) implementation on the VESC.
beak90
Posts: 8
Joined: 07 Apr 2017, 02:45
Location: Los Angeles

Shunt Sizing

Postby beak90 » 08 Apr 2017, 22:30

I'm working on making a motor test bench to get a motor model from various different brushed and brushless motors. I have been playing with my VESC and I'm realizing that there may be some issues with testing a wide range of motors.

Brushed motors are working fine of course. But I can't get any of the brushless motors I have to work very well. With bldc mode, detection fails every time. In FOC I can get it to detect properly, but it doesn't run well at all. Sometimes it struggles to start and sometimes it will stop after it has started.

The main motor I'm testing with is here: https://hobbyking.com/en_us/turnigy-l2215j-900-brushless-motor-200w.html
It is pretty small, but it seems like it's not tiny. The smaller brushless motor I have started smoking a bit during the bldc detection at 6A :P

From what I'm reading on the forum, I need to solder larger shunts onto the vesc. If I switch to 5mOhm shunts, would it be impossible to use a larger motor? Is my idea of using one motor controller for multiple motor sizes impossible? And if I do need to switch shunts, how do I determine the best size?

(The goal of the project is to find a motor model using sine sweeps and other motor excitation. I can then use that data to simulate the motor and develop better control algorithms, as well as pre-tune the gains for controllers. It is just going to be an inertial dyno. Measuring the rate that the motor spins up gives the torque since the inertia is known. Being able to test multiple motor sizes and types with the same test bench would be ideal.)

beak90
Posts: 8
Joined: 07 Apr 2017, 02:45
Location: Los Angeles

Re: Shunt Sizing

Postby beak90 » 09 Apr 2017, 01:07

Here's a bit more info.

The motor parameters I got using FOC are:
R:0.07605 Ohm, L:10.55uH, Lambda:0.000940
I tried time constants between 100uS to 10,000uS, and somewhere around 500uS worked the best. Lower resulted in the current oscillating once it reached the setpoint. With it at 1000uS and higher, it had a hard time starting sometimes.

The motor only worked at all in current control mode. In rpm or duty cycle mode, the motor quickly ramps up to 30amps and makes some loud awful noises. It spins up and slows down sort of randomly. Do the PID values in the speed control section in the Advanced tab need to be adjusted? Does it use those to do sensorless rpm control? It does appear that the erpm sensing is working properly, because the plots look like nice when turning the motor by hand.

I also experimented with Open Loop RPM and the Open Loop times, but these didn't help. I didn't play with D current injection because I have no idea what that would do.

rew
Posts: 904
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: Shunt Sizing

Postby rew » 10 Apr 2017, 06:10

Yes. There are some parameters in the advanced section that by default are tuned for BLDC Mode. If you are using FOC, those need to be totally different.

beak90
Posts: 8
Joined: 07 Apr 2017, 02:45
Location: Los Angeles

Re: Shunt Sizing

Postby beak90 » 10 Apr 2017, 20:02

This thread cleared up a few things: viewtopic.php?t=462

Do you think it would be useful to change the gain on the DRV to 40x? It is currently tied to ground, so 10x. This would be a super nice way of switching motor sizes, because I could tie this pin to an output on the MC, so a simple firmware update would change the current range. It would be cool to have the firmware dynamically switch between 10x and 40x amplification based on the motor params and the requested current :D

If the default setup can read up to 165A (.165V / .001Ohm), then switching to 40x gain would give a max measurable current of 41A. I think this would be suitable for midsize quadcopter motors, like the one I am currently using (200W / 12V = 16A).

There seem to be a lot of different PID values in the bldc tool. Are the speed PIDs in the advanced tab used in FOC mode? Or does FOC use the ones labelled Speed Tracker? I see ones for Duty Downramp also. Presumably those are the speed PIDs used for duty cycle mode?

beak90
Posts: 8
Joined: 07 Apr 2017, 02:45
Location: Los Angeles

Re: Shunt Sizing

Postby beak90 » 12 Apr 2017, 19:49

I'm going to attempt switching the DRV gain to 40x. Someone should let me know if this is likely to explode something :P

arvidb
Posts: 205
Joined: 26 Dec 2015, 14:38
Location: Sweden, Stockholm

Re: Shunt Sizing

Postby arvidb » 13 Apr 2017, 08:37

This will give you two extra bits of resolution, but you will still have the same signal-to-noise ratio. A higher-value shunt gives you a larger signal-to-noise ratio. It's an interesting experiment; it will be interesting to hear if it makes your motor run better.

beak90
Posts: 8
Joined: 07 Apr 2017, 02:45
Location: Los Angeles

Re: Shunt Sizing

Postby beak90 » 14 Apr 2017, 00:17

I decided not to make this change. I did some more looking and realized that the issue is 100% noise, not ADC resolution. When the motor isn't turning and there is no current being fed to the motor, the current page shows +-1A on all the coils, with about .4A of higher frequency noise within that larger waveform. 2A of noise is wayyyy too much if the motor spins at 30k erpm with only 3A. I did find some current loop PI values that sort of worked, but it's clearly not ideal because of the massive amount of noise. The motor is very loud because it is oscillating the current in response to all that noise.

I've been doing most of my testing on a "benchtop power supply" aka a computer PSU with a 12V "40A" channel. It works fine, but I was curious if it was causing the noise. Of course that wouldn't make sense because there are some massive capacitors in between the VESC and the PSU, but just to be sure I tested it with a battery. I got exactly the same noise results with the lead acid battery.

So I guess I just need to get larger shunts. That makes sense. That amount of noise is only +-.001V measured at the shunt (1A*.001Ohm)

Also, the ADC resolution is clearly fine with 10x amplification. With the default shunts and 10x amp, the ADC can measure in quantities of .08A (165A/2048).


Return to “FOC”

Who is online

Users browsing this forum: No registered users and 2 guests