Relais switching on at boot up MCU

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Relais switching on at boot up MCU

#1 Post by Sasch600xt » 07 Oct 2018, 11:29

Hello All,

i have a ralais board with 8 relais as "active low"
From my Lolin Nodemcu V3 i go from GPIOs to an ULN2803 Transistor Array because of 3.3V to 5V converting.
So far all works great.
So if i set GPIO to "High", the ULN2803 sets the input on the raleisboard to "LOW" an the Relais switches ON.

My problem now is, a few relais switching to "LOW" (ON) at bootup of the MCU for a part of a second.
This is happan to all my nodes with relais connected to.

This is not very good for my outdoor fridge for example or a water pump.

i used hardwaresettings for gpio ports like "GPIO Boot = Active LOW.
But it did not change anything.

Is there someting like:

Code: Select all

digitalWrite(gpioX, LOW); // prevents relay from activating after power-on
pinMode(gpioX, OUTPUT);
So important here is to give the gpio FIRST the "LOW" and then set it to Output.

Thank you for your answeres
Sascha
"the flat earth society has members all around the globe"

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Relais switching on at boot up MCU

#2 Post by enesbcs » 07 Oct 2018, 15:45

Sasch600xt wrote: 07 Oct 2018, 11:29 Hello All,

i have a ralais board with 8 relais as "active low"
From my Lolin Nodemcu V3 i go from GPIOs to an ULN2803 Transistor Array because of 3.3V to 5V converting.
So far all works great.
So if i set GPIO to "High", the ULN2803 sets the input on the raleisboard to "LOW" an the Relais switches ON.

My problem now is, a few relais switching to "LOW" (ON) at bootup of the MCU for a part of a second.
This is happan to all my nodes with relais connected to.
There are a few GPIO's, that has alternative functions with all ESP8266 based devices, and has a default state on boot up such as: GPIO0, GPIO2 and GPIO15
It does not matter what do you do in your own sketches, this functions exists in a lower hardware level...
If you need to use them as output, please read how to do it:
https://www.instructables.com/id/ESP826 ... as-inputs/

I also succesfully redefined "RX" pin (GPIO-3) for output. (+1gpio)

OR you can buy an I2C port extender, OR you can use an ESP32 chip, that has a lot more real GPIO's.

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#3 Post by Sasch600xt » 07 Oct 2018, 17:33

thank you very much for showing me not one, a few solutions to my problem.

i have an I2C port extender here and will try to get it to work.

brilliant ideas, thank you again!

Greetz
Sascha
"the flat earth society has members all around the globe"

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#4 Post by Sasch600xt » 07 Oct 2018, 17:59

Sorry, i have one more question:

i found this page:
https://www.letscontrolit.com/wiki/index.php/PCA9685

but for me as a beginner the informations are not exact enough.

how would a http command looks like to set for example PCA9685 pin 3 to "HIGH" ? (for switching relays i do not need PWM, a simple "HIGH or 1" or "LOW or 0" will do the job.
So what do i have to put in the browser and hit enter ?

Thank you very much !

Greetz
Sascha
"the flat earth society has members all around the globe"

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Relais switching on at boot up MCU

#5 Post by Shardan » 07 Oct 2018, 18:36

Sasch600xt wrote: 07 Oct 2018, 17:59 Sorry, i have one more question:

i found this page:
https://www.letscontrolit.com/wiki/index.php/PCA9685

but for me as a beginner the informations are not exact enough.

how would a http command looks like to set for example PCA9685 pin 3 to "HIGH" ? (for switching relays i do not need PWM, a simple "HIGH or 1" or "LOW or 0" will do the job.
So what do i have to put in the browser and hit enter ?

Thank you very much !

Greetz
Sascha
Sorry, but the PCA9685 is a PWM circuit (Pulse Width Modulation). It is usually for LED dimming or servo driving, I won't use that for relays at all even if that might be possible with some tech tricks.
For relays use PDF8574 or MCP23017.
The commands for these are quite simple. See
https://letscontrolit.com/wiki/index.php/MCP23017 for the MCP23017 and
https://letscontrolit.com/wiki/index.php/PCF8574 for the PCF8574.

Both circuits are connected via I2C-Bus. Further Info about I2C, addressing a port etc at https://letscontrolit.com/wiki/index.ph ... he_I²C_Bus
Regards
Shardan

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#6 Post by Sasch600xt » 07 Oct 2018, 19:41

ok, thank you for the informations.


Greetz
Sascha
"the flat earth society has members all around the globe"

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#7 Post by Sasch600xt » 07 Oct 2018, 20:07

me again....sorry for 1000 questions :(

at the moment i use "monitor gpio" in rules to get feedback back to MQTT server about the state of my relays or at least the state of the gpio pins.

but with a portextender i guess i can not do it like this ?

or can i monitor the gpios of a portextender ?

goal would be to send a http command to the portextender and get a MQTT message of the status back.
(at the moment thats it like it works with the internal gpios rght now)

Greetz
Sascha
"the flat earth society has members all around the globe"

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Relais switching on at boot up MCU

#8 Post by grovkillen » 07 Oct 2018, 21:07

Not a stupid question. Not yet merged but soon: https://github.com/letscontrolit/ESPEasy/pull/1848
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#9 Post by Sasch600xt » 07 Oct 2018, 22:57

"soon" is enough for me......i also need time to build the devices :)

Thank you !

Greetz
Sascha
"the flat earth society has members all around the globe"

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#10 Post by Sasch600xt » 21 Oct 2018, 18:47

Hello all,

may i ask for a documentation for this ?

or can you help me to get it to work ?
Probably i am the problem :)

I hooked up an MCP23017 to my node via SDA/SCL
I did config a device for "MCP23017 Input" at address port 32 (0x20, i made a scan first to get the address)

So now i have a switch which shows up always "0"
my goal would be to have all 16 Inputs via MQTT Message in my MQTT Broker.
Is this possible ?
Or do i have to get the state manually by active asking the ESPEasy with a command ?

Thank you so much for your help
Sascha
20181020.bin /4096 Normal
"the flat earth society has members all around the globe"

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Relais switching on at boot up MCU

#11 Post by grovkillen » 21 Oct 2018, 22:12

You should use rules to publish the states of the GPIOs .
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#12 Post by Sasch600xt » 21 Oct 2018, 22:23

ok, thank you

do you have a little example to do so ?

Thank you :)
Sascha
"the flat earth society has members all around the globe"

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Relais switching on at boot up MCU

#13 Post by grovkillen » 21 Oct 2018, 22:29

Sasch600xt wrote: 21 Oct 2018, 22:23 ok, thank you

do you have a little example to do so ?

Thank you :)
Sascha
For publishing a state of the plugin for the hardware PCF8574 (as an example):

Code: Select all

On MQTT#Connected Do
 Publish,%sysname%/GPIO62/state,[plugin#pcfgpio#pinstate#62]
EndOn
More examples and events is found in the wiki pages.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
Sasch600xt
Normal user
Posts: 164
Joined: 10 Sep 2018, 16:37

Re: Relais switching on at boot up MCU

#14 Post by Sasch600xt » 21 Oct 2018, 22:41

thank you very much :)
"the flat earth society has members all around the globe"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 31 guests