Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use a middle resting pot for gas and brake? #529

Open
L1mp4 opened this issue Dec 30, 2024 · 20 comments
Open

How to use a middle resting pot for gas and brake? #529

L1mp4 opened this issue Dec 30, 2024 · 20 comments
Labels
question Further information is requested

Comments

@L1mp4
Copy link

L1mp4 commented Dec 30, 2024

Variant

HOVERCAR

Control type

Commutation

Control mode

Torque

Description

Hi! I have tried to finding this answer in the wiki and on other places on the web. But i cant get this right. I want to use the Hovecar to use two motors simultaneously. Although i am building a scooter with a large two motor wheel in the back. I am trying to use a singel pot, middle resting (5Kohm), to use one turn direction for gas and the opposit direction to brake. I dont know how to set up the firmware or the hardware for this. Is there anyone who can help? Is it at all possible? I cant read code that well. :-) Thanks.

@L1mp4 L1mp4 added the question Further information is requested label Dec 30, 2024
@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

I am guessing i am very stupid and thats the reason i dont get any answers from you electronic/coding guys! :-)
But shouldnt i be able to do this? With pulldowns on both blue and green -> ground.

#define DUAL_INPUTS // ADC*(Primary) + Sideboard_R(Auxiliary). Uncomment this to use Dual-inputs
#define PRI_INPUT1 1, 0, 1024, 2048, 200 // Pedal Brake TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT
#define PRI_INPUT2 1, 2048, 3071, 4095, 200 // Pedal Accel TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT
#define AUX_INPUT1 0, -1000, 0, 1000, 0 // Sideboard Steer TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT
#define AUX_INPUT2 0, -1000, 0, 1000, 0 // Sideboard Speed TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Actually i thought i had. But since i am stupid beyond belief i think i should again. I was trying to trick the software to think two normal pots was in use. But i see now i could use middle pot (2) to get this, but i need to think about the values i guess. Thank you. I will try again, and again! :-)

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025

The autocalibration will handle it.

Now try this with adc variant and let me know if it's OK.
You might have to compare different control modes to see if it behaves as you want.

Best option would be to use skateboard variant, but you would need to do non standard changes in config.h as this variant is meant to be used with pwm input.

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Dude! :) Thanks for answering!
#define PRI_INPUT1 3, 0, 0, 4095, 0 // TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section
#define PRI_INPUT2 0, 0, 0, 4095, 0 // TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section
With ADC works just like i want it. Although there are high pitch beeping when i throttle, over the middle of possible length. Maybe deadbnad should be altered. And it does not write the calibration to memory, cuz when i restart i have to do it again. But i guess thats something else i have missed! Thanks alot!

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025

This happens with auto calibration?
Auto calibration values are saved when you turn the board off by pressing the button. If you just unplug the battery it won't work.

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Yes. But maybe i was sloppy and didnt erase the memory like i should. It seems to save values now.
But. I get now why it beeps. I think. The way i thought was the pedal down now, is backwards i guess. So it beeps. For indicating backing. So this is not quite right it seems. I wanted one direction rotation and brake only. Not backing, since that would not be a good thing on a scooter i guess. Sorry for the confusion!

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025

That's what you would get with the skateboard variant.
You would need to replace this:

   #define CONTROL_PWM_RIGHT   0         // use RC PWM as input on the RIGHT cable.  Number indicates priority for dual-input. Disable DEBUG_SERIAL_USART3!

  #define PRI_INPUT1          0, -1000, 0, 1000,   0    // Disabled. TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section
  #define PRI_INPUT2          2,  -800, 0,  700, 100    // Active.   TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section

By this:

  #define CONTROL_ADC           0         // use ADC as input. Number indicates priority for dual-input. Disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2!

  // #define DUAL_INPUTS                     //  ADC*(Primary) + UART(Auxiliary). Uncomment this to use Dual-inputs
  #define PRI_INPUT1            3, 0, 0, 4095, 0      // TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section
  #define PRI_INPUT2            3, 0, 0, 4095, 0      // TYPE, MIN, MID, MAX, DEADBAND. See INPUT FORMAT section

and then autocalibrate.

But I never did this before and I haven't played with the firmware for at least a year. So I am not 100% sure.
I think the pot has to be connect to the correct cable as only one input is used in this variant.

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Ok. I thought i would get this with hovercar aswell. Since i need both wheels i thought that would be the way to go. But i will try this for sure. Truly grateful for your help. I will try this and report back! Thanks.

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025

Hovercar uses 2 separate inputs for throttle and brake

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Ah. Got it.

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

Well. I tried. Both rotations on the middle pot now turns both wheels the same way. Freewheeling works. But no braking. Maybe i forgot something. I will check the code again.

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

But since i use both INPUT1 and INPUT2 i should connect the middle resting pot to both? Right? Doesnt seem to matter tho. I cant get braking it seems.

@Candas1
Copy link
Collaborator

Candas1 commented Jan 5, 2025 via email

@L1mp4
Copy link
Author

L1mp4 commented Jan 5, 2025

I am using one pot yes. And connected the output to both inputs. Green and blue. But i cant get braking to work.

@Candas1
Copy link
Collaborator

Candas1 commented Jan 6, 2025

Are you sure it's the skateboard variant you are using ?

@L1mp4
Copy link
Author

L1mp4 commented Jan 6, 2025

Yes.
This is the line in platformio.
default_envs = VARIANT_SKATEBOARD ; Variant for SKATEBOARD build controlled via RC-Remotes with PWM signal
The others has a ; infront of them. And Variant_skateboard is green and the rest is greyed out, in config.

But i am sure i have made something wrong. :-/

@L1mp4
Copy link
Author

L1mp4 commented Jan 6, 2025

These have nothing to do with this, right? Seems more like an autobrake or so.

// Extra functionality
// #define STANDSTILL_HOLD_ENABLE // [-] Flag to hold the position when standtill is reached. Only available and makes sense for VOLTAGE or TORQUE mode.
// #define ELECTRIC_BRAKE_ENABLE // [-] Flag to enable electric brake and replace the motor "freewheel" with a constant braking when the input torque request is 0. Only available and makes sense for TORQUE mode.
// #define ELECTRIC_BRAKE_MAX 100 // (0, 500) Maximum electric brake to be applied when input torque request is 0 (pedal fully released).
// #define ELECTRIC_BRAKE_THRES 120 // (0, 500) Threshold below at which the electric brake starts engaging.
// ########################### END OF MOTOR CONTROL ########################

@L1mp4
Copy link
Author

L1mp4 commented Jan 6, 2025

I will try again. And make it clean. MAybe i screwed up.

@L1mp4
Copy link
Author

L1mp4 commented Jan 6, 2025

Nah. Same result. I can spin the motors one way with one direction but when they spin, if i turn the other way they increase speed. Altho "the other way" does not seem to start the motors.

Question. Might this be hardware related? Say i need to switch the hall-cables? No?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants