Interfacing particle electron with a industrial relay switch

Hi guys, I have a problem with regards to interfacing a microcontroller to a din rail mount Weidmuller TRZ24VDC01 solid state relay. I am trying to trigger the relay with a digital out pin with d0 pin with a step up buck converter to 24VDC to trigger the relay. However, there wasn’t enough current to trigger the relay as the relay requires a 100mA trigger current which is 4 times of what the pin can provide. Any suggestions on how the relay can be triggered to provide power to the microcontroller as well as the power required to control the relay?
Attached below is the current configuration of the circuit diagram.

You should power the stepup from Vin or 3v3 and use a transistor to switch the 24V.

1 Like

Hi @ScruffR, does the 3v3 also have the same limitation of having a 25mA output as the other digital io pins?

Yes, current from a GPIO pin is limited to about 20mA or so.

The schematic you posted will not power the relay and will most likely destroy your Electron… don’t use that schematic! Although, I may not understand the setup fully since its not an Electron in the schematic.

I think what @ScruffR was trying to explain is that you cannot power the Electron from 24V DC directly. You need to find some other method of powering the Electron. If you want to use the existing 24V DC source, which is reasonable, you should find a DC-to-DC converter that would step down to the Electron input range of 3.3V-12V on the Vin pin. Or the DC-to-DC converter can step down to 3.3V and provide power to the Electron directly on the 3.3V pin.

The Electron cannot power the relay coil directly. You would then use a transistor or MOSFET (just referred to as transistor from here on) in between the GPIO and the relay coil. The transistor powers the relay coil while the Electron GPIO merely provides a control signal to the transistor.

Here’s some further reading on using a transistor as a switch:

This tutorial on using a MOSFET and Arduino uses the same concepts applied in the Particle world:

Actually no :wink: I was rather trying to suggest that you should be able to power the 3.3V to 24V step-up converter from the 3v3 pin since that pin can drive up to 800mA @ 3.3V
However, if you have a 12VDC supply it would be better to step-up that to power the SSR (or use a 12V SSR) and also use the same 12V supply to power the Electron.

Since @NST1992 is also indicating he’s using a sold-state “relay” I’m not sure we are actually looking at a relay with coil - but I didn’t search for a datasheet for that particular SSR.
So a fly-back diode might not be needed without the coil.

Here is a schematic for a 12V controller power coil relay. Notice the diode across the relay - this is to control what I remember to be the back surge or the power stored in the relay coil when turned off/de energised.

A mosfet is used to switch on the low side (to ground).

You will need to look into specifically how a SSR should be controlled, instead of the diode, a resistor is required. If you do a search for SSR control circuits you should be able to find what you need.

Edit - this is a SSR (Q7) the signal in is from a GPIO expander but could be a Photon/Electron pin. You need to drive the pin low to turn on the SSR. Selection of R45 is down to the specifics of the SSR, switching current and the driving voltage.


Yea, that would work too. :wink:

The solid state relay uses optoisolator instead of a coil. So a flyback diode is not needed to prevent back emf when the relay coil turns off. I’m connecting the NC pin on the ssr and the microcontroller is supposed to switch off the circuit after getting a true response from my server.I shall try using the 3v3 pinout to a transistor solution as provided by @ScruffR. Hope the 3v3 pin can power 2 float switches as well as triggering the relay at the same time as I have already connected the 3v3 pin to power these sensors in a parallel circuit.

Hi guys!! Thanks for the help!! I have solved this issue with a 5V relay and a transistor as set up below!!!

Thanks again for the help guys!!

1 Like