View Full Version : Arduino Micro with Talon SR
Rman1923
06-06-2015, 21:16
Hey all, (This is not for our robot but for a personal project)
So I am trying to connect a Talon SR to an Arduino Micro (With the Leonardo Processor) to power a Mini-Cim. I think I have all the electrical down but I'm not sure how to connect the PWM from the talon to the Arduino. My guess is that I cut the pos and neg wires on the PWM and just connect the white wire (since I already have 12 volts going through the talon). If this isn't how to do it, where should I connect the pos and neg terminal to on the Arduino (or in my circuit)?
Thanks!
Jacob Bendicksen
06-06-2015, 21:36
You do want to connect the positive and negative to the Arduino - negative to a ground pin, positive to (I believe) a 5V pin.
Rman1923
06-06-2015, 21:54
You do want to connect the positive and negative to the Arduino - negative to a ground pin, positive to (I believe) a 5V pin.
Cool, Thanks!
And I'm guessing the White Wire goes to a PWM pin right?
I found this image (http://cdn.instructables.com/FUX/ZT6F/H1YONFTT/FUXZT6FH1YONFTT.MEDIUM.jpg) like ten minutes ago
teslalab2
06-06-2015, 22:12
you don't need the red wire, its not connected to anything inside the talon :)
Connect PWM output od Arduino to PWM input of Talon, and connect the twos' grounds.
Not sure about the power wires.
timytamy
07-06-2015, 00:45
There are a myriad of other threads (http://www.chiefdelphi.com/forums/www.chiefdelphi.com/forums/search.php?searchid=6538197) out there that go into detail about connecting motor controllers to Arduinos.
But to get you started, read up on servo PWM, it's not the same thing as the pseudo analogue PWM you get from the PWM pins (with analogueWrite()). You'll probably need the Arduino Servo library (http://www.arduino.cc/en/Reference/Servo) to create the appropriate signals for the Talon.
teslalab2
07-06-2015, 01:53
When you are writing the pwm signal make sure neutral = 47, 74 = full forward, 20 = full reverse. These are the correct values the controllers expect, otherwise you will have to re-calibrate the controllers for them to work properly.
Rman1923
07-06-2015, 22:55
Thanks All, I figured it out, you have to connect the red to the VCC (5V or 3.3V depending on the board) black to ground and then the white one to a PWM pin. I used the Servo library and read the vals from a potentiameter and fed them to the talon during calibration. Now if i could get the underglow working...
AdamHeard
08-06-2015, 00:39
I'd skip the servo function and instead use servo.writeMicroseconds.
Cleaner control numerically.
1000 is rev, 1500 neutral, 2000 forward.
I'd skip the servo function and instead use servo.writeMicroseconds.
Cleaner control numerically.
1000 is rev, 1500 neutral, 2000 forward.These are nitpicks ... (everyone's a critic :rolleyes:)
Servo.writeMicroseconds() is a function in the Servo library, and not a substitute for that library.
And, I think the Talon has a max/min pulse range larger than 1500+/-500.
Read the Talon's fine manuals (easily found using a Google search) to see wiring and pulse range information.
FYI: I'm using an Edison Arduino in a project, and having pretty good luck so far. I have worked around the one WiFi bug that was giving me trouble, and I don't have any other show-stoppers on the horizon (yet). At about $100, it gives you built-in WiFi, and a lot of computing bang for your buck, in situations where Arduino-style I/O is useful. Consider using one in your next project....
Blake
I'd skip the servo function and instead use servo.writeMicroseconds.
I don't agree here at all. If you have a working, well tested abstraction that does exactly what you want it to do but can be easily adjusted if the parameters are just a bit off, and you have enough resources to implement it, why would you work around it?
AdamHeard
08-06-2015, 12:49
I don't agree here at all. If you have a working, well tested abstraction that does exactly what you want it to do but can be easily adjusted if the parameters are just a bit off, and you have enough resources to implement it, why would you work around it?
You're missing what I'm saying. servo.write() takes 0 to 180 degrees as an input and controls a "Servo". servo.writeMicroseconds() explicitly takes the pulse you would like to generate, which for a talon is 1000-2000 w/ 1500 at center. This leaves you a nice +/- 500 integer swing for clean math.
Andrew Schreiber
08-06-2015, 13:07
You're missing what I'm saying. servo.write() takes 0 to 180 degrees as an input and controls a "Servo". servo.writeMicroseconds() explicitly takes the pulse you would like to generate, which for a talon is 1000-2000 w/ 1500 at center. This leaves you a nice +/- 500 integer swing for clean math.
Arduino also has a really handy little map (http://www.arduino.cc/en/Reference/Map) function even in the case of ugly math.
Rman1923
08-06-2015, 14:27
Does anyone know how to calibrate the SR so it doesn't go reverse, I'm making an electric skateboard and don't plan to parallel park.
Here are the calibration instructions from per 7 of this document. (http://crosstheroadelectronics.com/Talon_User_Manual_1_1.pdf)
6) Calibration
The calibration procedure takes the minimum, maximum and center
values of the PWM input signal and scales the output based on these
values. Calibrating the Talon will allow full range of control with PWM
signals that are not within the default range. Calibrating will also
correct any non-center issues with input devices such as gamepads
or joysticks.
To calibrate the Talon:
1. Press and hold the button labeled “CAL” with a paper clip. The
LED should begin to blink red/green.
2. Continue to keep the button pressed while moving the joystick
full forward and full reverse. You may do this as many times as
you like.
3. Center the joystick and then release the CAL button.
4. If calibration was successful, the LED will blink green several
times. If the LED blinks red several times, the calibration was
not valid. If this happens, the Talon will use the last valid
calibration values.
All calibration values are retained after power cycle or reset.
Does anyone know how to calibrate the SR so it doesn't go reverse
Here are the calibration instructions...
So, using the instructions you posted, how would you propose to "calibrate the SR so it doesn't go reverse" ?
Alan Anderson
08-06-2015, 16:19
Does anyone know how to calibrate the SR so it doesn't go reverse, I'm making an electric skateboard and don't plan to parallel park.
You can't "calibrate" it to only go one direction. If you try giving it only forward commands while calibrating it, the procedure will fail and the calibration will not be changed. The Talon SR doesn't have limit switch inputs, so the simple option of permanently activating the "reverse" limit is not available either.
The obvious answer is just to only send it "forward" commands, using pulse widths between 1.5 and 2.0 milliseconds. Never give it anything less than 1.5 milliseconds, and it will never go in reverse.
billbo911
08-06-2015, 16:26
I'd skip the servo function and instead use servo.writeMicroseconds.
Cleaner control numerically.
1000 is rev, 1500 neutral, 2000 forward.
You're missing what I'm saying. servo.write() takes 0 to 180 degrees as an input and controls a "Servo". servo.writeMicroseconds() explicitly takes the pulse you would like to generate, which for a talon is 1000-2000 w/ 1500 at center. This leaves you a nice +/- 500 integer swing for clean math.
This is my experience as well. I do it this way because I get higher resolution of the command signal. It allows more precise control of the motor or servo.
Now, if you only need +/- 90 steps instead of +/- 500, then using servo.writeMicroseconds has no advantage.
Andrew Schreiber
08-06-2015, 16:59
This is my experience as well. I do it this way because I get higher resolution of the command signal. It allows more precise control of the motor or servo.
Now, if you only need +/- 90 steps instead of +/- 500, then using servo.writeMicroseconds has no advantage.
Does the Talon actually respond with that granularity? I recall seeing a post years back about the old Vic 884s that basically said they only had 90-odd actual values and the rest were just duplicates.
AdamHeard
08-06-2015, 17:38
Does the Talon actually respond with that granularity? I recall seeing a post years back about the old Vic 884s that basically said they only had 90-odd actual values and the rest were just duplicates.
I'm looking now and not finding where I read this (so it may be false), but I believe the talons interpret the pwm input as a 10 bit number, so roughly 1:1 mapping over that 1000-2000 range.
josesantos
08-06-2015, 18:22
I'm looking now and not finding where I read this (so it may be false), but I believe the talons interpret the pwm input as a 10 bit number, so roughly 1:1 mapping over that 1000-2000 range.
Yeah, user manual (http://crosstheroadelectronics.com/Talon_User_Manual_1_1.pdf) says 10-bit (1024 steps)
You can also specify the servo min and max pulse widths in the attach call:
Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds
Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.
I would still calibrate the Talon (or other motor controller) to ensure it goes full speed. Write an arduino sketch that starts at neutral and waits for a character to arrive from the serial port. Then have it switch to servo to full speed forward, wait for another character and then go full reverse. After waiting for another character, go to neutral. Use Serial.Print to tell the user whats going on and prompt for a character. If you use the serial port monitor in the arduino IDE, you will have to click the "Send" button after each key.
One other thing: I put a 330 ohm resistor in series with the white wire driving the PWM input on the Talon so it doesn't try to drive too much current through its input opto-isolator.
AdamHeard
09-06-2015, 17:34
You can also specify the servo min and max pulse widths in the attach call:
Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds
Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.
Why do this versus explicitly writing the 1000 to 2000 range?
Why do this versus explicitly writing the 1000 to 2000 range?
If you were using something other than a Talon, you would only have to change the initial attach call; the rest of the code wouldn't need to be modified. For example, a jaguar would be attached with:
driveServo.attach(3, 670, 2330); // Jaguar
Of course, for a motor controller, you'd ideally like the input limits to be a float ranging from -1 to +1.
Rman1923
09-06-2015, 18:00
You can also specify the servo min and max pulse widths in the attach call:
Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds
Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.
I would still calibrate the Talon (or other motor controller) to ensure it goes full speed. Write an arduino sketch that starts at neutral and waits for a character to arrive from the serial port. Then have it switch to servo to full speed forward, wait for another character and then go full reverse. After waiting for another character, go to neutral. Use Serial.Print to tell the user whats going on and prompt for a character. If you use the serial port monitor in the arduino IDE, you will have to click the "Send" button after each key.
One other thing: I put a 330 ohm resistor in series with the white wire driving the PWM input on the Talon so it doesn't try to drive too much current through its input opto-isolator.
This is pretty cool, I'm going to try this. Do you think if I mod the servo call to attach(1500,2000) it will only go forward? Also, I can just do the digitalwrite() function to control this right?
Thanks!
AdamHeard
09-06-2015, 19:23
If you were using something other than a Talon, you would only have to change the initial attach call; the rest of the code wouldn't need to be modified. For example, a jaguar would be attached with:
driveServo.attach(3, 670, 2330); // Jaguar
Of course, for a motor controller, you'd ideally like the input limits to be a float ranging from -1 to +1.
Depending on how fast all this is running (and what else is going on) using floats may be out of the question due to the slower math.
Depending on how fast all this is running (and what else is going on) using floats may be out of the question due to the slower math.
I did say ideally!
I'm fully aware of the need to program for integers in some cases. I even wrote a fully integer semi-swerve drive inverse kinematics a few years ago. My semi-swerve platform was about 1/3 FRC scale, with a 0-180 degree maximum steering angle steered by servos, and 25mm 1000rpm gear motors for drive, and yes, it was controlled with an Arduino. Unfortunately, the only hard drive that the code was on has since died. The key was that I wrote a hypoti(x,y) subroutine that calculated an integer hypotenuse using max(x, y) and the ratio 256 * min(x,y) / max(x,y) (where x and y were preprocessed to be non-negative), and an atan2id(y,x) that returned atan2(y,x) in degrees based on the same ratio, whether abs(x) or abs(y) was larger, and the two input signs. IIRC, the atan2id() routine had two separate cubic fits to cover the span from 0 to 45 degrees, that broke based on whether 2*min(x,y)/max(x,y) was 0 or 1 (that is, at about 28.8 degrees).
teslalab2
13-06-2015, 01:37
Thanks All, I figured it out, you have to connect the red to the VCC (5V or 3.3V depending on the board) black to ground and then the white one to a PWM pin. I used the Servo library and read the vals from a potentiameter and fed them to the talon during calibration. Now if i could get the underglow working...
you don't believe me when I say power is not connected to anything? :p just trying to save trouble, it really only needs signal and ground. red serves no purpose and is no internally hooked up to anything inside that talon :cool:
Rman1923
13-06-2015, 23:30
you don't believe me when I say power is not connected to anything? :p just trying to save trouble, it really only needs signal and ground. red serves no purpose and is no internally hooked up to anything inside that talon :cool:
Actually, I had it set up without red, but then the talon didn't work. The PWM powers as well as controls the talon. The talon is not (and can't be) powered by the input voltage. It confused me at first as well lol.
Alan Anderson
14-06-2015, 17:16
Actually, I had it set up without red, but then the talon didn't work. The PWM powers as well as controls the talon. The talon is not (and can't be) powered by the input voltage. It confused me at first as well lol.
Unless your Talon differs from every one I have ever seen, you are mistaken. The center pin on the Talon's PWM connector is not connected to anything inside it. The Talons (and Victors, and Jaguars) are indeed powered by the same input voltage that is routed (and regulated) to the motor outputs.
teslalab2
14-06-2015, 23:52
This is a snip from the schematic of a jaguar motor controller, notice pin two :)
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.