Go Down

Topic: modding an RC car (Read 15 times) previous topic - next topic

DuaneB

Hi,
   So that I don't feel like a fraud, thats the original circuit which I could never get to reliably, the current circuit is -



I have just updated my original blog post with both circuits here -

http://rcarduino.blogspot.com/2012/01/traction-control-part-13-we-have.html

I suggest you get some decoupling capacitors for cleaning shared power and also some heat shrink tubing for insulating self made cables and connectors on your shopping trip.

For generating the signal, use the servo library on any of the digital pins.

Duane B

rcarduino.blogspot.com

Destined

#86
Feb 16, 2012, 03:34 am Last Edit: Feb 16, 2012, 06:03 am by Destined Reason: 1
Where do you get those connectors(the male triple pin ones that come out of the servo motor and plug into the RC)? I found the male version, but I can't find a thin female version anywhere in my local electronics stores.

The 2 motors are obviously connected to the ESC unit. However the servo motor has the single triple (red/black/white) cord coming out of it. So I am not sure how to set it up so that I can get it power.

I am assuming the power comes from the triple  (red/black/white) wire which connects to the RC unit.

So does that mean I put both the servo wires, and the motor wires on the breadbroad and join the red wires in a powerrail so that the servo can get power? I can't see how else it could get power.


Code: [Select]

#include <Servo.h>

Servo myservo;
int val = 50;

void arm(){
 // arm the speed controller
 Serial.println("Arming");
 setSpeed(50);
 delay(2000); //delay 2 second
}

void setSpeed(int speed){
 // speed is from 0 to 100 where 0 is off and 100 is maximum speed
 //the following maps speed values of 0-100 to angles from 0-180,

 int angle = map(speed, 0, 100, 0, 180);
 myservo.write(angle);  
   
}

void setup()
{
 myservo.attach(8);
 arm();
 //setup serial communication
 Serial.begin(9600);
}


void loop()
{
 while(!Serial.available()==0)
 {  
   val = Serial.read() - '0';
   val = val * 10;
   setSpeed(val);
   Serial.println(val);
 }

 

}  


That is my code for the ESC and appears to work fine.

Now I need to figure the servo! I need help because I am not willing to just randomly try. The only issue is the power, will be easy to control once it has that. I don't want to blow it up, but it has simple as connecting the red wire from the ESC ro the red wire of the servo as I can see how else it gets power. The RC unit appears to get it's power from the ESC red wire.


DuaneB

Hi,
   The male and female connectors on my board are just male and female PCB Headers cut to size. The headers come in strips around 60 pins long, you just cut off what you need.

   As for the servo power, your electronic speed controller has a BEC, this stands for battery elimination circuit, years ago you would have needed separate power for some of the RC Components but for the past decade or so most speed controllers have included a BEC which supplies power intended to drive servos and RC Receivers. In some speed controllers, the BEC is supplied through the cable that normally runs to the radio, it appears to be this way in your case. So yes, you can use the power available from the red and black wires of the ESC 3 Wire radio connector to supply power to your servo.

I am surprised that the ESC Code works, 0 should be full reverse of full brakes, I would not expect a model to move forwards until 90+ ?

Duane B

rcarduino.blogspot.com


Destined

Thanks I will give it a try. I just didn't want to incase it was going to lead to bad results.

I was surprised to, with the research I did thanks to your tips I found 0 was the standard arming.

My code makes the 0-180 become 0-100 (cause I am simple and prefer to work 0-100) and 50 is dead stop. The lower the number goes below 50 the faster it goes in reverse. The the higher the number goes above 50 the faster it goes forward.

so like 40 is slow back, 30 medium speed back, 20 fast back. 10 and 0 don't seem to make it go any faster and like 60 is slow forward, 70 medium speed forward, 80 fast . 90 and 100 don't seem to make it go any faster.

Hitting with 50 arm its for use and makes a little tune to let me know it is done right.

DuaneB

Hi,
   The extremes of throttle range are often dead zones, my ESCs all reach max current around 85% throttle just like yours.

   Just to be sure, you did follow the manufacturers instructions for initially programming the ESC ?

   I know why you are using 0-100 but if you switch to 1000-2000 with 1500 as the mid point you will be thinking in the same terms as your equipment. At the moment, you are thinking in a made up range - 0 to 100 - which you then convert to another made up range 0-180 which the servo library then converts into yet another made up range 1000-2000 which finally gets converted into the number of timer ticks required to generate the pulse.

   If you start to think in the 1000-2000 millisecond range you eliminating two sets of costly conversions, it will also ensure than you can switch your model between autonomous and manual mode more easily as you would tend to read incoming RC Pulses in milliseconds.

Just a suggestion.

Duane B.

   


Go Up