You are here

Calculation of Current and Voltage

6 posts / 0 new
Last post
Christian
Offline
Last seen: 4 years 8 months ago
Joined: 2017-09-21 10:20
Posts: 6
Calculation of Current and Voltage

Hi,

I'm new to the VESC and want to make a position control with the vesc via NRF. Now I am facing the problem that my Motorcurrent is measured wrong all the time. So my question so far is,

how is the 4095.0 calculated or where does it come from? All V_REG are divided by this number.

 

Tanks for your help in advance,

Christian

Christian
Offline
Last seen: 4 years 8 months ago
Joined: 2017-09-21 10:20
Posts: 6

I think there might be the problem with the motor poles, because I use a 7 polepairs (14 poles). Is there a possibility to easily implement this into the code, or do I have to insert the value in all functions of mcpwm? And additionally, do I have to insert the 7 (number of polepairs) or 14 overall number of poles?

Sorry I am just at the start of dive into the VESC Firmware

Guillaume227
Offline
Last seen: 7 months 5 days ago
Joined: 2017-09-11 09:56
Posts: 3

Hi Christian,

That constant is the ADC resolution:

4095 is (2 to the power 12) -1: the stm32 f407 ADC resolution is 12 bit.

The raw ADC reading returns a number between  0 and 4095, to interpret as a fraction of V_REG (3.3V):

0->0V

4095->3.3V

Good luck it can be a bit hairy at first!

Roger Wolff
Offline
Last seen: 5 months 3 weeks ago
VESC FreeVESC Original
Joined: 2017-05-24 12:27
Posts: 202

How do you know the motor current is wrong? I think the motor current is right!

 

When the VESC takes 2A from a 40V battery, that's about 80W. It can then push this current say an effective voltage of (almost) 5V into a motor at (almost) 16A (also 80W). I'm suspecting you find it weird that it takes only 2A from the battery to drive 16A through  the motor. But it really happens!

The VESC is a bit like a DCDC converter that steps down the voltage and increases the current. 

Christian
Offline
Last seen: 4 years 8 months ago
Joined: 2017-09-21 10:20
Posts: 6

Okay I'm kind of confused. The Vesc is connected in my case to a 3A and 12 V laboratory power supply and I want to use a 12V LiPo batterie. The motor I am using right now is a 12 V motor. And the MOSFETS are just switching on and off the different phases, so there should be always a pwm modulated supply with 12 V, or did I miss something in my thoughts?

Roger Wolff
Offline
Last seen: 5 months 3 weeks ago
VESC FreeVESC Original
Joined: 2017-05-24 12:27
Posts: 202

Suppose I have this motor: https://hobbyking.com/en_us/turnigy-aerodrive-dst-700-brushless-outrunne...

Rated for about 12V just like yours. 

 

Let us assume that the winding resistance they claim is terminal-to-terminal. Now lets leave phase-wire C completely floating and wire phase B to ground (just enable the lowside mosfet there). 

So... when I apply +12V To phase A, there will be 12V across the 0.27 ohm winding. We would eventually get a 44A current. But if you've configured your VESC correctly it will limit the effective voltage through PWM such that the current does not exceed the rated 11A. So... for example when I PWM the A phase at 22%, we'd get an effective voltage of 2.64V and about 10A of current! Because the powersupply only has to deliver this current 22% of the time, the power supply will only see about .22*10A = 2.2A! Your 3A lab powersupply is able to deliver that!