I am trying to connect an Arduino Mega clone to a Sabertooth 2x60 Amp controller. I have several different functions I need the Arduino to perform.
Provide output to the motor controller 2) provide an input for multiple proximity sensors (and affect motor output based on sensor input) 3) provide linear actuator outputs (via relays) 4) provide camera input / outputs 5) other future uses.
I have 5 possible dip switch settings on the controller to allow different methods of control. I am leaning towards option 2. What I would like to confirm is can I remove the serial options because they need to transmit over a single Tx or Rx wires and it wouldn't work properly with the other inputs.
Also I am assuming that serial is ordinarily the best option, is it?
OPTIONS
Analog control, linear, independent:
a 0V to 5V analog input is connected to terminal S1. 0V is full reverse, 5V is full forward, 2.5V is stop.
Microcontroller pulses, independent
linear control: An R/C servo signal is connected to terminals S1 and S2. A 1000us – 2000us pulse controls speed
and direction. 1500us is stop.
Radio control, differential drive,
exponential: An R/C servo signal is connected to terminals S1 and S2. The Sabertooth will auto calibrate the center
and endpoints of the signal.
Simplified Serial, 38400 Baud:
A TTL level 8N1 serial data stream is connected to terminal S1. Control is by single byte commands.
Motor 1: 1 is full reverse, 64 is stop and 127 is full forward.
Motor 2: 128 is full reverse, 192 is stop and 255 is full forward.
Packetized Serial, address 128:
A TTL level 8N1 serial data stream is connected to terminal S1. Control is via a multi-byte packet.
CodeCruncher:
I am leaning towards option 2. What I would like to confirm is can I remove the serial options because they need to transmit over a single Tx or Rx wires and it wouldn't work properly with the other inputs.
Also I am assuming that serial is ordinarily the best option, is it?
Using option 2 and the Arduino Servo library certainly seems to be the easiest. However the Mega has 3 spare Serial ports if you do want to use Serial.
I'm not sure what you mean by "remove the serial options". If you just mean to ignore them, then that seems fine.
I can't think why serial would be any better than any of the other options - unless the user manual tells you different.
yes remove = ignore / not consider an option, only because it doesn't seem practical with the other input / outputs I want. Majority of the code examples I have found on this forum and other sources seem to use serial, so I assumed that was the defacto choice. I'm just trying to ensure I don't choose an option that slow the response of the motors. Clearly I want to use the fastest connection I can, but still be easy to use with the other inputs / outputs.
To me number 2 would seem the easiest way of doing that, I just wanted to know if I was giving up too much on the motor side, since I don't know much about the different rates of transmitting the instructions. Serial is easy because the baud rate is right there, but I don't rate of the other options.
I didn't really have a time in mind, but figured I would try run the loop without any delays, or 1ms if one is needed to work. I think the other sensor code running in the background will probably dictate how fast the loop can run. The plan is to use sensor feed to reduce speed where there is danger of colliding with an object.
to reduce speed where there is danger of colliding with an object.
I can't see any need for an update more often than (say) every 100 millisecs for that purpose (maybe even 200 millisecs). If you are that close to the object it will too late to avoid it