You are here

ADC TMM Sensor Voltage fluctuation

2 posts / 0 new
Last post
gianni
Offline
Last seen: 2 years 6 months ago
Joined: 2019-05-15 19:55
Posts: 3
ADC TMM Sensor Voltage fluctuation

Hi,

I have a VESC 6 on my E-Bike, everything works great with a normal thumb throttle and FOC, now i connected the 5V TMM (torque measurement unit) Sensor, the Signal is between 1.6V to 4.9V, i used a Voltage divider​ to drop the vmax to 3.3V with 10kOhm and 20kOhm. (Because ST32 is not 5V tolerant)

The Problem is that the Signal will depend on my strength on the pedals and the Signal have a lot of fluctuation, the motor turns on / off / on / off the whole time i spinning the crank of the bike.

Is possible to set a setting in VESC Tool that the controller reads the Signal every amount of Time or maybe maintain the throttle for x cycles? If not then i need to write my own custom ADC Logic for controlling this type of sensor?

Best Regards:
Gianni

gianni
Offline
Last seen: 2 years 6 months ago
Joined: 2019-05-15 19:55
Posts: 3

Hello everbody,

i will respond on my own question.

1. No it's not possible, needs changes in app_adc.c or write own app_custom.c

2. Yes, the sensor is particular and not equal to an thumb throttle, write your own app_custom.c

So i used exponential filter for the adc value and now i have really accurate readings, the value for a is 0.001, so it stabilize the input and not change when voltage drops on one or many samples.

y(k) = a * y(k-1) + (1-a) * x(k)

x(k) is the raw input at time step k

y(k) is the filtered output at time step k

a is a constant between 0 and 1, normally between 0.8 and 0.99. (a-1) or a is sometimes called the “smoothing constant”

 

Now i have the next problem:

I set in the code duty cycle to 20% when the sensor gets over the null point. While i step on the pedals, the motor will speed up, over 20% duty it will vibrate. I cannot get more speed, because the motor tries to maintain the duty of 20%. 

I think what i need is to get the actual duty cycle and increment it, so that the motor does not break, the other way is to control the motor via current parameter, like the adc_app.c do.

What i should prefer duty cycle or current?