Hi everybody I am new to arduino but not to programming so im having difficulty with the hardware portion of my project rather than my code. Heres what I have done, I have taken an old RC reciever and transmitter and wired them up to my arduino uno. I did a serial.print to give me the range at which each button on my transmitter transmits and I have mapped my transmitters. I have set up 4 led’s on my breadboard that represent forward, reverse, left, and right and all that works flawlessly… What I am trying to figure out is how to add a motor and a servo to what I have now so I have forward and reverse movement along with left and right steering… instead of just a blinking LED for each signal I want actual movement…
rc_controller_sketch.ino (658 Bytes)
Not to blow you off but what you are asking is really quite easy to find using a google search for
"arduino dual motor control "
"arduino robot dual motor control "
etc. etc. etc.
Basically in 25 words or less :
You need an H-bridge , like the L293 or L298.
You need four DIRection control digital I/O
and TWO PWM capable pin I/O ,
If you use pin 9 OR 10 for PWM , YOU MUST USE BOTH 9 AND 10 OR NEITHER 9 AND 10.
YOU CANNOT USE ANY COMBINATION THAT INCLUDES ONLY 9 OR 10 FOR PWM.
google “arduino analogWrite” for details.
If left motor shaft FACES TO THE LEFT
RIGHT MOTOR SHAFT FACES TO THE RIGHT,
WHAT DOES THAT TELL YOU ABOUT THE ROTATION DIRECTION (CW,CCW) to go FORWARD or REVERSE ?
FORWARD: LEFT MOTOR CCW, RIGHT MOTOR CW
REVERSE: OPPOSITE OF ABOVE
LEFT TURN: BOTH MOTORS CW
RIGHT TURN: BOTH MOTORS CCW
SPEED CONTROLLED BY PWM SIGNALS EN1 (MOTOR-1) and EN2 (MOTOR-2).
That’s pretty much it.
To control the servo, use the Servo library to generate the output pulse. You will need to provide your servo with a suitable power source (it can't be powered directly from the Arduino) and the ground of the servo's power source will need to be connected to the Arduino ground.
To drive a motor with control over direction and speed you will need a h-bridge driver circuit. There are plenty of shields available. You will need to ensure the shield has a suitable voltage and current rating for your motor, and also that it doesn't rely on any PWM pins that are disabled by the Servo library. Obviously you'll need to provide a power supply for the motor, too.
What I am trying to figure out is how to add a motor and a servo to what I have now so I have forward and reverse movement along with left and right steering.... instead of just a blinking LED for each signal
You only mentioned ONE motor. Obviously almost ALL of the robot drive designs use TWO motors , direct drive , wheel on the motor shaft because that eliminates the need for an axle , gearing differential etc. You need to think about what you said in your post:
" how to add a motor "
since everything I said in my reply applies to a TWO motor drive system.