Log in

View Full Version : Can't get Solenoid to fire?


team-4480
18-06-2015, 14:36
Hi! We have spent many hours trying to get our Double Solenoid to work but all attempts have ultimately failed. We get green lights on the card in the CRIO slot showing us that it does have signal. The Solenoid is yellow on both sides and is 12V which is the voltage we are giving it. There is no clicking or any evidence the solenoid is bad or can't fire. We tried many other solenoids without luck. Any help will be greatly appreciated! Code:
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;


public class RobotTemplate extends SimpleRobot {
private final Joystick DriverStick,other; //defines Axis Camera
private final DoubleSolenoid s1;
RobotDrive myDrive;//defines solenoids
private boolean orange;


public RobotTemplate() {
myDrive = new RobotDrive(3,2);
DriverStick = new Joystick(1);
Compressor airCompressor;
airCompressor = new Compressor(14,7);
airCompressor.start();
other = new Joystick(2);
s1 = new DoubleSolenoid(3,8);

}
public void operatorControl() {
while (isOperatorControl() && isEnabled()){
myDrive.tankDrive(other, DriverStick);

if(DriverStick.getRawButton(1) == true)
{

s1.set(DoubleSolenoid.Value.kReverse);
}
if(DriverStick.getRawButton(2) == true)
{

s1.set(DoubleSolenoid.Value.kForward);
}

}
}
}


}

GeeTwo
18-06-2015, 15:50
You specified that you are using the cRIO. Are you using the 2014 version of wpilib? My understanding is that there are enough changes from cRIO to roboRIO that the 2015 version does not work on the old hardware.

Mark McLeod
18-06-2015, 17:07
Programming:

Make sure the solenoid module LEDs show one side of the solenoid to be off while the opposing side of the solenoid is on and vice versa.
If the solenoid module LEDs are alternating and changing as you expect, then the code is doing all it can.
Electrical:

Verify that the solenoid breakout power LED is on.
Verify with a multi-meter that each side of the solenoid is receiving 12v when the module LEDs signal that it should be.
Verify with your meter that when one solenoid coil is energized that the opposite coil is not.
Make sure both solenoid side yellow indicators are not on at the same time. One should be on while the other is off.
The solenoid coils might be wired backwards, so use the meter to verify that the polarity is correct.

SenorZ
18-06-2015, 17:34
Brute force: always try manually pushing the blue button on the solenoid to see if the mechanism is able to work.

Mark McLeod
18-06-2015, 18:54
That's a good point.
Make sure there is sufficient pressure for the solenoid to activate (>20 or 25psi).

team-4480
18-06-2015, 19:11
The LEDs do alternate and when I press the blue button, the piston fires. I haven't checked the voltage yet on the wires so I will the next time. The only thing I see from I what you said is that the solenoid is yellow on both sides which you said wasn't supposed to happen. How can I fix this problem? Thanks for all the replies!

SenorZ
18-06-2015, 22:11
I'm not a programmer, but I think you've got an issue of no "else" statement. It would seem if button 1 is pressed, then button 2, both solenoids would be getting the "go" signal.

My extent of programming help ended when my old team using labview 4 years ago. So if you're shaking your head in disgust at my theory, I am sorry! :p

Mark McLeod
18-06-2015, 22:35
No "else" is necessary. The last "set" wins.
The code just works out that button 2 wins any tie, and in a tie the solenoid just gets set twice, but so fast that the system won't even notice.

Having both yellow signal lights on means both sides are energized and attempting to pull in opposing directions. So the solenoid shouldn't move from whatever position it is current in.

The yellow solenoid signal lights for each side should only light when they have power and consequential are active, otherwise they don't get power to even light the signal light.
If the solenoid module is showing green for one of the sides (power on), and dark for the opposite side (power off), then the corresponding signal lights should be yellow and dark.
So there seems to be some sort of short sending power to the wrongly lit side of the solenoid.

Either wires are crossed or the solenoid module is powering output pins when it shouldn't be.
Use your meter to verify that power is indeed getting to what should be the unpowered side. Test at the solenoid module pins without the solenoid connected.

GeeTwo
18-06-2015, 22:43
Edit: I see Mark beat me to this, and knows more authoritatively.

I'm not a programmer, but I think you've got an issue of no "else" statement. It would seem if button 1 is pressed, then button 2, both solenoids would be getting the "go" signal.

My extent of programming help ended when my old team using labview 4 years ago. So if you're shaking your head in disgust at my theory, I am sorry! :p

SenorZ,
I have not worked with the pneumatics methods (only mentored programming in 2015, and we didn't use pneumatics), but if it's anything like the spike methods (which we did use for LEDs), setting kForward and kReverse automatically clear the other side.