I'm in the process of building a Mega Liner crawler (think line crawler that goes much faster) and need some advice on controlling the motor. Currently, a Futaba R617FS receiver takes an input from the RC controller and outputs a signal between .272V and .206 to a TEU-101BK Motor Controller which then modulates the voltage into the Motor between 0V and 7V. I'm thinking the best way to interface with this is program the Arduino to output the .272-.206V depending on how fast the car needs to go (as everything will be preprogrammed and the Radio Controller won't be in use, it's fine to unplug the receiver from Motor Controller). My question is, what is the most effective way to output such fine changes in Voltage from an Arduino (when I want to be able to output the full range of voltages, not just .272 and .206)?
I first thought just using analogWrite(), but the difference between the Voltage is small enough that the only values I can write were 10, 11, 12, 13, and 14 and I need much finer speed control then that.
I first thought just using analogWrite(), but the difference between the Voltage is small enough that the only values I can write were 10, 11, 12, 13, and 14 and I need much finer speed control then that.
What Arduino do you have? The Arduinos that I know do not have a DAC and cannot output an analog voltage - at least not without a low pass filter and some buffering. The Arduinos that I know put out Pulse Width Modulation which is not what was described.
The throttle maps from 1500-1100 for 0-full throttle. It seems like the Pulsein fucntion returns a value in milliseconds of how long the pulse lasts which leaves me with a couple questions:
How long do I wait in between pulses. If i'm trying to put the motor at a set speed, it seems like I need to send repeating pulses of a set length. But how long do I put in between these pulses. For example, for the below code, I assume A is the value pulseIn() returned, but what would B be? Are they the same?
2.The motor controller for the RC car is powered by a 7V battery. If I pulse it with 5V (from the arduino), will it read that? I assume I have to make common grounds (The wires connecting the Radio Controller to the motor controller are 3 wires per information flow, V+, GND, and signal).
Thanks for all the help so far. I've been very successful in controlling motor speed so far, but seem to have trouble controlling the steering. Frustrating as they should be the exact same.
Something like this sets the speed to half throttle and it'll sit there happily.
Servo sspeed;
int SIG = 7;
int carspeed = 45;
void setup() {
sspeed.attach(SIG); //Attach the servo to pin SIG
sspeed.write(carspeed); //write starting throttle position
}
void loop() {
}
Yet something like this appears to have no effect on the steering:
I tried using ssteer.writeMicroseconds(1750) and that has no effect. Using a program which reads output from the radio controller pulseIN(6, HIGH, 2500) I can see the steering signal outputs pulses in between 1000 and 2000 microseconds. When I ran the same program on my steering control program (that is, reading the pulses output from the arduino), I see something like this:
Channel 1:0
Channel 1:1727
Channel 1:0
Channel 1:1727
Channel 1:0
Channel 1:1727
Channel 1:0
Channel 1:1533
Channel 1:0
Channel 1:1733
Could this bouncing be the issue (Note, the bouncing could be an error on my part in the connections, but I doubt it).
Any ideas? It seems like Steering and Speed control should be the exact same to the point where if I just switch the speed header with the steering header and run the speed program, the steering should change, but it doesn't...
So the issue ended up being that the servo for steering is powered by the signal (and the GND, V+ wires) and the Arduino can't supply enough current for it. Once I added a 5V battery in parallel it all worked great.
Thanks for the all the help!