Silly rc project using cable

this is my first post,
sorry if I in the wrong section and my broken English,

I read this in Docs: "Analog In, Out Serial" :
"how to read an analog input pin, map the result to a range from 0 to 255"

then I think, I can make an RC transmitter cable using this Analog input,
this is the chart :
Untitled

and now I have 3 questions:
A. I hear cable has limitations, the longer the cable, the more loss of electric signal,
how long does the cable until this "signal" is "unrecognizable" by analog?
B. I like using Arduino on the "car side" and the resistors as "buttons" on the "controller side"
what resistor for each "bit"?
C. Is this project possible?

Note :

  1. I know there is a wireless module,
    but I am interested in this project's possibility
  2. I know how to code, but I lack electronic things

If it’s going to be wired to a controller, why do you need an Arduino?

Why not make it wireless and use like a PS2 controller. They are fairly simple to get working. I’ve even made one myself just last week.

Q. why do you need an Arduino
A. because i like to only using 2 cables 1 for positive, and 1 for negative,
if using cable, i need PC LAN Cable 7 positive and 1 negative

Q. Why not make it wireless and use like a PS2 controller. They are fairly simple to get working. I’ve even made one myself just last week.

A. why you made wireless RC with PS2 controller? why you not buy already to play 2usd RC?
probably, your answer same as my answer
the different is you have the knowledge, and i don't about electronic

Well, then begin and write some code.

"Well, then begin and write some code"
how i do the code if i can "define" the input?

Get a book on prgramming. Read it, learn it. Get a book on arduino. Read it, learn it. Write your project down, use paper + pencil for that. Make a plan. Code it. ETA: ~ 2 months.

I would suggest that you reverse the order that you have the functions in that table in post #1.

Make the most 'critical' functions use the most significant bits.

The way you have it organised means that a small amount of noise on your analogue input will cause the car to suddenly, and randomly jump from forwards to reverse, and back, or even jump to left or right.

A. Cable length will obviously determine its resistance. But even with thin wires, such as #28, I would not expect to see any serious consequences with say 5-10 metres. But no need for guessing when it should easy to test with a DMM.

I’d have thought flexibility was a more important factor? Presumably you’ll use highly flexible silicone wires?

B. I’m not really sure I understand fully what your ‘chart’ means. Column headings would help. Anyway, I’d recommend you write a simple sketch that’s accessible. Maybe using LEDs to represent each action.

1 Like

@Terrypin
A. i dont event have have multimeter, this just idea in my head,
if this possible, i will continue this project,
for now i have that arduino jumper cable, about 30cm,
if this project doable, i will buy other things like motor, LED lamps, and resistors(although I don't know how to count resistor formula)

B. my chart :
-if just go forward, analog 1 receive by arduino
-if turn left without moving, analog 4 receive by arduino
-if moving forward and go to left, analog 5(1+4) receive by arduino
-if moving forward, with Front lamp on, analog 65(1+64) receive by arduino,

of course i like to use LED for testing, if this project doable

You might like to find out about an R-2R resistor ladder to help you with the resistor selection.

However, it might be difficult to read all 256 combinations accurately.
Also there is no safeguard against you selecting forwards and backwards at the same time.

I suggest that you start with just 4 functions: forwards, reverse, left, and right.
With a total of 16 combinations, this would be easier to achieve reliably.

Then you could 'automate' the lights, that is make the turn signals to come on whenever the car is turning, and the reversing lamp to come on when the car is in reverse.

1 Like

@JohnLincoln i will study this R-2R resistor ladder,
for 4 functions it really good idea,
thank you for info
@Terrypin thank you for info too,

1 Like

I think that you will need to use screened cable / shielded cable to prevent pick up of noise/interference by the cable.

1 Like

@JohnLincoln that nice additional info, thank you

1 Like

Because mine didn't come with a controller (previous owner lost it, ebay...) plus I also wanted to add new functionality like sound effects, lighting and an alternate control style.

Hello, I do not think your project is silly. It is doable. For example, wireless communication work very poorly under water. So this could be a simple metod for two wire, robust, communication. The cable work as a capacitor. So, for long lenghts, you would see the voltage charge the "capacitor", voltage rise pulse ramp up/down issues. We do not know what cable you have. But this can be tested. For long distances, some company "coil up" the cable, to avoid this capacitor effekt, as the coil work as a inductor, "reversing" the capacitor effect. You could also use resistors to change the ramp up/down pulse voltage rise/decay.

The code is not that hard to understand: Simple analog read and IF statements. So you need to send different voltages to the cable reciver. This is done with resistor devider circuits usings ohms law.

Your suggestion reminds me about the arduino lcd display shield with pushbuttons. It use resistor devider circuit you talk about. Maybe you could even use it for your project. Note, the code is for example only. Here is the code and pay attetion the the if statements in the bottom:

/* YourDuino.com Example Software Sketch
 TEST LCD Display with Pushbuttons
 Based on code by Mark Bramwell and debouncing by peterstrobl
 terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <LiquidCrystal.h>

/*-----( Declare objects )-----*/
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); //These are the pins used on this shield

