Relay toggles on every startup

• Raspberry pi Zero W with two relays
• Blynk Cloud Server

I am working on a garage door opener project. I have two garage doors. My problem is that the relays trigger every time i startup the blynk server, which i do not want. Pins on raspberry pi are GP17 and GP4. Is it possible to fix this issue, preferably on the linux software?

I assume that you have app widgets connected to these pins?


@PeteKnight Yes. I have two push buttons.

I’d suggest that you change these buttons to use virtual pins instead, and adjust your code accordingly.


@PeteKnight I think you misunderstood me. These are virtual pins in the app, and act as “push” instead of “switch”. :slightly_smiling_face:

I think you misunderstood me :grinning:

If you were using a NodeMCU then I’d know what to suggest, but I’ve never felt the need to use a Pi as a Blynk client.

If you let us know what programming language and Library version you’re using with the Pi then maybe someone familiar with that language and hardware will chip-in with a suggestion.


@PeteKnight I am using Blynk v.0.6.1 on linux, and Linux 4.14.98+ armv6l as the operating system on my raspberry pi.

But what Blynk library programming language? Python, NodeJS or something else?
And what version of that library?


@PeteKnight I am not very familiar with programming, but i downloaded the library from GitHub - blynkkk/blynk-library: Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.. Library version is 0.6.1. Based on /home/pi/blynk-library/tests i would guess the programming language is python.

That’s the C++ library, but you can’t run it on a Pi without installing WiringPi, which is deprecated, so I’m confused!



@PeteKnight So it is not possible to change the startup toggle? This is a security risk because my relays are connected to my garage door.

I’m sure it’s possible, but I’m currently mystified about how you’re managing to run C++ on a Pi Zero W.

Until we get to the bottom of that mystery it’s going to be difficult to get anyone to point you in the right direction.


@PeteKnight Ok. I am going to post the same thread again somewhere else, to see if they can solve my problem. :slightly_smiling_face:

I don’t think you’ll get much help until you can elaborate on how you’re managing to run a C++ library on the Pi.


@PeteKnight i followed this tutorial: Raspberry PI Zero Garage Door Opener Using Blynk : 4 Steps (with Pictures) - Instructables
Maybe you can find the missing piece there?
Edit: now I see I didn’t use the GitHub link above. I installed nodejs as he did in the instructables link :slight_smile:. Sorry for confusing you.

That’s a pretty crappy tutorial!
He talks about installing WirinPi, which is needed if you want to run C++ on your Pi, but has been deprecated for the past year and a half

It also points to a Blynk guide which no longer exists, but seems to have explained about NodeJS installation.

All very odd!

Personally, I’d build this around a much cheaper NodeMCU and run C++ on it.
If you stick with the Pi then look for some NodeJS help on setting output states on start-up.


@PeteKnight Ok. I will completely uninstall blynk library, and install this on my RPI: GitHub - blynkkk/blynk-server: Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes

It uses Java instead, so it should be easier to run on RPI.

That is the Blynk server software, which does the same thing as the software running on the Blynk Cloud servers - so isn’t what you need to solve your particular problem.

You need a device running as a client to control your garage doors in response to messages received from the app, which are routed via the server.


@PeteKnight I am not very experienced, can you please post any links to how I can use my RPI as a client to control the relays?

As I said before…

I use Raspberry Pi’s as servers, NodeMCUs and ESP32s as clients.