Go Down

Topic: how to make brakes for RC car ? [SOLVED] (Read 3 times) previous topic - next topic

firashelou


It would help if you could give a picture of the car setup.

Personally I would code the brake to remove throttle up to the point in which the brake is mor than the throttle, then actuated a servo with some form of friction device on the driven axle.  That way limiting the amount of additional components required.

Presume you're using some form of pot for the accelerator and brake... So if throttle is on full, apply half brake arduino supplies half throttle, simple really.  If throttle is on half, apply full brake, servo actuated to ram on the friction. Simple really.


i guess it should be the same because the throttle and brake are pots so it would work in reverse, full thottle and full brake car will stop, ... same as u said
Aiming for the unreachable !

Funky Diver

And to make sure, just programme the full throttle range to 90% of its sweep, then when arduino sees full throttle, it's only 90% in reality, so when 100% brake is applied, it will ALWAYS be a high value than throttle regardless, thus slamming on the brakes.

firashelou


And to make sure, just programme the full throttle range to 90% of its sweep, then when arduino sees full throttle, it's only 90% in reality, so when 100% brake is applied, it will ALWAYS be a high value than throttle regardless, thus slamming on the brakes.


ahh so you suggest i put instead of 255, about 240 for example ?! but i guess i loose power here for the dc motor :S
Aiming for the unreachable !

Funky Diver

#33
Jul 09, 2013, 10:27 pm Last Edit: Jul 09, 2013, 10:29 pm by Funky Diver Reason: 1
Nope.  Put 240 on the pot as max, and when the pot hits 240 upwards arduino supplies max power to the motor, but limits the reading to 240, even if its 249.  The brake pot is read as is, so 241 on the brake pot would kill power to DC motors completely.

So, 50 on boths pots = zero power to DC motors.

240 on accelerator, 120 on brake = 50% power to motors (remember 240 = 100% power)

That way anything where brake > accelerator applies power to servo assisted brake.

Nice and simple and involves less components ;)

firashelou

#34
Jul 09, 2013, 10:37 pm Last Edit: Jul 09, 2013, 10:41 pm by firashelou Reason: 1

Nope.  Put 240 on the pot as max, and when the pot hits 240 upwards arduino supplies max power to the motor, but limits the reading to 240, even if its 249.  The brake pot is read as is, so 241 on the brake pot would kill power to DC motors completely.

So, 50 on boths pots = zero power to DC motors.

240 on accelerator, 120 on brake = 50% power to motors (remember 240 = 100% power)

That way anything where brake > accelerator applies power to servo assisted brake.

Nice and simple and involves less components ;)


well i must experiment this to understand what you really mean because it's been a while i made my program and forgot the logic lol, nevertheless i am a beginner :) i managed to make a full program with a gearbox like, but the brakes still didn't work with because still didn't get the chip 

but the servo i can't use it because the structure of the car i have it wouldn't allow that !! you can check the pictures up in the starting of the topic and if it's not clear i will upload new ones soon :)
Aiming for the unreachable !

firashelou

hello,
finally i got my L293D chip
i started to work with it here are the codes i am using :

Code: [Select]

/*
Adafruit Arduino - Lesson 15. Bi-directional Motor
*/
int enablePin = 11;
int in1Pin = 10;
int in2Pin = 9;
int switchPin = 7;
int potPin = 0;

void setup()
{
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  pinMode(switchPin, INPUT_PULLUP);
}

void loop()
{
  int speed = analogRead(potPin) / 4;
  boolean reverse = digitalRead(switchPin);
  setMotor(speed, reverse);
}

void setMotor(int speed, boolean reverse)
{
  analogWrite(enablePin, speed);
  digitalWrite(in1Pin, ! reverse);
  digitalWrite(in2Pin, reverse);
}


so now i need to do the throttle and brake system,
what do i have to do ? where do i have to connect the brake pot ? is it on the enable pin of the chip ? which means brake and throttle are both connected to the pin 1 on the IC ?
Aiming for the unreachable !

baselsw

#36
Jul 24, 2013, 12:41 am Last Edit: Jul 24, 2013, 02:44 am by baselsw Reason: 1
Going reverse like everyone suggested here is one solution.. I've used the L293D chip, but never needed a break system.. So I didn't really think about it then.. You can look at how the arduino team did it with their motor shield (L298P)(http://arduino.cc/en/Main/ArduinoMotorShieldR3).. Pins 9 and 8 are coupled to some breaking function for motors A and B.. Looking at the schematic, sending a high or low to the break pin is the same as putting the direction pins on the chip to the same state (both high or low).. You can also look at the logic table for the chip on page 6/13 in the datasheet (http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00000240.pdf)..

Good luck

//Basel

firashelou

Thanks for all i solved it :
here are the codes in case someone needs it :

Code: [Select]

int enablePin = 11;
int in1Pin = 10;
int in2Pin = 9;
//int switchPin = 7;
int potPin1 = A0;
int potPin2 = A1;

void setup()
{
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  //pinMode(switchPin, INPUT_PULLUP);
}

void loop()
{
  int throttle = analogRead(potPin1);
  throttle = map(throttle, 0, 1023, 255, 0);
 
  int brake = analogRead(potPin2);
  brake = map(brake, 0, 1023, 10, 0);
 
  //boolean reverse = digitalRead(switchPin);
  setMotor(throttle, brake);
}

void setMotor(int throttle, int brake)
{
  int pedal ;
  if(throttle){
    pedal = throttle;
    analogWrite(enablePin, throttle);
  }else if (brake){
    pedal = brake;
    analogWrite(enablePin, brake);
  }
 
  digitalWrite(in1Pin, throttle);
  digitalWrite(in2Pin, brake);
}
Aiming for the unreachable !

Go Up