Cortex Digital Out to Drive Relay

Dear Forum,
I am working with a Vex Cortex and desire to drive relays from the digital ports that will turn on and off and reverse an old dewalt drill, less motor controller trigger. (I see that the Vex spike H bridge is no longer available.)

Part I: Options 1-3: 1) could a digital output drive a standard 5v coil relay directly? If so, what is the wiring connections, signal-white and gnd-black to the 5v coil? Application: the 5 v relay would cascade to another relay for higher 18V and 15Amps of the drill. 2) should I use a relay board like the Pololu 2 channel SPDT Relay Carrier ( with a digital logic >3v “on” from the cortex? If so, what is the wiring connections, signal-white =EN1and gnd-black =Gnd; then have a different power for the Pololu relay card input for VDD and same Gnd? 3) Should I make my own ckt board from scratch with transistors, similar to the Pololu product. Anyone have a schematic?

Part II: Cortex Code in RobotC.

  1. example: set the dgtl2, name = “Relay1”, Sensor Type = “Digital Out”
  2. In the body of code, control dgtl2 “On” by setting “SensorVlaue[relay1==1];” (Set “Off” by writing value to “0”)
    Thank you in advance forum community.

I’d suggest you find an appropriate Solid-State Relay based on the output amperage required.

I would recommend using this relay to control your board as it can handle 20A*. It requires 185mA of current and the cortex can supply 1A on it’s 5v rail.

Sparkfun Datasheet:

Relay Datasheet:

Cortex max 5v current: in pinout section

*Please be sure to read the sparkfun page about the risks of using high current on the relay.
I would be rather concerned about the inductive load of the drill on the relay. Consider info here and other sources about switching inductive loads. The sparkfun board has flyback protection on the LV side, but nothing on the HV side.
Be careful with line voltage

The digital IO cannot supply that amount of current (only the 5v rail).
You should probably use something like the solenoid driver as an intermediate circuit between cortex and high current relay.

Could you elaborate on what is a “solenoid Driver”?
Also, are you saying the Dig IO only has a 5v rail (on the IO not Motor outputs) but no amps?

Cortex digital ports (not motor) have a 1k series resistor to limit current, even without that the STM32 processor could only source/sink about 20mA on a digital IO pin. There’s some detailed info about cortex IO in this thread.

The solenoid driver is usually used with pneumatics, you can find them on this page.

@MAycock1 I know Cortex could easily drive relays similar to this, which comes with most Arduino kits and has an amplifying transistor on board:


However, they are limited to 10A current and, as previous posters noted, you will need to worry about reverse current protection for inductive load.

I would suggest something similar to VNH2SP30 H-Bridge that has 30A nominal and 50A reverse current protection. VNH2SP30 based boards and Arduino shields could be found really cheap on eBay:

The product description states “Digital, Analog Outputs: Center pin (or middle pin) + 5 Volts, 1 Amp Max combined total from all pins” From this I understand it to be saying that the 5v pins on the connect to the 5v rail which can supply 1A.
Vcc in the sparkfun schematic would be this, and the actual control signal to the BJT is a max of 5mA (1k resistor)

Okay so I went through all the diagrams and it looks like it would work fine. I think @jpearman didn’t realize that this device took in 3 wires.

Easiest diagram to look at is
VCC requirment 4-6V, 150 mA
CTRL requirment above 2.6V, 5 mA

That isn’t to say pulling continuous 150 mA from the 5V line is a particularly good idea but at least it should be possible.

Yes, you are correct, I hadn’t looked at the data sheet, not much time for the forum at the moment, too busy. I though OP was going to drive relay directly from the cortex digital IO without intermediate transistor or something. Pulling 150mA from the 5V is fine, we pull about 100mA for each pneumatics solenoid.