Hello, new here and to adruino. I bought this chip not too long ago, and played with most all of the examples that are included with the software. but soon wanted to move onto something bigger, an rc car. so here is what i want to do. I have my receiver from an rc plane, four channels, one being throttle for brushless setup or the incorporated dc motor controller. Since this large rc car has a big dc motor i was able to just connect the motor controller to the motor terminals and my throttle works fine(except no reverse, not worried about that though) now I don't know if this has been gone over before but if it has I cant find it anywhere. I need my ardruino uno to take the input from a channel on my receiver and put it to the dc steering motor. I want it to work like a servo. ive done some research and it looks like I have to use PulseIn and then use something like this for output. However I really don't know how to put it all together and get this working. Any advice to get me going in the right direction would be greatly appreciated. Thanks!
lukepop789: I need my ardruino uno to take the input from a channel on my receiver and put it to the dc steering motor. I want it to work like a servo.
First things first. You say "dc steering motor" which makes me think this is a very simply RC car that has a simple motor to turn the wheels. These usually have simple push button controllers where you either have an option of straight or hard turn in one direction, or perhaps it has a centering spring so you have straight, hard left turn, and hard right turn.
You then say you want to make it act like a servo. This implies that you want the car to have proportional steering (move the stick a little and it turns a little, move it a lot and it turns hard.) If the car has the type of steering I just mentioned, you won't be able to get it to act like a servo, as you will be missing the position feedback and the control electronics which are essential to the operation of a servo.
If you have this type of steering, the best you will be able to do is to mimic what the original transmitter did: hard steering. You can try to PWM the signal to the motor, but all that will do is reduce how quickly the motor reaches the steering limit, it won't cause it to steer a gentle turn.
You are on the right track that pulsein() should be able to read the signal from the RC controller and determine the transmitter's stick position. And an H bridge will give you forward/reverse control of the motor. But I don't think you will be able to get very good steering out of it. (You really won't get it to perform significantly better than it can with the original transmitter, which I'm thinking is why you want to do this in the first place.)
Thanks for the help! I see where your coming from that it will never become proportional. i guess if that's the wy it is then that's the way it is. Im mainly doing this as a fun learning project. the original tx/rx quit working. and yes is is a simple gearbox with a DC motor.
lukepop789: Im mainly doing this as a fun learning project.
That's as good a reason as any! 8) Especially if you have reasonable expectations.
I would suggest a phased approach: take baby steps, don't try to do it all at once, or it will be very hard to figure out where the inevitable problems are happening.
Start by hooking the H bridge up to the steering motor, and use the serial monitor to send command to it (positive motor polarity, negative motor polarity, and off.) Experiment and see what effect that has on the motor. Then try using PWM (the analogwrite() function) to reduce the power to the motor and see what effect it has. Attach some long wires to the motor so you can run the car and see how various PWM values affect the steering. Take notes at each step. The goal is to figure what level of control you can achieve. For example, there's no point in trying to figure out proportional steering commands if the steering turns out to only work well with full on and full off.
With that figured out, try to read commands from the RC receiver. Use the pulsein() function to see what range of values you can read. Don't try to do anything with those values yet, just print them to the serial monitor. Figure out what readings you get at center and each extreme. See what effect the transmitter's trim controls have on those ranges. See how repeatable your readings are.
Now, knowing the steering characteristics, and the receiver characteristics, figure out a mapping from the receiver values to motor states. Don't hook up the H bridge or motor yet, just decode the received values and print the detected command: straight, right, hard left, etc.
Now go back to the motor control, and get it working so you can type those commands on the serial monitor, and the steering does what you want.
At this point, you've figured out what you can do, and you've come up with modules that can drive the steering motor and that can decode the receiver output. You've unit tested everything so you know each part works.
Finally, it's time to put it all together. Make one sketch with all of the modules. The main loop calls the function to read a value from the receiver. It calls another function to translate that value into a steering command. Then it finally calls the function to actually move the steering.
Once you've got all that working, you'll have a bunch of Arduino pins unused, as well as some unused receiver servo channels. Figure out what else you can do with them: add remote controlled headlights. Automatic turn signals that respond to the steering commands. Brake lights that come on when you reduce the drive motor speed. A horn. And whatever else you can think of.
This could turn into a fun and advanced project. Good luck!
@ Shapeshifter, (is that from DS9?),
Good advice to the OP.
raschemmel: @ Shapeshifter, (is that from DS9?),
Good advice to the OP.
Thanks. I've been doing this for a few years... :)
No, the name isn't connected to Odo. I bought one of the first few Chevy Avalanches when they came out in '02, and a friend started calling it the ShapeShifter because of the way it could transform. Then I joined an Avalanche truck forum and needed a handle, and it was a natural. The name has now stuck through a bunch of forums, I've gotten used to it over the years. The name has stuck longer than the truck: I sold it last year after 12.5 years and 150,000 miles. I miss that truck, it was my favorite vehicle of all time. Solid and reliable, it never let me down. "Like a rock." :'(