Hello,
I am quite new to the VESC and understanding the oepn source firmware.
Can anyone please explain me how is the negative current being sensed in the VESC tool?
In the firmware I see "GET_CURRENT()" for to read the input at the ADC pins mapped to current sensing.
"
// Current ADC macros. Override them for custom current measurement functions.
#ifndef GET_CURRENT1
#ifdef INVERTED_SHUNT_POLARITY
#define GET_CURRENT1() 4095 - ADC_Value[ADC_IND_CURR1]
#else
#define GET_CURRENT1() ADC_Value[ADC_IND_CURR1]
#endif
#endif
"
I understand, how the ADC_Value[<ADC-Index>] reads the positive current which corresponds to values between 0 - 4095. But for negative current 4095 - ADC_Value[<ADC-Index>] is used. However, I am not very sure how it is reading the negative value of the current.
I have a custom application and for that I am using bidirectional ACS current sensors that reads +/-10As.
I have to update the firmware corresponding to the current sensors. So I have to make mimic current sensors as Shunt Resistors for VESC.
It will be great if anyone can help explaining the current sensing principle in VESC Firmware.
Or, if anyone has done this before (which I am sure would have been implemented) and can help me in resolving my problem. It will be great help. Its been more than 4-5 days I am investigating this, andhave no right leads.
simply, assume vref=3.3v
mid voltage (I=0) 1.65v = vref/2
+Imax =3.3v
-Imax =0v
So, it applies that
at I = 0A, ADC ADC value is 2048
at I = - I_max A, ADC ADC value is 0
at I = I_max A, ADC ADC value is 4096
If I replace, the shunts by three current sensors (ACS). Do I need to make changes in firmware corresponding to same?
sw mod. may not be needed. so many hw types of vesc. some use phase shunts, some 2 shunts placed sources of mosfets, some 3 shunts placed sources of mosfets.
be sure your hw is compatible with any type of vesc.
I had used acs709, and no problem had been faced.
I am using ACS7124. Every time I connect my motor to the control board and power board and do the parameter set up the VESC desktop tool shows an error of "detection failed: -11". If you print the fault in the terminal it says undervoltage fault. The current values seems quite high and voltage is very low about 4-5 volts.
According to VESC firmware, for 0 current STM pin has 0 and for Imax current 4096. For the reverse current i.e. inverted shunt polarity for -Imax 4096-4096 = 0 and for zero current 4096-0 = 4096. So the max value becomes the min value and min value is the max value.
However, in case of bidirectional ACS current sensors:
at I = 0A, ADC ADC value is 2048
at I = - I_max A, ADC ADC value is 0
at I = I_max A, ADC ADC value is 4096
(correct me if I am wrong)
I guess same is the case with you! Can you help me how you manage to read the correct current value with these values.
just change the pins sensing current of Acs
Hello, I am again seeking help as I am unable to resolve the issues with the current sensors.
skyline1970 mentioned that no need to make any changes in the software.
However, I am still not able to sense the right current values.
As I do the motor set up, my controller goes into under voltage fault and when printing faults in terminal, it displays very less value of voltage and not so high values of current.
When I operate the motor with duty cycle control in the left most corner of VESC desktop tool (keeping it very low of range 1-7% when having 42 volts battery) the motor spins. But as the duty ratio is set above 7%, the motor stops spinning and controller goes into under voltage fault. This seems weird to me that as I am increasing the duty ratio, the voltage is going down.
is the battery good, it should not give "under voltage fault".
could you measure ~ +1.65v at current sense outputs, when the throttle at stop pos. ?
Yes, the battery is fine and is fully charged.
I am operating the standard VESC with the same battery.
And yes current sensor IC output 1.65 V at 0 Amp.
Today, I was just observing the PWM pulses over the oscilloscope and I realized that the pulses for high and low switch overlaps each other.
As I increase the duty ratio the overlapping increases,.
In the custom hardware, I am using the UCC27712 620-V, 1.8-A, 2.8-A High-Side Low-Side Gate Driver with Interlock driver IC. However VESC uses DRV8301.
I did not make any changes in the firmware for deadtime generation or pwm generation.
Do you think I need to do make corresponding changes in the code as well?
under vesc-tool, define deadtime as 480uS, and try,
or as an hw solution, a pld/fpga could be used betveen vesc uc and driver to eliminate overlaping of hi/lo signals
sw mod maybe aeasier.
If I substitute three current sensors for the shunts (ACS). Do I need to make any changes to the firmware as a result of this? smash karts
I am looking answer for the similar question. If you do a lil math with the ADC values and the equations used in the firmware to sense the current. You will find out, that there is no need to make any change in the firmware.
However, I am still struggling with current sensing issues. Let me know if you are able to solve it!
Hello! When I operate the motor with duty cycle control and as the duty ratio is set above 0.6, the motor stops spinning. I want to know how you solved it?
What happens with the motor voltage when the duty ratio is above 0.6?
Is it going down?
What type of fault if being shown?
In my case I am using custom hardware with some changed components in the Control Board. Also I observed that the generated PWM pulses are overlapping each other and as the duty ratio is increased the overlap increases.
It leads to drop in battery voltage and thus controller goes into under voltage fault.
It is still a issue and I am still working on it.
What is overlapping with what? Can you show traces of it?
The upper and lower switch of the same leg should be complementary to each other with some deadtime in between.
However, in my case they are overlapping.
video:https://drive.google.com/file/d/12AMEXoYNNkV6YBDOgt3noR1xsHR75P5H/view?u..., https://drive.google.com/file/d/1LJ0uJRDycqlu62q7zrrUPaumuo4ZY25V/view?u...