Important question about Digital Output ports

I have a somewhat interesting situation regarding the digital output of the vex controller. I’m trying to open/close a mosfet using the 5 volt output from the vex controller but I’ve run into a bit of a snag.
First of all, I’m using a converted PWM cable to go from the controller to the circuit. The problem is that as soon as I turn on the controller, I’m getting a continuous voltage.

Should there be a voltage as soon as the controller turns?

I have written a program which should turn the outputs on and off but I am still getting a non-stop voltage no matter what. Does anyone have any idea as to what I might be doing wrong? Should I use a different cable setup?

Also, which of the three pins carry the voltage? Just from checking with a multimeter it seems that both the red and white wires carry a current, is that how its supposed to be?

It is normal to get continuous voltage across the Red/Black wires. The +5V source (Red) is constant and is not switched on/off with the port. The signal wire (White) is what gets switched on/off, but that can’t source very much current (a few mA).

Given the low signal current, you might find it hard to get the MOSFET to fully turn on. If that happens, it’ll present a higher resistance, which will cause it to get hotter under load than it otherwise would.

What MOSFET are you using, and what load are you trying to drive?


  • Dean

I am trying to control an H-Bridge using the vex controller. I’m using the IRF530NPBF-ND MOSFET Datasheet here:

In the end I just need a way to turn a MOSFET on/off using the vex controller.

I’m trying to drive a 24 volt load.

Will you be driving the H bridge as a PWM (variable speed) drive, or just a basic “Forward - off - reverse” drive?

I ask, because a PWM drive requires fast switching. A MOSFET being driven from a low-current source (like the VEX) will not switch quickly, and may not switch on fully. If you just want basic control (no PWM), then that will be less of an issue.

I don’t have a ton of experience driving MOSFETs (I tend to just make do with BJTs), so I can’t give you an exact schematic to try.

I’d recommend breadboarding the most basic circuit (Gate to White, Source to Black & -24V, Load goes between +24V and Drain) and see how that works. Try measuring the voltage drop across the Source and Drain pins while it is driving your load. That’ll give you an idea how completely the MOSFET is turned on, and will let you know how much power it is going to dissipate.

If you find that it isn’t switching fast or fully enough for your needs, then you can add a MOSFET gate driver (you can just use a transistor, or they make driver chips for this).

Hope that helps,

  • Dean

I will be using a basic forward -off -reverse drive.

I have already soldered together a circuit that does basically does that (I can post pictures if you want). The problem is that I’m getting a continuous current out of the controller and I can’t figure out how to stop and start it. My program doesn’t seem to be doing anything. And yes I really need to be sure that it is opening/closing fully or else I will ruin some very expensive motors.

Where should I start looking for a MOSFET gate driver which will work with the vex setup?

I assume you are specifically worried about the current between white and black, since that is what would drive the MOSFET’s gate.

Are you reading this voltage without your external circuit attached, or only with it attached?

How much voltage are you reading? When you write a 0 to the port, it should hover around a fraction of a volt, which is well below the MOSFET’s 2V minimum threshold voltage.

Perhaps something like this. Haven’t ever used one of these myself, but it looks like it might do the trick. You’ll need a pair of these to drive a full H-bridge.


  • Dean

Well after a little tweaking I managed to get the circuit working and the voltage is opening and closing the MOSFET. Now the other thing I need to know is whether there is a way to ensure that the MOSFET completely shuts down, or that the signal is off before the other signal is sent. Is there some sort of fail-safe device or code I can put in my program?

Cool - congrats!

If you want to do this in hardware (the most fail-safe), you can use some logic gates to ensure that you don’t activate both the FWD and REV MOSFETs are the same time. Here is an example schematic using a single 7402 (or 74LS02) chip:


You can do the same type of thing in software, but given the amount of power that would go through your H-bridge if you hit a bug, I’d recommend that hardware approach.


  • Dean
    H-Bridge Lockout.jpg

Logic gates…haha my worst enemy. Thanks for the info! I will try and make sense of this. Do I have to connect any pins together?

I chated with digikey last night online, and I got this circuit figured out… I will order the parts on monday… We will just need the data sheet to the chip and it will work out!

One thing I noticed after looking at this logic for a little while is that if both forward and reverse outputs are turned off will both the MOSFETs turn on resulting in a dead short?!?!?!

Or because there is no power from either signal then there is no power getting through the chip and going to the MOSFET?

Just want to check on this

wow that was what I call stinkin thinking if both of them are off at the first set of gate that outputs a 1 which locks out both of the second set of gates… the only possible way this can turn on is if one is on and the other is off…

Here is the diagram showing the chip pinout. Most of the connections are pretty simple (since the gates in the chip are arranged just like the gates in the schematic). Pins 2 and 12 are the “crossover” pins that lockout a MOSFET if the opposite input is on.



  • Dean
    H-Bridge Lockout 2.jpg

Thanks… that is what we needed was the pin assignment. Funny how chatting with Digikey for a half hour I learned more than an entire quarter of College electronics class:mad: Guess that is what you get with a very bad prof.

Thanks for the help Dean


In the defense of Educators (most of my Family are/were Primary and Secondary Education Teachers, I had a Great Aunt and Uncle that were College Teachers), what you learn is a class, might be very general, and if you ask them for a Specific Solution, you might get a very Specific Answer.

oh I am by no means going against educators… I am a teacher! The prof I had was a very smart man very smart, but he was not a teacher… he was not able to get the info out of his head… we were to make it through like 12 chapters in the class and we made it through 4! Please dont take that as a bash on teachers!

Not a problem…

I have had to “Bat Cleanup” after a few Professors like that too…

Sometimes relating Conceptual Information in a different way, can do wonders for the student. :wink: