Go to Post This wins this week's award for "Most Bizarre Thread". Carry on. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-16-2013, 11:25 PM
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
CIM->Victor 884->Arduino not working

I'm trying to control a CIM Motor (Foward, Reverse, Stop, Etc.) with a Victor 884 controlled by an Arduino Uno Microcontroller. So far I've tried a couple different things and well I'm fed up and figured I'd show you guys how everything is hooked up to see if someone see's what I'm doing wrong.

Before you guys respond I want to set a few things: I'm not going to use a Crio I'm not going to use the IFI control system I'm not using a FIRST control system. It doesn't matter if any of this is against FIRST rules I'm not doing this for FIRST. However despite the fact that this is not for FIRST I'm going to ask the questions here because it contains the largest amount of people that could help.


This is how everything was hooked up originally and I've also tried hooking up a mosfet powered by the 5v line of the arduino. And I've also tried putting a 5v regulator powered by the FRC battery and then using the 5v line to power a mosfet to boost the signal to the victor, but everytime the victor just flashes orange (no pwm)
__________________
2010
Team 2228(FRC) - Drive Team Lead, Drive Coach, Mechanical Team
Team 3750(FTC) - Team Lead
2009
Team 2228(FRC) - Mechanical Team, Driver at RIT, and Hartford Regionals, and Drive coach at Ruckus
*Second Place at Ruckus
Team 3750(FTC) - Team Lead, and Drive coach at Clarkson Regional
*Second Place at Clarkson Regional
2008
Team 1930(FRC) - Worked on Mechanical, Electrical, and Programming.
  #2   Spotlight this post!  
Unread 01-16-2013, 11:32 PM
Whippet's Avatar
Whippet Whippet is online now
MIT Class of 2020
AKA: Luis Trueba
FRC #4301 (New Tech Narcissists)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Cambridge, MA
Posts: 1,186
Whippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond repute
Send a message via Yahoo to Whippet
Re: CIM->Victor 884->Arduino not working

Have you tried connecting the grounds between the FRC battery and the Arduino?
__________________
2010: FRC 3043, Build Assistant
2011: FRC 3043, Head of Minibot subteam; FLL 12762, Team Captain
2012: FRC 3043, Electrical; FLL 12762, Team Captain; FTC 5670, Team Captain
2013: FRC 4301, Electrical, Team Co-Captain
2014: FRC 4301, Electrical/Programming, Team Co-Captain
2015: FRC 4301, Electrical/Programming, Team Captain
2016: FRC 4301, Chief Technical Officer; FTC 10860, 10861, and 11004: Mentor. Winner, Hub City Regional (3310 & 4063)
  #3   Spotlight this post!  
Unread 01-16-2013, 11:40 PM
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: CIM->Victor 884->Arduino not working

I've never tried this personally, but if I had to hazard a guess it would be that delay takes an unsigned long as an argument, but you're passing a floating-point time. You probably want to use delayMicroseconds(). Also, the WPILib comments say that the Victor prefers 10ms periods.

You might also want to check out the Servo library. It's designed for servos that go to specific angles, but it should work for this case as well. I think you'd want to use writeMicroseconds() for the high pulse, and then just delay for the remainder of the period.
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #4   Spotlight this post!  
Unread 01-16-2013, 11:51 PM
ajlapp ajlapp is offline
Registered User
AKA: Anthony Lapp
None #0118 (Team RUSH and Robonauts)
 
Join Date: Sep 2001
Rookie Year: 1996
Location: Ortonville, MI
Posts: 646
ajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond reputeajlapp has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working

You want to use the Arduino Servo class to generate a PWM signal.

Connect the cable to a PWM pin rather than a DIO and use the functions in the Servo class to drive the Victor.
__________________
Anthony Lapp
FIRST Engineering Mentor
Owner/Operator 221 Robotic Systems
221 Robotics Systems - Quality Hardware, Made in the USA
RobotOpen
anthony@221robotics.com
Twitter us: @221RobotSystems
Team 1 --> 94 --> 68 --> 221 --> 857 --> 27 --> 118
Design Engineer/Fabricator and 17 year vet
Team Rush (FRC27) and Robonauts (FRC118)
  #5   Spotlight this post!  
Unread 01-17-2013, 12:01 AM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working

The ground pin on a Victor is at the other end of the PWM input connector from the signal pin. The center pin is not used, but it's typically labeled as the power input. Your picture shows the ground and power connections reversed.
  #6   Spotlight this post!  
Unread 01-17-2013, 12:17 AM
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: CIM->Victor 884->Arduino not working

