EMI in SSR control system for humidifier

I am working on a control circuit for a humidifer in a shiitake mushroom growing room. That equipment consists of an AC motor that spins a disk spraying mist over the room, rated at 300W working under 220Vac. The arduino opens or closes the circuit via a solid state relay SSR25DA, based on the humdity read by the DHT sensor.

I have designed the four following stages:

Stage 1: Humidity below 75%. SSR is on. Red led on.
Stage 2: Uptrend from 75% to 85%, SSR on. Red led on, green led flashing.
Stage 3: 85% or more reached. Only blue light on. Relay is off.
Stage 4: Downtrend from 85 to 75%. Only green led steady.
Error code: upon NaN read by sensor: flash green.

The circuit failed when using the humidifier as a load, with error code.

This circuit works fine with loads light a light bulb. I found that turning on the egg beater close to the circuit leads to the same error. This egg beater runs at 300W too. I added a snubber at the 5V terminals of the SSR. With this, i could run the egg beater to speed 4 (out of 5) with no failure. failing at 5. (when connected as load, at a distance of 5m of the arduino). This makes me think that maybe the mains cables themselves cause EMI on the arduino (distance = 0.5m from the SSR to the soldered breadboard. Not sure.

I have provided code and schematic. I am thinking of implementing a second circuit but wanted to ask for suggestions first.

#include <DHT.h> // Temp/hum
#include <Wire.h> // I2C

#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);


float hum;
float marcador;
float temp;



void setup() {
  // put your setup code here, to run once:
Serial.begin(9600); // Inicio comms Serial Monitor
Wire.begin();

dht.begin();




Serial.println("DHT iniciado");


pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
}


void flashinggreen() {

      digitalWrite(3, LOW); // 
    delay(200);
    digitalWrite(3, HIGH); // 
    delay(200);
    digitalWrite(3, LOW); // 
    delay(200);
    digitalWrite(3, HIGH); // 
    delay(200);
    digitalWrite(3, LOW); // 


}
void loop() {
  // put your main code here, to run repeatedly:


String espacio = " ";
hum = dht.readHumidity();
temp = dht.readTemperature();
String nan = "NAN";
Serial.println(hum + espacio + temp);
String Hum = String(hum);
Serial.println(Hum);


if (isnan(hum)){
  Serial.println("Error");
    digitalWrite(2, HIGH); // apago luz roja
    digitalWrite(4, HIGH); // apago azul
    flashinggreen();

    
    

    
}
else{
  if (hum  <= 75)  // Baja de humedad
  {

    digitalWrite(2, LOW); // prendo luz roja
    digitalWrite(3, HIGH); // apago luz verde
    digitalWrite(4, HIGH); // apago azul
    Serial.println("Hum bajo 75, relay on");
    delay(5000);
    marcador = 1;

  }
  else{   
    if (hum<= 85){ // transicion
      Serial.print("Verde transicion, marcador = ");
      Serial.println(marcador);
      if (marcador >= 1) {
        digitalWrite(2, LOW); // mantengo  luz roja
      
        flashinggreen();

        digitalWrite(4, HIGH); // apago azul
        Serial.println("Hum normal, relay mantiene");
        delay(1000);
      }
      else{
        digitalWrite(2,HIGH); // apago roja
        digitalWrite(3, LOW); //  luz verde fija
        digitalWrite(4, HIGH); // apago azul
        Serial.println("relay off, en bajada");
        delay(5000);
      }

    }
    else{  // humedad mayor a 85
      digitalWrite(2,HIGH);
      Serial.println("Sobrehumedad, relay off");
      digitalWrite(2, HIGH); // apago luz roja
      digitalWrite(3,HIGH); // apago luz verde
      digitalWrite(4, LOW); // prendo azul
      marcador = 0;
      delay(5000);
      

    }
  }
}


}


New circ

Original circ

You show a lot of ground symbols, but are all those leading back to a mains ground for the building wiring? Are all the motorized devices grounded to that same ground?

Thank you for your reply. All ground markings correspond to the GND pin on the arduino, itself connected to USB power.

I am thinking EMI could be affecting the sensor reading, thus leading to the NaN error code. Has anybody had this issue? (I'm thinking of adding coax to the DHT's wire line as a possible solution). I will also test adding distance between the sensor wires to the mains lines.

So nothing is grounded to the AC power ground, including the motors.

Oddly enough, the humidifier (basically a 300w ac motor ) does not have a ground in its plug. I will have to check whether it can be grounded and add that for safety.

Still, the arduino isn't grounded to the AC power ground either because it is powered by a 5V dc adapter via USB.

Yes that is possible.

This is normally a solution. It lowers the ∆V / ∆T or the rate of change of voltage with respect to time. Have you tried increasing the amount of snubbing?

Is your SSR an AC one?

One thing you could try in your code is to check that the returned data is not NaN before you try and use it to do anything.

Another thing to try is to send your wiring through a number of turns through a ferrite ring. Maybe even two or three rings spaced along the cable. I would try and avoid domestic TV type coax and use coax with a higher break down voltage like those used for ham radio transmitters. Also only connect the screen of the coax at one end, not both.

I will try to increase the snubbing.

The SSR is a DC controlled AC relay.

The first if statement in the code does what you said - if I understood correctly.

if(isnan(hum)){ ....

I will definitely experiment with coax in the communications wire line for the sensor. He became my primary suspect. Now, as a last resort I could snub this line. But, because it is PWM, I have a slight fear snubbing this line to ground could lead to faulty readings. But at least in theory it shouldn't. What would you recommend?

Thank you!

I would not have thought that snubbing PWM would do anything to harm the PWM required for a reading.

I was thinking of cap discharge in silent spaces between pulses blurring logic levels. Maybe a small cap with a big resistor handles that issue well enough.

No I don't think that is an issue.

No, a time constant is a time constant however it is derived.

2 Likes

Couldn’t have said it better with the time constant. My bad.

Will perform checks and keep posted on the solution of the issue. Thank you!

1 Like

Alright. Today I got some progress. I remade the circuit according to the second schematic. But still had the issue, now at higher speeds for the eggbeater though.

The filters worked, but not well enough. My next thought was coax. But I don't have coax. So I tried grounded aluminum foil. Finally. It worked. Video is shown below:

video

I expect your LEDs are not as bright as expected. Looking at a TTL specification for a 7400, 7404. IOH is -0.4mA or (-400uA) and IOL is 16mA.

You stated you are using SSRs for the AC, are they zero crossing? If not give them a try. Lead dress is critical but I did not see a clear picture of your system. This might help:

Possible EMI (Electromagnetic Interference) Issue

This sounds like it could be related to EMI, either conducted or radiated. While I can't confirm this is the problem without more information, I also can't rule it out. Most MOS logic circuits are fast and sensitive to edge transitions. Minimizing lead lengths (which act as antennas) to less than 10 inches (25 cm) is crucial, as longer leads can pick up frequencies up to about 750 MHz, not accounting for reflections and other effects.

Tips to Reduce EMI:

  1. Keep Connections Short: Both transmitters and receivers are affected by antenna length—longer antennas have greater gain and can pick up more interference. Use the KISS principle: Keep It Short & Simple.
  2. Avoid Parallel Lines: Ensure power and logic lines are not running parallel to each other to minimize crosstalk and interference.
  3. Use a Zero-Crossing Solid-State Relay: This can be a simple and effective solution to reduce EMI, especially when dealing with AC loads.

Historical Context: This issue has been known since the early 1960s with TCTL (Transistor-Coupled Transistor Logic), later known as TTL (Transistor-Transistor Logic). It prompted the development of line drivers and other technologies to manage EMI.

For further reading on related topics, check out these resources:

  • Triac Principles and Circuits, Part 1: Learn about triacs, which are often used in switching applications and can be susceptible to EMI.
    Read Part 1
  • Triac Principles and Circuits, Part 2: This article continues exploring triac applications and EMI considerations.
    Read Part 2
  • Arduino Forum Discussion on Flashing LEDs: An example of EMI considerations in a practical Arduino project.
1 Like

Super valuable reply - thank you very much. Regarding lead dress:


It is a zero crossing SSR, as per the datasheet

I will find a way to make the connection to the sensor shorter in the mushroom growing room. I just wanted to keep the sensor inside and the circuit inside a box in a more protected area.

1 Like

I don't think we are on the same page here as to what a snubber is. This is something that is applied to the output of the SSR not the input.

See the RC snubber in this link:-

and

It is designed to lower the rate of change in voltage with respect to time.

I think what you have here, on the input circuit is not a snubber but an input filter. The time constant for this is way too high and the circuit is not correct.

This is my attempt to show what you need.

Can other members please give this a sanity check @Paul_KD7HB @gilshultz By the way, I am not a fan of Nuts & Bolts as they seem to be rather flaky on other information they supply.

The input filter on the SSR is designed to reduce the impedance of the SSR to reduce false triggering of the input of the SSR caused by having no snubber circuit on the SSR's output

Note that the snubber components must be rated for at least the peak mains voltage. You can buy snubbers packaged together as a single component from ebay.

EDIT, Sorry my bad see post #17.

1 Like

The snubber is an RC combination, resistor and capacitor in series that is in parallel with the load, not in series with the load.

3 Likes

The snubber will definitely go in parallel and not in series with the load. And yes - I guess I mistakenly called the other filters 'snubbers'.

I have got hold for the R and C components rated for this and will see how it goes as per this simulation:

I will also replace the sensor cables with FTP cat 5.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.