Go Down

Topic: I need help with Programming a rc car with the uno and a Seeed Motor shield (Read 235 times) previous topic - next topic

Im starting a project i call ""e"voiding EDISON"(NO PUN INTENDED(JK@!! :D )) and ive built the body with a old dodge charger rc car body(With motors and stuff), a arduino uno, a Seeed Motor Shield V2.0, and an HC-SR04 Ultrasonic distance sensor with 4 pins(VCC(5v input)Trig,Echo,andGND(Ground input)ALSO IM NOT MAKING IT HAVE A MOVING SENSOR WITH A SERVO!. i need programming and a schematic, and the distance for the sensors is 5 - 8 inches( your pick). i will need the pins for the trig and echo as digital 5 and 6. theres a motor for turning the front wheels and a back wheel drive motor. idk the voltage but its a gearbox dc motor(For Both)


Cactusface

Hi,
     What pictures? Where....   We need a little more to go on, like many here I have built a few robots/buggys etc. So have the code, etc but really need to know more about what you have in mind, does this car have 1 or 2 motors driving the wheels? if only one then you will need a servo for steering, this may already be there.

But the usual way of doing it is to have 2 driving wheels, both driven by their own motor, so reversing or stopping one turns the buggy. The HCSR04 is easy to use.

I suppose for today I could be a software writting service, what about £5 an hour, that's modest I'd say, but even better! Look in the examples, the Playground, search the forum and you will find all you need.

You don't learn anything by getting others to do the work for you, and he who says he never made a mistake, never made anything!!

So yes I can help, do a bit of research and get back to us.  Take a look here under electronics : www.melsaunders.co.uk


Hope it helps.

Regards

Mel.
Open your mind! But not too far, your brains might fall out.
Also like Photography, model building and my 300+ Cacti and Succs.

Thanks i couldnt get up the pics srry.... also im in the us
But hey thanks anyways! :D

Cactusface

Hi,
         It does'nt matter where you are!! if you need help, we need a few more details.
Modding an RC car I would'ent fancy? and perhaps buying a cheap robot chassis kit from China via eBay may be a better way of doing things, it would be my choice for a first time, may not look as good as an RC car, but much better to learn, understand
and experiment with!!

I have code and schematics, etc..

Why could you not upload the photos??  Try again, no one gets it all right every time.

Regards

Mel.
Open your mind! But not too far, your brains might fall out.
Also like Photography, model building and my 300+ Cacti and Succs.

JimboZA

Looks like you tried somehow to put the pix in the body of the post. Rather try the link just under the typing area "Attachments and other options" then "Attach", "Choose Files".

But just for my understanding, you want someone to provide you a complete solution of circuitry and programming? Jeez.
My hovercraft is full of eels.

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

sorry i had to go to middle school today... i saw your guys's posts today. yeah i made a new robot chassis out of a cd case. i have 2 gear motors...low speed high torque.1 battery holder for 8 1.5v AA batteries. yeah i dont know much because im only 13...i need help is all..... and i dont have much money with my family.... sorry...im doing this for a science project and im not a good coder...

JimboZA

Well asking for folk to provide you with fully working code isn't going to make you a better coder.... If you didn't already, work through the examples in the ide (File > Examples) which are also here.

But that said, the seeedstudio wiki shows how to hook one motor up and run it with some demo code once you install their library. Have you tried that? It should be easy enough to expand the code for two motors, but I'm sure we'll help if you get stuck.

Then this instructable shows how to hook up and code an hc-sr04.

I found those with Google....

Get each part (the motor shield and the sensor) working independently of each other to start with, then think about how to get the sensor to influence the motor.
My hovercraft is full of eels.

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Cactusface

Hi,
         Sounds like a plan to me, but shout and we'll help where we can, but if you want to learn you've got to try!

Regards

Mel.
Open your mind! But not too far, your brains might fall out.
Also like Photography, model building and my 300+ Cacti and Succs.

hey would this work?ive got a new chassis(An xbox case. :D )
Code: [Select]
#include "MotorDriver.h"
#include "Ultrasonic.h"

#define TRIGGER_PIN  12
#define ECHO_PIN     13

Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);

int maximumRange = 50.5; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

void setup()
{
   Serial.begin (9600);
/*Configure the motor A to control the wheel at the left side.*/
/*Configure the motor B to control the wheel at the right side.*/
motordriver.init();
motordriver.setSpeed(1000,MOTORB);
motordriver.setSpeed(1000,MOTORA);
}
 
void loop ()
{
  /* The following trigPin/echoPin cycle is used to determine the
 distance of the nearest object by bouncing soundwaves off of it. */
 digitalWrite(TRIGGER_PIN, LOW);
 delayMicroseconds(2);

 digitalWrite(TRIGGER_PIN, HIGH);
 delayMicroseconds(10);
 
 digitalWrite(TRIGGER_PIN, LOW);
 duration = pulseIn(ECHO_PIN, HIGH);
 
 //Calculate the distance (in cm) based on the speed of sound.
 distance = duration/58.2;
 
 if (distance >= maximumRange || distance <= minimumRange){
   /* Send a negative number to computer and Turn motors On
 to indicate "out of range" */
 Serial.println("-1");
 motordriver.goForward();
delay(5000);
motordriver.stop();
delay(1000);
 
 }else {
 Serial.println(distance);
 motordriver.goRight();
delay(2000);
motordriver.goForward();
delay(2000);
  }
 
 
 

Hi,
         Sounds like a plan to me, but shout and we'll help where we can, but if you want to learn you've got to try!

Regards

Mel.

also Cactusface....thank you! i wrote this code with a copy and paste tool and my brains for part of it...ima post new pics in a few
Thanks.

HERE! lots of duct tape!!!

Go Up