The pin on the arduino and frc battery are grounded together i forgot to put that in. Also the pwm wires on the victor are correct in real life I forgot to put them in the right order in the drawing. Also the servo library gives the same results
__________________
2010
Team 2228(FRC) - Drive Team Lead, Drive Coach, Mechanical Team
Team 3750(FTC) - Team Lead
2009
Team 2228(FRC) - Mechanical Team, Driver at RIT, and Hartford Regionals, and Drive coach at Ruckus
*Second Place at Ruckus
Team 3750(FTC) - Team Lead, and Drive coach at Clarkson Regional
*Second Place at Clarkson Regional
2008
Team 1930(FRC) - Worked on Mechanical, Electrical, and Programming.
  #7   Spotlight this post!  
Unread 01-17-2013, 03:45 AM
TAHIRisHERE's Avatar
TAHIRisHERE TAHIRisHERE is offline
Registered User
FRC #0334
 
Join Date: Jan 2013
Location: New York City
Posts: 1
TAHIRisHERE is an unknown quantity at this point
Re: CIM->Victor 884->Arduino not working

you will have to use the aruidno servo library to have the arduino generate PWM signals. As seen here, http://playground.arduino.cc/ComponentLib/servo

you would have to attach the black wire(from victor) to any ground pin.
Then the white to an arduino pin with PWM(i think its has a curvy line next to pin number label.)
Then the red wire you have no use for.

so a simple sample:


#include <SoftwareServo.h>

Servo myservo(any name can be put here this example uses myservo); // create servo object to control a servo
// a maximum of eight servo objects can be created

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{ myservo.write(0) (writing the servo at value of 0 will spin motor full speed coutnerclockwise. and a value of 180 will spin motor to full speed in clockwise direction. and a value of 90 is no spin or stop) }


I will assume you know how to wire the battery to the victor.

the sample code is not perfect there are mistakes. but i hope it helps.
  #8   Spotlight this post!  
Unread 01-17-2013, 04:38 AM
DampRobot's Avatar
DampRobot DampRobot is offline
Physics Major
AKA: Roger Romani
FRC #0100 (The Wildhats) and FRC#971 (Spartan Robotics)
Team Role: College Student
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Stanford University
Posts: 1,277
DampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond reputeDampRobot has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working

I've done a similar project before, but with Jags instead. I used the PWM generating function onthe Arduino, and I beleive I mapped the desired power value onto a 900 microsecond to 2100 microsecond range (full reverse to full forward).

With the Arduino, I've always found that the premade libraries work far beter than a function you tried to put together yourself. Just a word of advice.
__________________
The mind is not a vessel to be filled, but a fire to be lighted.

-Plutarch
  #9   Spotlight this post!  
Unread 01-17-2013, 08:40 AM
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: CIM->Victor 884->Arduino not working

You can use the analogWrite() function for PWM so you don't need the Servo library. (that is not a typo, analog, not digital even though you are on a digital pin)
We are currently using this on our test disc shooter.
I did find that the PWM output is not a perfect match for our Victor (an old one, not an 888). Even after calibrating I found that a value above 253 caused a problem.
We are using a potentiometer as input and map the ADC range of 0-1024 to 183 to 253 (one direction, deadband) works pretty well for our particular Victor. You should probably profile yours to find a good range.
I have not put a scope on the PWM out, but I supect it (the output pulse width) is not perfect for the Victor.

HTH
  #10   Spotlight this post!  
Unread 01-17-2013, 01:19 PM
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 505
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working

This is working code, I have two pots, one is set only goes one direction, the other pot goes full rev -> 0 -> full forward. This was hacked together a couple of years ago, and put in an Altoids can, we are using it to prototype again this year.

Code:
#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
Servo myservo1;  // create servo object to control a servo 
 
int potpin = 0;  // pot in is 13 pwm analog pin used to connect the potentiometer
int potpin1 = 1;  // analog pin used to connect the potentiometerint val;    // variable to read the value from the analog pin 
int val =0;
int val1=0;
void setup() 
{ 
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
 myservo1.attach(10);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) //
  val1 = analogRead(potpin1);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  val1 = map(val1, 0, 1023, 90, 179);     // scale it to use it with the servo (value between 0 and 180) 
   myservo.write(val);                  // pwm 13 sets the servo position according to the scaled value 
   myservo1.write(val1);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 
}
__________________
The sooner we get behind schedule, the more time we have to catch up.

  #11   Spotlight this post!  
Unread 01-17-2013, 01:30 PM
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: CIM->Victor 884->Arduino not working

Quote:
Originally Posted by tr6scott View Post
This is working code, I have two pots, one is set only goes one direction, the other pot goes full rev -> 0 -> full forward. This was hacked together a couple of years ago, and put in an Altoids can, we are using it to prototype again this year.

