Random Relay Activation

Im new, so please excuse my ignorances. My first board is a project to control my roller door. I have a Wemos D1 R2 with ESP8266 connected to a logic level convertor to lift signal from 3.3v to 5V which is then connected to a SQC-3FF-S-Z 5V Relay Module. Ive used a standard Blynk LED light flash sketch based on Signal from D5.

This works fine, however the roller door randomly opens and closes. I read a few blogs and upgraded all my wiring to copper 7.5A (over kill I know) but I thought it might be less likely to get noise. The board is mounted immediately behind roller door motor.

Looking for some advice to stop the random relay triggers.

Code Im using

Download latest Blynk library here:
Release v1.2.0 · blynkkk/blynk-library · GitHub

Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.

Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator:           http://examples.blynk.cc
Blynk community:            http://community.blynk.cc
Follow us:                  http://www.fb.com/blynkapp

Blynk library is licensed under MIT license
This example code is in public domain.

This example runs directly on ESP8266 chip.

Note: This requires ESP8266 support package:
GitHub - esp8266/Arduino: ESP8266 core for Arduino

Please be sure to select the right ESP8266 module
in the Tools -> Board menu!

Change WiFi ssid, pass, and Blynk auth token to run :slight_smile:
Feel free to apply it to any other example. It's simple!

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID "YourTemplateID"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "2CYP6LX6ieQabp7nf................";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "iiNetXXXXXX";
char pass[] = "4P77K.........";

void setup()
// Debug console

Blynk.begin(auth, ssid, pass);

void loop()

Thanks in advance


It's not clear if you are writing D5 HIGH or LOW to trigger the relay.

If D5 LOW triggers the relay, try adding a pullup resistor to D5. If D5 HIGH triggers the relay, try adding a pulldown resistor to D5.

Thanks cattledog is that achieved by adding a 10k resistor from D5 to either ground or 3.3v depending on high or low?

Yes, 10K is a good value. You can try down to 2.2K. if you don't see an improvement. You can also try and place a capacitor from the relay input to ground.

You may also get better results by using a 5 volt relay module which can be triggered at 3.3 volts. The ones which incorporate an opto coupler are the easiest choice here.
That means you can eliminate the level shifter.

Update, so I note on Blynk that D5 can be set to start at 0 to 1 and visa versa.

So I have pulled with a 10k resister as follows
0 to 1 pulled to ground
1 to 0 pulled to 3.3V

Still opening randomly, I shall pop down to shop to grabs a 2.2k resister and try that.

Can you please post a picture of your project?
So we can see your component layout.

Make sure your gnd connections are good and not loose.

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

Apologies for the photos Tom, I’ve taken this in and out so many times ;(

I’ve just been using wire ends and alligator clips to pull up or down

The "logic level convertor" is clearly not an appropriate way to control the relay board.

Unfortunately, the descriptor "SQC-3FF-S-Z" applies to the relay itself, not the relay module and we need to know the identity of the module to know what the problem may be.

Can you please edit your post, select all code and click the </> button. Next save you post.

So we don't have to look at e.g. ssid[] but ssid[]. It also makes the code easier to copy.

Thankyou for all the advice, cattledog your advice was spot on mate a 2.2K resistor did the trick its working perfectly.

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