Compressor with Pressure Switch

Hello, so I have a compressor wired and programmed to Relay 1, with a pressure switch wired to DIO 1, but for some reason… it doesnt seem to work. However, when I have the compressor is wired into DIO 1 (With the pressure switch unplugged completely) the compressor runs. Does anyone know why this is? The Relay does have power going in, but none out when the compressor is hooked into relay 1 with switch into dio 1. Thanks!

How are you programming the compressor? What language are you using?

Did you remember to enable the robot?

As a supplementary note, you should not be wiring a compressor to a GPIO (alt. DIO) pin; nor should you be wiring it to a relay output. You should be wiring the compressor to a Spike controlled by a relay output.

I can’t remember exactly (been a few years), but if memory serves the pressure switch is normally closed (NC), or is shorted when the pressure is lower than the threshold pressure. This implies that the DIO port controlling the compressor is set up so that when it sees a logic high, it turns the compressor on - since the DIO ports have internal pullups, disconnecting the pressure sensor would be the same thing as saying the pressure switch is in its open state. My guess is that the controller needs to be inverted, so a logic low on DIO 1 corresponds to compressor on - the sensor definitely needs to be hooked between ground and signal - check the markings on the sensor itself for more info.

As to why the compressor works when you plug it into the DIO port - the Spike relays don’t use the PWM pinout schemes like the Vics do (namely, ground, +5, signal). The ground pin is still ground, but the other two pins are supposed to be signal, and by changing them around you can get one of 4 states (2 of them are ‘off’). Plugging a Spike into a Digital IO (which would have the same pinout as a PWM pin) would hook one signal line into +5 and one signal line into the digital output, which, assuming the DIO port was driven low, corresponds to an ‘on’ state. It would then turn off if the DIO line was pulled high. It’s nifty, but as slijin points out, really shouldn’t be used in this manner.

If that doesn’t solve your problem, check your pressure sensor with a voltmeter - make sure that when it’s shorting when it should be shorting and opening when it should be opening. If you play your cards right, shorting should correspond to a DIO logic 0, and opening should correspond to a DIO logic 1. If it doesn’t work like that, you might have a bum sensor.

Sparks