Driving a high current SSR Relay with an ESP32 GPIO Pins

Hi,

I am planning to drive a high current AC LOAD using an SSR using my
ESP32.
However, connecting the ESP32 GPIO pins directly is not a good idea as there could be some
fluctuations that could ripple back to my microcontroller as per the comments that I am seeing
on the internet.
My question is, what should be the proper way of doing this thing?

I am not that good at Electronics and I mainly DIY my projects through
YouTube and any other internet source.

BTW, I posted this question on another platform but did not receive any response so I am trying my
luck here.

Any advice, please? Thanks

I answered your question on Reddit.

I suggest you look at an optocoupler (something like a 6N138) and an isolated or separate power supply to drive the SSR.

As @timinelmira mentioned, the switches are opto-isolated, so there's no feedback issue. Those suggesting otherwise are likely dealing with EMI problems. When switching AC, it's important to use Zero Crossing switches, as they help minimize EMI. Be sure you drive them with enough voltage.

Thanks for the feedback. Highly appreciated. Can you please clear up some of my doubts?

As @timinelmira mentioned, the switches are opto-isolated, so there's no feedback issue.

Sorry, do you mean there is no issue if I connect the ESP32 GPIO pins to the DC input pin of the SSR to control and follow the same wiring from my image?

When switching AC, it's important to use Zero Crossing switches, as they help minimize EMI.
I bought the following SSR from Aliexpress

Be sure you drive them with enough voltage.
I am using the GPIO output of an ESP32 that has 3.3V. Is this the voltage that you are talking about?

I suggest you look at an optocoupler (something like a 6N138) and an isolated or separate power supply to drive the SSR.

Yes, thank you for your inputs. I am looking at this.
Just to be clear, so the GPIO output from my ESP32 go to the optocoupler into the input pins of the SSR?

In a diagram, it goes like this?
ESP32 -> Optocoupler -> SSR Input

when using contactors make sure you use one with a rating suitable for the load, e.g. a contactor may be rated at 20amps AC for a resistive load and 5 amps for a Squirrel-cage induction motor, see electrical-standards-for-contactors-ac1-ac2-ac3-ac4-dc1-dc2-dc3

what is the rating of your motor?

There is an optical isolation inside the SSR. There is no need to add anything else.

Then you should not be working on any project that involves mains electricity.

Sorry but this is nonsense.

Your problem might very well be where you bought your SSR from.

But if you do have a problem it is likely this is caused by the fact that the motor is an inductive load and SSRs have problems switching inductive loads. You need some phase angel correction on that motor.

2 Likes

Hi, @markestradajr
SSR concered.


What is the motor specs?
What SSR spec did you purchase?

I would be putting a MOSFET N-CH between the ESP32 and the SSR to provide reliable drive current to the SSR.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

It is worth noting that @markestradajr has not actually got any problems at the moment. He is just confused about all the rubbish he has read from uninformed sources.

My post #7 referred to problems he might have in switching a large motor with an SSR.

If it is a phase angle problem then the motor will run all the time and not turn off. The whole thing will not go bang. Any perceived instability in any other circuit will be caused by the EMI from the motor.

I don't believe that boosting the voltage to the input side of the SSR will do anything much to improve matters, until the OP tries the circuit and it does not turn.

However I would be concerned that the motor looks like it will draw more current that the SSR could supply, in which case there would be damage.

From the data given on the purchase page:-

Output current: 10 25 40 60A

This means there are three versions of the SSR, you need to ensure that the particular version you have bought is more than sufficient to drive your motor. Hence Tom's very important question about the size of the motor, and my question as to EXACTLY what version of SSR you have purchased.

1 Like

I don't recommend FOTEK.
I would use a mechanical relay.
If you insist on SSR then buy a reliable brand from Dig-Key or Mouser and make sure it is designed for inductive loads.

There are no SSRs, that I know of, that are designed for inductive loads. Can you post a link to one please?

You also need to tell us how long the motor will run at one time, and how many times per minute or hour the SSR will be switching on and off. What type of heat sink will you use?

There are a lot of fake FOTEK SSRs. Here is one article on how to identify the common fake ones. Spoiler alert - the one in post 8 is a fake.

I have driven other brand SSRs directly from an ESP32 i/O pin. The input is basically an LED with a series resistor to limit the current at the highest input voltage. At 3.3V the current draw is low enough for the ESP32.

Yes, the SSR requires a minimum of 3V. I'm not sure if it’s zero-crossing, but based on the description, it doesn't appear to be. Here’s a link to one that is zero-crossing: AliExpress link.

Switching only at zero crossings will minimize or eliminate line and radiated noise resulting from initiating or terminating the AC output waveform in mid-cycle. However, designers need to be aware that zero-crossing SSRs may not be able to turn off with highly inductive loads. To account for this, celduc relais offers random-switching SSRs that turn on/off at the instant called for by the input transition. Again, the designer must understand the load and choose the appropriate SSR from celduc’s catalog.

Random Solid State Relays: For INSTANTANEOUS CONTROL (OR RANDOM RELAY), power switching takes place as soon as the control voltage has been applied (turn on time less than 100μs). This type of control is used for all inductive loads where the phase shift between voltage and current can cause problems with zero-crossing relays.

2 Likes

Thank you all for your response and I am learning a lot of valuable things just by reading your comments.

Now, going back to my problem.
I would be controlling several AC loads using my ESP32 and I worry about my ESP32 GPIO to be able to support the triggering of my SSR.
Based on my reading and research on this forum and the other information available on the internet.
I can use a simple 2N2222 BJT transistor for each GPIO pins to drive the SSR.
I tested this and I am seeing my SSR light up when a GPIO pins is triggered.

I have some doubts though:

  1. Is this safe and no issues altogether?
  2. What AC load should I be worried with this setup?
  3. Do I still need to add a flyback diode to the SSR to protect my transistor?

Note: I have seen a lot of tutorials that uses MOSFET in driving the GPIO pins but I seem to like how a simple BJT transistor can do the job.

I do not know much about handling AC Loads and about MOSFETS or transistors actually but after more readings for several days and some experimentation, I was able to learn about them and how to use them in a circuit.

Looking forward to more constructive comments from experts.

Hi, @markestradajr

Can you please tell us which ESP32 you are using?
How many pins does the ESP32 have and/or its model name.

What pins of the ESP32 are you using?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Hello,
I am using a NodeMCU ESP32 with 38 pins and I am using some of the free GPIO pins on the right side of the MCU.
The diagram might not be accurate as far as the pins are connected as I am just using it to show my setup.

Hi,
Is there reason for 3 SSRs.
Really you only need 2.

I'm not sure if two SSRs in series would work all that well.

Tom.. :smiley: :+1: :coffee: :australia: