Notifications
Clear all

Robot Car Continously Running Why ?

43 Posts
7 Users
0 Likes
7,256 Views
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

We all have seen the bill's post on how to make an "https://dronebotworkshop.com/nrf24l01-wireless-joystick/" .

it was an amazing project. I have RC Robot Chassis with Geared Motors when I tried to use that exact code for making my own Rc Car with the same method and Same wiring Connections I am Getting Errors. Like both of my motors on the chassis are continuously rotating even when my Joystick is free. although it is responding to my joystick commands like moving in a certain direction Sometimes But it's not Working same as Bill's Rc car. I don't Know what changes do I have to Make in Sketch to make my car work Properly. This is theexact Code That I have Uploaded in My Rc Car and also in my setup instead of the single standalone joystick I am using a Joystick Shield.

 


   
Quote
Topic Tags
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

if anyone has ever encountered this type of error then please share 


   
ReplyQuote
Spyder
(@spyder)
Noble Member
Joined: 4 years ago
Posts: 926
 

@gulshan

Have you looked at the readouts of the joystick when you let go of the handles ?


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

yes they are same as shown in the bill's video while testing the code but when i check the IN1 and IN2 pins from my multimeter it keeps showing me some voltage up-down readings


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

if you like I can send a video of my car continuously running after uploading code


   
ReplyQuote
Spyder
(@spyder)
Noble Member
Joined: 4 years ago
Posts: 926
 

@gulshan

It was just a thought. I was thinking that maybe the joysticks weren't zeroing themselves out when you let go of the handles


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

@spyder

Yeah maybe Today I will try to Send you a Video as soon as possible


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

Sorry it took me more than one day, here I uploaded the video on the youtube so please take a look and tell me what you think the problem is :-


   
ReplyQuote
triform
(@triform)
Reputable Member
Joined: 4 years ago
Posts: 339
 

You may need to add a "deadzone" to the read of the analog number. Subtract or add say 15 to or from the reading before the if statements you check the direction with.  You would subtract in the + direction and add in the - direction of the numbers read in from the analogRead.  Hope this makes sense.

Scott


   
ReplyQuote
Freddie43
(@freddie43)
Eminent Member
Joined: 3 years ago
Posts: 24
 

@gulshan

Afraid I haven't had the time to look at Bill's code, but I have made quite a few Arduino robot cars with 433MHz and nRF24s guided by joysticks and MPU6050s (as a wrist controller - much more fun than a joystick) so I suggest you try doing something along the following lines...

First, with the transmitter, get a printout for the extreme and 'neutral' positions of the controller as they are passed to the transmitter.  (I just sent values 0-1023).

Then with the receiver, get a printout of what is received for the above positions. If they match, the problem is in the rest of the code. Otherwise there is a problem in your TX/RX.

Myself, in the receiver I took a neutral mid point of 512 and converted the 0-1023 to forward/backwards (0-512), and as @triform says I used a 'deadzone' - a safe area around the neutral position where you can be sure the car won't respond - in my case 40 worked well. Then there is all the logic to work out the steering.

But you also need a 'deadman's handle' that will stop the car when it is out of range of the transmitter. This was made worse in my case as I decided to only transmit signals 'on change', which meant the transmitter had to send out regular pulses for the car to check that it was in range.

Coding from scratch rather than using someone else's code is much more fun and at each stage you will know exactly what you are doing. Once you have worked the logic out it all falls in to place. Good luck!

This post was modified 3 years ago by Freddie43

   
ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 4 years ago
Posts: 1647
 
Posted by: @freddie43

Coding from scratch rather than using someone else's code is much more fun and at each stage you will know exactly what you are doing. Once you have worked the logic out it all falls in to place. Good luck!

That is critical as debugging hardware and software is part of doing electronic projects.  If you just copy paste you will not develop the skills to fix the problems yourself or to use the hardware in your own creations.

As I use a laptop for the robot brain all I needed was a wireless keyboard for close remote control and also sending commands.  However the nrf24l01 module could be very useful in other electronic projects and I will have to order a couple to play with including the remote control robot base example then when I fully understand the code and hardware I can help figure out the continually running motor issue.


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  

@freddie43

Posted by: @freddie43

Coding from scratch

so Maybe I should try to First make a code that allows me to control the motor through simple wire connections from arduino through the joystick.


   
ReplyQuote
Gulshan
(@gulshan)
Estimable Member
Joined: 3 years ago
Posts: 127
Topic starter  
Posted by: @freddie43

First, with the transmitter, get a printout for the extreme and 'neutral' positions of the controller as they are passed to the transmitter.  (I just sent values 0-1023).

Then with the receiver, get a printout of what is received for the above positions. If they match, the problem is in the rest of the code. Otherwise there is a problem in your TX/RX.

so should i have to take a screenshot of the values in the COM port of each transmitter and Receiver ?


   
ReplyQuote
Freddie43
(@freddie43)
Eminent Member
Joined: 3 years ago
Posts: 24
 

@gulshan

Yes. When I started on robot cars I wired potentiometers directly to the car circuit. First of all I did it for steering and speed, but then I did it as joystick substitute, and then finally with the joystick.

(When working in a new area it is often best to take small steps as you formulate your ideas)

[Sorry I don't know how to quote!]

This post was modified 3 years ago by Freddie43

   
ReplyQuote
Freddie43
(@freddie43)
Eminent Member
Joined: 3 years ago
Posts: 24
 

@gulshan

No need to take a screenshot. Just copy and paste the contents of the COM screen into your word processor and print it. 


   
ReplyQuote
Page 1 / 3