/*-----( Declare Constants )-----*/
#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

/*-----( Declare Variables )-----*/
int lcd_key       = 0;
int adc_key_in    = 0;
int adc_key_prev  = 0;

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  lcd.begin(16, 2);              // start the lcd object
  
  lcd.setCursor(0,0);
  lcd.print("Push A Button!"); 
  
  lcd.setCursor(10,1);
  lcd.print("A="); // For display of A0 Analog values from button push
  
}/*--(end setup )---*/

void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  lcd.setCursor(7,1);            // move cursor to second line "1" and 7 spaces over
  lcd.print(millis()/1000);      // display seconds elapsed since power-up

  adc_key_prev = lcd_key ;       // Looking for changes
  lcd_key = read_LCD_buttons();  // read the buttons

  if (adc_key_prev != lcd_key)
  {
    lcd.setCursor(12,1); 
    lcd.print("    ");         // Blank, display returned Analog value of button
    lcd.setCursor(12,1); 
    lcd.print(adc_key_in); 
  }

  lcd.setCursor(0,1);            // move to the begining of the second line

  switch (lcd_key)               // depending on which button was pushed, we perform an action
  {
  case btnRIGHT:
    {
      lcd.print("RIGHT ");
      break;
    }
  case btnLEFT:
    {
      lcd.print("LEFT   ");
      break;
    }
  case btnUP:
    {
      lcd.print("UP    ");
      break;
    }
  case btnDOWN:
    {
      lcd.print("DOWN  ");
      break;
    }
  case btnSELECT:
    {
      lcd.print("SELECT");
      break;
    }
  case btnNONE:
    {
      lcd.print("NONE  ");
      break;
    }
  }/* --(end switch )-- */

}/* --(end main loop )-- */

/*-----( Declare User-written Functions )-----*/

int read_LCD_buttons()
{
  adc_key_in = analogRead(0);      // read the value from the sensor 
  delay(5); //switch debounce delay. Increase this delay if incorrect switch selections are returned.
  int k = (analogRead(0) - adc_key_in); //gives the button a slight range to allow for a little contact resistance noise
  if (5 < abs(k)) return btnNONE;  // double checks the keypress. If the two readings are not equal +/-k value after debounce delay, it tries again.
  // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
  // we add approx 50 to those values and check to see if we are close
  if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
  if (adc_key_in < 50)   return btnRIGHT;  
  if (adc_key_in < 195)  return btnUP; 
  if (adc_key_in < 380)  return btnDOWN; 
  if (adc_key_in < 555)  return btnLEFT; 
  if (adc_key_in < 790)  return btnSELECT;   
  return btnNONE;  // when all others fail, return this...
}
1 Like

thank you @Tordens for the reply,

I don't know either what cable I should use, I probably use the 30cm jumper cables stacked about 2 meters, after it is done, I just scrape it and do other projects

my main problem with the Arduino is : that I do not have knowledge about electronics,
the only project I've done is using "relay" to program some factory machinery,
even for very basic like connecting the LED lamp to battery, I have no idea what resistor that I should use,

For the code, I get the concept of it
I am an IT guy who does Python programming for employee automation

Research common resistor values from 1ohm to 100M ohm and print out all possible combinations that yield a decent range of values from 0-1023 using the voltage divider formula. Use 1Kohm as your base resistor (R2) and R1 will be all the other resistors in parallel, use switches to complete the circuit. Try to find ones that give a decent gap of about 50 each on a 1-1023 scale.

You should be able to do this in Python with ease.

1 Like

i don't know what input and expected output,
and most important : why or when I should use this program

Input is 5 volts and the output is between 0-1023av which is what the Arduino expects as an analog input.

You said you wanted to use resistors to control your car, right? This is how you do it. The combination of resistors will change the input value to the Arduino ie.
0v = 0 analog value
2.5v = 512 av
5v = 1023 av
And everything in between.

Different “av” will result in a different action the robot does. You define these actions based on the value you send to the Arduino by the combination of the resistors you connect.

Would you like a diagram?

sorry i quite confusing
A. what should i do in python?
B. I read this in Docs: "Analog In, Out Serial" : "how to read an analog input pin, map the result to a range from 0 to 255", now you write "output is between 0-1023av which is what the Arduino expects as an analog input." it can read 10bit?

if you not busy i like to read the diagram
additional note: i understanding about electronic is below newbie,
please be patient with me