Code:
#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
Servo myservo1;  // create servo object to control a servo 
 
int potpin = 0;  // pot in is 13 pwm analog pin used to connect the potentiometer
int potpin1 = 1;  // analog pin used to connect the potentiometerint val;    // variable to read the value from the analog pin 
int val =0;
int val1=0;
void setup() 
{ 
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
 myservo1.attach(10);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) //
  val1 = analogRead(potpin1);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  val1 = map(val1, 0, 1023, 90, 179);     // scale it to use it with the servo (value between 0 and 180) 
   myservo.write(val);                  // pwm 13 sets the servo position according to the scaled value 
   myservo1.write(val1);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 
}
Could you show me how you set up this up electrically? In the victor manual it says to use a pwm signal driver if you are not using an ifi controller and I can't really find one on the internet. So I assumed I could boost up the amount of current by using a mosfet. I got that working and then I measured the current over time with an oscilliscope and it's pretty noisy. The voltage is a perfect square wave, but the current starts of at 0A and curves up to around 500mA and does a 10-20mA bounce as it goes up.
__________________
2010
Team 2228(FRC) - Drive Team Lead, Drive Coach, Mechanical Team
Team 3750(FTC) - Team Lead
2009
Team 2228(FRC) - Mechanical Team, Driver at RIT, and Hartford Regionals, and Drive coach at Ruckus
*Second Place at Ruckus
Team 3750(FTC) - Team Lead, and Drive coach at Clarkson Regional
*Second Place at Clarkson Regional
2008
Team 1930(FRC) - Worked on Mechanical, Electrical, and Programming.
  #12   Spotlight this post!  
Unread 01-17-2013, 01:32 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,003
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working

Quote:
Originally Posted by jamie_1930 View Post
..500mA
You are pushing 500 ma into the Victor's opto-isolator ??


  #13   Spotlight this post!  
Unread 01-17-2013, 02:37 PM
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: CIM->Victor 884->Arduino not working

Quote:
Originally Posted by Ether View Post
You are pushing 500 ma into the Victor's opto-isolator ??


That's what I got on the o scope. I put a 10 ohm resistor in line with the signal wire and took the voltage above and below the resistor then hooked the other channel on the o scope to a constant 0.1v and used the math function to multiply the channels
V=IR
I=V/R
I=Voltage drop across resistor/10 ohms
I=Vresistor*.1
__________________
2010
Team 2228(FRC) - Drive Team Lead, Drive Coach, Mechanical Team
Team 3750(FTC) - Team Lead
2009
Team 2228(FRC) - Mechanical Team, Driver at RIT, and Hartford Regionals, and Drive coach at Ruckus
*Second Place at Ruckus
Team 3750(FTC) - Team Lead, and Drive coach at Clarkson Regional
*Second Place at Clarkson Regional
2008
Team 1930(FRC) - Worked on Mechanical, Electrical, and Programming.
  #14   Spotlight this post!  
Unread 01-17-2013, 03:29 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,003
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: CIM->Victor 884->Arduino not working


500 ma seems way too high. You might even have damaged the opto-isolator's emitter.

I've never been able to find a Victor schematic, but the datasheet for the Jag's opto-isolator says it has an absolute maximum continuous current rating of 60 ma for the input.

The cable I am using for my test equipment here delivers about 5.6 ma to the Victor during the pulse, and it works fine.

Can you post a picture of your scope's current waveform?

  #15   Spotlight this post!  
Unread 01-17-2013, 03:44 PM
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: CIM->Victor 884->Arduino not working

Quote:
Originally Posted by Ether View Post

500 ma seems way too high. You might even have damaged the opto-isolator's emitter.

I've never been able to find a Victor schematic, but the datasheet for the Jag's opto-isolator says it has an absolute maximum continuous current rating of 60 ma for the input.

The cable I am using for my test equipment here delivers about 5.6 ma to the Victor during the pulse, and it works fine.

Can you post a picture of your scope's current waveform?

I won't be able to get back into the school till later tonight or tomorrow, but I'll get that to you as soon as i can. Next time i'll try putting a larger resistor in line to lower the current down to 50mA and see if that changes anything. I just hope i haven't damaged the victor.
__________________
2010
Team 2228(FRC) - Drive Team Lead, Drive Coach, Mechanical Team
Team 3750(FTC) - Team Lead
2009
Team 2228(FRC) - Mechanical Team, Driver at RIT, and Hartford Regionals, and Drive coach at Ruckus
*Second Place at Ruckus
Team 3750(FTC) - Team Lead, and Drive coach at Clarkson Regional
*Second Place at Clarkson Regional
2008
Team 1930(FRC) - Worked on Mechanical, Electrical, and Programming.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:24 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi