View Full Version : Spikes
3dude_2231
12-02-2007, 13:58
since I couldn't find it,
Until an hour ago I was pretty sure spikes are used like the victors,
and that they were connected to the PWMs.
well, now that I know it's not,:yikes:
how do I control the spikes (reverse,stop and forward) from the code?
TubaMorg
12-02-2007, 14:20
Helpful posting tip:
When you ask a question on ChiefDelphi, you should pretend like no one has any idea what you are talking about, then explain your problem from there.
In this case, you are asking about Spike relays. You do use PWM cables to connect them to the RC, but at the Relay bus rather than the PWM bus. As far as telling them what to do via software, what code are you using? MPLAB version? EasyC? What are you trying to control with the Spike?
Travis Hoffman
12-02-2007, 14:48
Someone more familiar with current pneumatics rules, please chime in here if I am mistaken anywhere in this post.
This is how you control relays in MPLAB. I am unfamiliar with the EasyC method, but I am sure it is "Easy".
The following assumes you attach a standard PWM cable between Relay Output 1 on the Robot Controller and the PWM port on one of your Spike relay modules. Be sure to follow the color code labels for a proper connection.
**********************************************
Assume you have a motor connected to the Spike. Red wire on the M+ terminal, Black wire on M-. The relay1_fwd variable controls voltage on the M+ terminal, while relay1_rev controls voltage on the M- terminal.
//Full Voltage Forward
relay1_fwd = 1; //+12V on M+
relay1_rev = 0 ; //0V on M-
//Full Voltage Reverse
relay1_fwd = 0; //0V on M+
relay1_rev = 1; //+12V on M-
//Motor stop
relay1_fwd = 0;
relay1_rev = 0;
//Do Not Use This State
relay1_fwd = 1;
relay1_rev = 1;
*****************************************
Now assume you have the air pump connected to the Spike. Red wire on M+, Black wire on M-. The relay1_fwd variable controls voltage on the M+ terminal, while relay1_rev controls voltage on the M- terminal.
//Always true for safe and correct pump operation
relay1_rev = 0;
//Pump On
relay1_fwd = 1; //+12V on M+
//Pump Off
relay1_fwd = 0; //0V on M+
*************************************************
The following two examples assume you are still allowed to control 2 different solenoid valve outputs with a single Spike. I assume this is still legal, even though I can't find the explicit wiring diagram in the rules like they used to provide back in the day (when 48 last used pneumatics on our robot).
Assume you have a double solenoid valve connected to the Spike. The Red wire for one of the valve's solenoids is on M+, the red wire for the other solenoid is on M-. The black ground wires for both solenoids are sent to a convenient and legal ground point in the robot's electrical system. The relay1_fwd variable controls voltage on the M+ terminal, while relay1_rev controls voltage on the M- terminal.
//State 1 - Shift cylinder controlled by double solenoid valve to one extent
relay1_fwd = 1; //+12V on M+
relay1_rev = 0 ; //0V on M-
//State 2 - Shift cylinder to opposite extent
relay1_fwd = 0; //0V on M+
relay1_rev = 1; //+12V on M-
//State 3 - Do nothing (cylinder holds current position)
relay1_fwd = 0;
relay1_rev = 0;
//State 4 - Do Not Use This State - Unpredictable behavior
relay1_fwd = 1;
relay1_rev = 1;
Typically, I think you'd want your relay to either be in State 1 or 2. Is there ever a reason to use State 3?
***********************************************
Finally, assume you have two independent single solenoid valves connected to the Spike. The Red wire for one of the valves is on M+, while the red wire for the other valve is on M-. The black ground wires for both valves are sent to a convenient and legal ground point in the robot's electrical system. The relay1_fwd variable controls voltage on the M+ terminal, while relay1_rev controls voltage on the M- terminal.
In this situation, you can treat each valve and variable independently from the other. Since there are independent devices connected to each of the Spike output terminals, there is no link between the state of the "fwd" variable and the "rev" variable.
//Shift cylinder controlled by M+ valve to one extent
relay1_fwd = 1;
//Shift cylinder controlled by M+ valve to opposite extent
relay1_fwd = 0;
//Shift cylinder controlled by M- valve to one extent
relay1_rev = 1;
//Shift cylinder controlled by M- valve to opposite extent
relay1_rev = 0;
When the robot is disabled at the end of the match, cylinders controlled by single solenoid valves will be forced to shift to their "relay1_xxx = 0" states. Make sure you plumb your cylinders so the "= 0" state is the one you want the cylinder to be in after the match is over.
You can also wire your pneumatic valves similar to the "air pump method" mentioned above. You'd have to devote 2 Spikes to controlling a double solenoid valve and 1 entire Spike to controlling a single solenoid valve (instead of getting 2 single solenoid valves on one Spike as described above), but why would you want to waste money, space, and weight on that? I would hope "because it's in the rules now" is not a forthcoming answer to that question.....
3dude_2231
12-02-2007, 16:53
thanks :)
got it.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.