You are here

ADC and UART app - input priorities?

2 posts / 0 new
Last post
DaRho
Offline
Last seen: 2 months 2 weeks ago
Joined: 2023-07-09 15:39
Posts: 5
ADC and UART app - input priorities?

Hi.

I'm working on upgrading my e-bike setup from KT controller to VESC.

I'm having a single wire PAS and created a small arduino circuit, that would read it via its' own ADC and send data over CAN to VESC, to set a current when pedaling is detected, and stop, when pedaling stops, so simple pedal-assist function. That is a beginning of a bigger project, but for now I'm checking the basics.

I also added a twist throttle and connected it to ADC1 on VESC.

The custom PAS circuit works ok when only UART app is selected on VESC.

But when I set ADC and UART app on VESC, the CAN packages from the PAS sensor seem to be neglected totally and only Throttle works.

I assume, that the constant data flow from the ADC1 input is overruling the data from the CAN transmissions. I'm ok with throttle taking over priority, but only when there is any input to it, not when it's within the "deadband" (so actual output from the throttle is 0, and should be neglected). So after ADC1 comes down to 0 and stays there for some time, like 200-300 ms, ignore any furhter input, unless it goes higher than 0 again.

Is there an option/setting, to ignore ADC1 input, if it translates to 0?

Or should I post it as a feature request?

Any guidance will be appreciated.

 

Thanks!

DaRho.

DaRho
Offline
Last seen: 2 months 2 weeks ago
Joined: 2023-07-09 15:39
Posts: 5

Ok, I looked into the firmware code and... damn, that is some EDIT: great code :) 

anyway - I made it more messy by adding some simple logic to skip any subsequent "0" set_current commands from ADC (so only first "0" is commanded and then all subsequent set_current commands are skipped until ADC-requested current changes from 0 again), and it seems to be working well for now.

PS. not sure, what impact on the remaining functionalities that might have. I didn't look into that at all, but for my use case that is good enough, for now.