Rc light kit How do I make it so I have a programming mode to cal. help plz read

Hi i am makeing lighting kit for a rc car. It has turn signals, brake and reverse lights, and head lights. It is based off of a UNO. It's working fine, but the problem is, that different controlers have different center points for the steering and throttle. So I am looking to make a programming mode were I can calaberate the controlers values in to the trigger values. The thing is that I have no clue how the code would work or look like. Any thoughts. :~

Are you trying to make a kit that can be installed in any R/C car and would need to be calibrated by the car's owner?

Or are you just trying to make something that works in your own car(s)?

You haven't said how the device that you already have works! Nor how bad is it without calibration.

...R

So I under the center point argument. I only played with cheap RC cars. Are the more expensive ones you are playing using joy sticks for turning accel. brake? If yes, are you going to hack into the control with an arduino so it senses the wheel and activates turning signal if the wheel is sufficiently turned? This is not hard but tell me what you're doing a bit more clearly.

RC Channel calibration

http://rcarduino.blogspot.com/2012/05/interfacing-rc-channels-to-l293d-motor.html

Duane B rcarduino.blogspot.com

Yes I am trying to make a kit that can be installed in any R/C car and would need to be calibrated by the car's owner.

I will post my code and that should answer your questions. And it is good with the config of rc car that I have. But i am wondering about other set ups.

If all you are concerned about is the fact that different cars will have a different centre point for steering (and such like) and you need a means to tell the Arduino to apply some offset to match the actual car then it should be an easy matter to do this with a screwdriver adjustable potentiometer. Your Arduino would add or subtract a certain number depending on where the pot is set. This way there would be no need to mess with the car.

If you need to adjust a few channels then have a pot for each.

It would also be easy for the user to understand.

...R

// i need to be able to have it so these values will adjust to the cal. i will mark the values with a :slight_smile:

//3- RC steering
//4- RC throttle
//7- headlight
//8-f left led
//9-f right led
//10-r right led 
//11-r left led
//12- brake led
//13- back up led
// notes:
//turn sig done. next is brake and refers light, (note brake should be on at all times when not moving, then when rversing backing up light should turn on.) 
// rev: 1.0.2 upload to dev board.
int steering = 0;
int throttle = 0;
int lightstate = 0;

void setup()
{
  pinMode(3, INPUT);//RC steering 
  pinMode(4, INPUT);//RC throttle
  pinMode(7, OUTPUT);//headlight
  pinMode(8, OUTPUT);//fleft
  pinMode(9, OUTPUT);//f right
  pinMode(10, OUTPUT);//b right
  pinMode(11, OUTPUT);//b left
  pinMode(12, OUTPUT);//brake light
  pinMode(13, OUTPUT);//back up light
  
 Serial.begin(9600);
  
  
}

void loop()
{
  steering = pulseIn(3, HIGH); //RC steering
  throttle = pulseIn(4, HIGH); //RC throttle 
  
  Serial.print(throttle); // "throttle" or "steering" can go into this statmante for diagnostics to readthe code to set the response
  
  
   if (steering < 1455)   //left turn leds, tune with the triger value.
   {
     digitalWrite(8, LOW);
     digitalWrite(11, LOW);
   } 
    else 
   { 
    digitalWrite(8, HIGH);
    digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(300);               // wait for a second
  digitalWrite(8, LOW);
  digitalWrite(11, LOW);  // turn the LED off by making the voltage LOW
  delay(300);            
    }
    
    if (steering > 1300)  //right turn leds
   {
     digitalWrite(9, LOW);
     digitalWrite(10, LOW); // off
     
   } 
    else 
   { 
    digitalWrite(9, HIGH); //blink
    digitalWrite(10, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(300);               // wait for a second
  digitalWrite(9, LOW); 
  digitalWrite(10, LOW);  // turn the LED off by making the voltage LOW
  delay(300);            
    }
    
    if (steering > 1500 & throttle > 1340 :) & lightstate == 0)
   {
    delay(4500);
    lightstate += (1);
   }
  
  if (steering < 1300 & throttle > 1340 :) & lightstate == 1)
  {
    delay(4500);
    lightstate -= (1);
  }
  
  if (lightstate == 1)
  {
    digitalWrite(7, HIGH);
  }
 
  if (lightstate == 0)
  {
    digitalWrite(7, LOW);
  }
   
   if (throttle > 1340) :)
   {
     digitalWrite(13, LOW);
     digitalWrite(12, LOW);
   }
   else
   {
      digitalWrite(13, LOW);
     digitalWrite(12, HIGH);
   }
   
   if (throttle < 1320) :)
   {
     digitalWrite(13, HIGH);
     digitalWrite(12, LOW);
   }
   else
   {
     digitalWrite(13, LOW);
  
   }
     
  //forwerd 1400
  //back 1200
  //12 brake 
  //13 back up
   }

The code in the link i posted allows you to calibate the channels simply by moving the transmitter through its full range - ie you wiggle the controls and it remembers the min, max and center. If you wantbto change setups you press the programnbutton, wiggle again and it will remember the new set up.

To use vthis all you would need to do is replace the code inside the if mode == RUN partbwith your codevfor the lights.

Duane B