Main Site Documentation

What is the right way to connect a relay to an IO port on EMX?



I tried to connect a relay that switches at 3 volt to an IO port on an EMX board. However when I measure the voltage after connecting the relay it is only 0.9 volts or so. That’s not enough to switch the relay. Is it possible to connect a relay directly to an IO port or do I need to put some electrical component inbetween?



How much mA does an IO port provide?


Maximum current:

For the switching I would suggest to connect the IO to a transistor.
This is connected to 5v or whatever you like to switch the relay.


You’ll also want to put a reverse polarized diode across the relay coil to keep the back EMF from destroying the transistor. Some mosfet transistors have these built in though.


Do NOT ever connect a relay directly to a micro, any micro not just FEZ. Not only relays need too much power, they generate huge spikes that can kill your micro.

A quick google search give this this as the first hit…you only have to ask google :slight_smile:


Better still… Always use a darlington pair transistor… These also have diode protection and only consume a real tiny current base to emitter. You can drive loads up to10A with a base resistor of 1k…

TIP120’s have a gain of over 1000…

Cheers Ian