RC Car

So Good morning everyone i have a question.

i want to use an RC car with an arduino. but i dont really know what car is good for that.
this is the car i have now: https://www.monstercars.nl/product_info.php?products_id=7509&utm_source=google&utm_medium=googleshopping&utm_campaign=googlebase&gclid=CjwKCAjw4rf6BRAvEiwAn2Q76sXhAd9CuCWme--T1yWkN_m57ZTGG-DZoUryZBKnbS6MYB1CR4JpLxoClLEQAvD_BwE

Could you guys give me some feedback on the car.

if u have other suggestions just send them.

PS

I want to use the arduino to make the car go the same speed. + when i press on a button i want it to turn around and come back towoards me.

I’d go for the cheapest, slowest RC car you can find, to begin with.

freezeze:
I want to use the arduino to make the car go the same speed. + when i press on a button i want it to turn around and come back towards me.

Where will this button be? On something you are holding while the car is driving?
How will the thing with the button communicate with the car?
How will the arduino in the car know what speed it is going to help maintain the same speed?
How will the arduino know what direction to turn to get back to you?
How will the arduino know how far to travel to get back to you? (does it need to know this or is it good enough to simply turn around?)

Some of these are simple challenges and some are more complex.

So ill try to explain a little bit. Right now im going to use a arduino kit to make an RC car. with that car im going to tell him it has to go straight forward. so for now im using a button but later on im going to use a laser.

So imagine their is a rc car driving around with a little lasergamevest. And if you hit that vest the car will turn around towoards you and it will drive with the same speed as it did before.

i dont know if thats a better explenation on what i want to do. i hope it is

Your response did not answer my questions and raised more. ::slight_smile: ::slight_smile:

You talk about starting with a button but the real goal is to have a lasergamevest on the car. Does that mean that the button you need to press is on the moving car? Sounds challenging just from a physical dexterity point of view. I originally thought that you would be holding a controller with the button and it would communication with the arduino on the car.

Is the car basically going to be target practice for a laser quest style game?

Is the car going to be operating autonomously or will someone be controlling it with a traditional RC car controller?

Many more questions but I want to start with these 3.
Let me reiterate the questions I asked so they do not get missed.

  • Is the button on the car?
  • Is this a target practice for laserquest?
  • Is the car autonomous?

Question 1
Answer:
Alright so their wont be a button on the car probs i dont know for sure yet.

Question 2
Answer:
Yes it will be used for a laser practice, so if you hit the vest the car should turn around or just something should happen.

Question 3
Answer:
Yeah the car has to drive itself with the same amount of speed so i need to use PWM in my code.

Right now ive chosen for a arduino car kit that i have to build by myself but i have some problems with the code.

i hope this clarifies it a bit more

Thank you, it does clarify some and as often happens, opens up many new questions.

You mention driving at a fixed speed. Doable. You control the input to the ESC. If you want accurate, constant speed, you will need some way to measure the speed. And you will likely have to employ PID to maintain your target speed.
Or you can just pick a throttle setting and let the car move at whatever speed that generates.

Autonomous driving is not easy.
How will the car know when to turn? And how much to turn?
Will this be indoor or outdoor?

You mention the laser vest. How will the arduino know when the vest detects a hit?

Will the car just drive until the battery dies or will there be some way to tell it to stop?
Perhaps a timer, say run for 3 minutes then stop.
Or perhaps a button on a remote that can be used to start and stop the operation.

ill try to explain some.

So the car has to drive on a speed that is like 5 kmph. With PWM control u can tell the car to go at a certaint speed like 200 from the 255 that are their cuz 255 is the max right?

so 255 is full speed that means that 200 is slower if u will use a pwm code the car will just go on and drive till the battery runs out. ( so thnx for the tip to put a timer on their to make stop and come back.)

In the laser vest are sensors and if u connect these sensors to the arduino and if you code it right it should know that if theirs a hit ( a light shining from the vest) it goes true the arduino and it should turn around.

Im just saying this is probs really messy but i dont really know how to explain it to you.

Do you have discord or something maybe we can talk about it in there ?

O.k. now it's getting clearer. Yes PWM can adjust speed. But setting a PWM value doesn't set a FIXED speed. The speed will change with load or slopes or the battery running down or when the car is turning. But I don't think you actually want a fixed speed just some control. So that part is o.k.

Getting a car to turn left or right is easy. Getting it to turn through exactly 180 degrees so it retraces its path back to you is considerably trickier.

Then do you know exactly what the laser vest sensors are? Have you already written the "right code" so you know that the Arduino can recognise a hit? It makes sense to write a complex program in small parts, testing as you go.

Steve

the only thing ive coded is the turning part:

#define LED_1 12
#define LED_2 11
#define LED_3 10
#define LED_4 9
#define BUTTON 4
bool buttonCheck = false;
bool buttonCheck_1 = false;

void setup()
{
pinMode (LED_1,OUTPUT);
pinMode (LED_2,OUTPUT);
pinMode (LED_3,OUTPUT);
pinMode (LED_4,OUTPUT);
pinMode (BUTTON,INPUT);
}

void loop()
{
if(digitalRead(BUTTON) == HIGH)
{
buttonCheck = true;
buttonCheck_1 = true;
}

if(buttonCheck == true)
{
digitalWrite(LED_1,HIGH);
digitalWrite(LED_2,HIGH);
delay(2500);
buttonCheck = false;
}

if(buttonCheck_1 == true)
{
digitalWrite(LED_3,HIGH);
digitalWrite(LED_4,HIGH);
buttonCheck_1 = false;
}

if(buttonCheck == false)
{
digitalWrite(LED_1,LOW);
digitalWrite(LED_2,LOW);
delay(2500);
digitalWrite(LED_3,LOW);
digitalWrite(LED_4,LOW);
}
}

alright so ill explain it. my idea was what if you led 1 and 2 are 2 motors. and you turn these two on so that the car would turn 90 degrees in 2.5 secs backwards. lets say he wil turn left back then led 3 and 4 should make him go forward right in 2.5 secs so that he changed 180 degrees.

Im going to use the elegoo kit3.0 to just have the basics of an arduino rc car. I dont know yet how i want to use the vest but is their maybe another option. I thought about light sensors already but i dont know for sure.

freezeze:
( so thnx for the tip to put a timer on their to make stop and come back.)

Actually, I just said stop. Stop and come back to you is massively harder.
This takes me to my previous questions.
How will the car know where it is?
How will the car know where you are?
How will the car know how to navigate from where it is to where you are?
These are not trivial tasks and I have seen no awareness on your part how difficult this is.
I am not trying to shoot you down. Go for it! But there are some big challenges to autonomy.

In the laser vest are sensors and if u connect these sensors to the arduino and if you code it right it should know that if theirs a hit ( a light shining from the vest) it goes true the arduino and it should turn around.

Do you have the vest? I think that this would be a great task to tackle now.
Connect the sensors to the arduino. Code it. Make it so that is prints to the serial monitor with the work 'MISS' if it detected no hits in the last second. And the word 'HIT' if it does detect a hit.

Do you have discord or something maybe we can talk about it in there ?

That removes one of the biggest values of this forum - History.
Let's keep the conversation here so that future forum members can take advantage of the content.

alright so ill explain it. my idea was what if you led 1 and 2 are 2 motors. and you turn these two on so that the car would turn 90 degrees in 2.5 secs backwards. lets say he wil turn left back then led 3 and 4 should make him go forward right in 2.5 secs so that he changed 180 degrees.

Ahhh. Dead Reckoning.
This is a common first attempt at autonomous navigation.

It is very limited. Simply running two motored wheels at the same throttle command rarely results in straight travel. Turning for a fixed time rarely results in a predictable turn angle.

Again, if you have the elegoo kit, try it out. Try to make the car drive in a square, turn around and travel back along the path it took.
Straight
Turn left
Straight
Turn left
Straight
Turn left
Straight
Turn 180
Straight
Turn right
Straight
Turn right
Straight
Turn right
Straight
How close is it to where it started?
Maybe this is good enough. You try and let us know.
The navigation error is cumulative so the farther it travels, the greater the error.

So i do this for an internship and im excited about it but its really hard. My supervisor told me the car just has to do something. So if the vest gets a hit the car should stop or turn or atleast act different then it normaly would.

The obstacle that im walking towoard is how im going to get the vest to make the car turn. Because i have a feeling how it works let me explain.

what i think i have to do is connect the vest to the arduino ( i dont know where to connect it) and when ive done that i have to know when theirs a hit or a miss. thats what i would see in the serial monitor if i programmed it right.

so in the serial monitor u would see hit and the vest would still light up.

after that their should be an if statement like this:

if (digitalRead(VEST) == HIGH)
{
vestCheck = true;

and then u get the whole code with the turning right ?
i think for the most part now i need help with the coding but ill try some myself

Until you know exactly what sensor(s) you have on the “vest” and preferably a detailed specification of it there is absolutely no point in worrying about the car.

Do you actually have a “vest” of a suitable size to mount on a small robot car? If so you can start experimenting to see what output you can get from it that an Arduino can read.

From what I can see the car is the easy part of your project.

Steve

Hahaha yes the car is the easy part i only need the kit right now and i can start building.

yeah ill send you the link of the vest that i got its not a big vest but its verry handy for my project. Because the vest has strapons. im right now waiting to test the vest i only need batteries at this moment.

by the way this is how far i got with the serial print:
i saw some videos on youtube and i think im going to the right direction.

int VEST = 10;

//10 = HIT

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.print(10);
Serial.print(" ");

VEST = VEST +0;
}

{
if digitalRead(VEST == HIGH);

Needs . . . some work.

Please get into the habit of using code tags when posting code.

ye i know it needs some work im checking already on youtube and im on this forum for some help.
ill try my best to atleast get somewhere so it works.

what is the tagg for codes? like just type CODE:?

Just read "General Guidance and How to use the forum" at the top of every forum including this one.

Steve

alright im sorry ill try to follow the rules more.

So does anyone know how to go further with my code ?

int VEST = 10;

//10 = HIT




void setup() {
Serial.begin(9600);
}

void loop() {
Serial.print(10);
Serial.print(" ");

VEST = VEST +0;
}


{
if digitalRead(VEST == HIGH);


}

so this is what i have. and this has to happen in the code.
the following code that im going to show is with led but wil later be with motors.

#define LED_1 12
#define LED_2 11
#define LED_3 10
#define LED_4 9
#define BUTTON 4
bool buttonCheck = false;
bool buttonCheck_1 = false;


void setup() 
{ 
  pinMode (LED_1,OUTPUT);
  pinMode (LED_2,OUTPUT);
  pinMode (LED_3,OUTPUT);
  pinMode (LED_4,OUTPUT);
  pinMode (BUTTON,INPUT);
}

void loop() 
{
  if(digitalRead(BUTTON) == HIGH)
  {
    buttonCheck = true;
    buttonCheck_1 = true;
  }

  if(buttonCheck == true)
  {
    digitalWrite(LED_1,HIGH);
    digitalWrite(LED_2,HIGH);
    delay(2500);
    buttonCheck = false;
  }

    if(buttonCheck_1 == true)
    {
    digitalWrite(LED_3,HIGH);
    digitalWrite(LED_4,HIGH);
    buttonCheck_1 = false;  
    }

  if(buttonCheck == false)
  {
    digitalWrite(LED_1,LOW);
    digitalWrite(LED_2,LOW);
    delay(2500); 
    digitalWrite(LED_3,LOW);
    digitalWrite(LED_4,LOW);
  }
}

and what i want to happen is if in the serial monitor stands 10 (=Hit) that then my code will happen with the Leds .

i think i have to play with the buttoncheck and buttonread but im not sure.

The Arduino IDE is jammed full of useful basic tutorials - try working through a few.