ESP8266 and Relays - Unsolved Mystery

  Переглядів 38,410

David Watts

David Watts

5 років тому

Collin emailed me with a mystery,. He found some video tutorials that showed people using a relay module with ESP8266 boards but those videos demonstrated a problem with the pins used to connect the the module control pins. The relay appeared to flicker on and off when the ESP turned on, these relay use a LOW 'signal' to operate the relay. Essentially the pin must sink the current through the opto-coupler. Now I must admit, I haven't solved the reason for the examples behaving that way but he asked me to come up with a solution to mitigate the problem, hopefully I have done that.
Videos demonstrating the effect:
• Arduino NodeMCU ESP826...
And
• controlling 8 channel ...
It turns out that 'Likes' and 'Shares' actually help the channel so, if you want to, please click the thumbs up or share the video.
I don't have a Patreon or a donate thingy, I get by fine. That said, if you are mega rich and fancy donating something I would find useful then feel free to check out my Amazon wishlist (No pressure) - www.amazon.co.uk/registry/wish...
I put lots of my favourite products and stuff that helps me make video up on this Amazon page - www.amazon.com/shop/davidwatts It is one of those affiliate things.
If you want to get in contact Twitter is probably the best way @mrdavidjwatts
www.davidjwatts.com

КОМЕНТАРІ: 99
@bluedeath996
@bluedeath996 5 років тому
They go high to initiate loading from an sdcard and set bootloader modes. I would assume that if the one you have doesn't do this either the pins that do this aren't broken out, they have pullup or pulldown resistors on the board or it has a bootloader flashed to it that doesn't use this pin definition and doesn't drive them at all. If the latter is the case you might be able to find a bootloader that will solve the problem.
@PhattyMo
@PhattyMo 5 років тому
The ESP8266 also holds certain pins high or low while in 'programming' mode. Something else to be aware of.
@ManuelCastillo-kq3xy
@ManuelCastillo-kq3xy 5 років тому
Hi, I need connect 8 relay to a esp8268. I try to use PCF8574 breakout board. Result: 8 leds on/off on secuencial, but relay nothing. Do you know how do this? please?
@gustavofar1507
@gustavofar1507 5 років тому
Do you try to put an pullup resistor? Like 4k7 or 10k
@jaromanda
@jaromanda 5 років тому
TL;DR - in general do not use CMD/CLK/SDO/SD1/SD2/SD3 as GPIO's - not for input nor output For outputs, avoid 0,1(TX),2,3(RX),[6,7,8,9,10,11] (these are the aforementioned CMD/CLK etc) 15 and 16 unless you know what you are doing! SD1/SD2/SD3 - the three pins I saw you trying to use, are are GPIO's 8,9 and 10 respectively, which in most ESP8266's are connected to the onboard flash and should not be used (8 should never be used, ever). Now 9 and 10 should not be used as outputs but can be used as inputs in some cases (but never as either if you've flashed using QIO or QOUT as they would be used by the onboard flash) I have also read that one of 9/10 is OK as an output only and the other is OK as an input only, don't recall which is which - but I avoid them altogether even on ESP boards that break them out like the nodemcu The only "safe" outputs on the ESP8266 are GPIO's 4,5,12,13,14 and 15 (though this last one needs to be pulled low on boot for proper boot behaviour, so that's going to cause an issue with your relay board) An added "issue" with the witty board is that GPIO's 12,13,15 are connected to LED's and GPIO 4 is connected to the button and a pullup resistor - and none of these pins are "floating", so you won't necessarily see the same behaviour on it as you would on a bare ESP8266 or even a Wemos D1 or nodemcu or most other dev boards - so, really, the only pins that you can compare on a witty board with bare boards is pins 5 and 14
@dtec30
@dtec30 5 років тому
if you make all of the pins lo in the initialisation of the chip may help other wise there are pins to avoid when hooking up to relay outputs with the active low enable conversely you can have a small off time for the relay board after power up just things to consider
@brice9613
@brice9613 5 років тому
I have this problem on all boards that I have used in an actual project. I was thinking of using AND gates. Have A connected to a pin on the board that is used to switch a relay, and have all of the B pins on one pin of the MCU. You activate the B pin in software when the chip has booted allowing the signal to pass through the AND gate to the relay.
@Berghiker
@Berghiker 3 роки тому
Can I use the same battery for both outputs on the relay for 2 different circuits? I did this but the relay keeps clicking. It can't stay on.
@sjoervanderploeg4340
@sjoervanderploeg4340 5 років тому
I think that at boot up the outputs are in an open state, then the registers are cleared and the relay switches on and off. I use an inverter, NAND and FF to create a CS line to switch "on" the relay inputs myself after boot up.
@jmpattillo
@jmpattillo 5 років тому
Could you remove the relay power jumper and then use a mosfet to switch on power to the relays after boot up?
@DavidWatts
@DavidWatts 5 років тому
Well that is a much simpler idea than mine, I like it!
@guyin916
@guyin916 3 роки тому
is it possible to run the signal wire 6-8 feet long?
@catch_my_electronic_experi8219
@catch_my_electronic_experi8219 5 років тому
Exactly what I did as I required 8 pins... hooked up a shift register with 8 relay board to drive solar lights. In 18months use I only rebooted the esp twice, it works a charm!
@sementhrower420
@sementhrower420 5 років тому
Twice?!? That's awesome to hear! Congratz! It's great to hear that the ESP can be used for some long term solid builds as well. I had already lost faith in them, but now am reconsidering thanks to you :)
@catch_my_electronic_experi8219
@catch_my_electronic_experi8219 5 років тому
Rusty, my best advice will be to ensure they have a stable power supply. Initially I was super frustrated whilst using PC USB only to drive these little wifi wonders, but I soon learnt that by adding a beefy capacitor, they are able to run very stable - even when facing variable temps in the attic... Try it, I am sure it will restore your faith with these chips :D
@sementhrower420
@sementhrower420 5 років тому
Nois, thanks for the tip! Is beefy in the range of 500-1000uF? Yeah, I must admit I have been using a not-so-stable power supply. Will give it a shot. Thank you! :)
@catch_my_electronic_experi8219
@catch_my_electronic_experi8219 5 років тому
I use 2200uF and have no issues. I vaguely recall Andreas Spiess had a youtube video on this topic many moons ago where he found that wifi traffic caused the spikes, and he measured with an osiliscope that a 1000uF was just enough to smooth the power requirements. I had 2200uF caps and if it is worth doing, it is worth overdoing :D Because I run mqtt, traffic is constantly running and I wanted it to run reliably - proof is in the pudding.
@G6EJD
@G6EJD 5 років тому
My understanding is only GPIO-0 is used as an output during the boot process, when it provides a clock like signal. Careful choice of the GPIO pins should remove the problem and pins will be in a tri-state high impedance state until their usage is changed.
@leglessinoz
@leglessinoz 5 років тому
You can really only reliably use 6 GPIO pins on a ESP8266 based NodeMCU board for output - 4,5,12,13,14,15. On boot various boards will have unreliable output levels, as some go high, some low.
@cheetahkid
@cheetahkid 5 років тому
I was kinda a no no to that, with 2 LEDs is on it might just past but not always on, I would simply add a resistor and transistor and inverted the output, that will work properly or something that has logic level converters from 3.3 to 5v. Hope this work.
@reinaweis
@reinaweis 5 років тому
I have had a similar issue when attempting to power LED strips, where the ESP8266 would reboot because the power load was so high on the initial boot that it would crash with a brownout and drop some pins to low. I solved this by adding a 3300uF capacitor between VCC and Ground, however this wasn't my idea, I got it from a video called "#159 Big ESP32 Boards Review and Test" by Andreas Spiess . I am not sure if this is related, as i've yet to try and operate relays.
@ianhaylock7409
@ianhaylock7409 5 років тому
Had the same problem using a similar relay board with a raspberry pi. The problem was with the device tree overlay file setting the gpio pins to the wrong voltage level during boot. There must be a similar way to set the state of the gpio pins on the ESP8266 firmware.
@Channelnvs
@Channelnvs 3 роки тому
Nodemcu is not triggering bc548 How to fix ?
@kjetiltrondsen8242
@kjetiltrondsen8242 5 років тому
I did run into this problem when I made a controller for my garage port. On reboot it triggered opening of my garage. The solution was to use a transistor between the esp and the relay. The transistor inverts the signal so it does not open my garage on boot. On another project involving a DC motor and 2 relays to change direction. The relays switches between positive and negative on each side of the motor. When one relay is activated motor goes one way, when the other relay is activated the motor turns the other way. If none is activated the motor get negative on both side and is of. When esp boots and both relays is activated for a moment the motor gets positive on both sides, which is canceling out and the motor does not turn. The two situations was mainly because I did use a esp-01 module and had to use the few outputs it has. After learning more, I would now have chosen another module with more io and used a pin without the issue.
@phillychannel394
@phillychannel394 Рік тому
In my experience, ESP8266, NodeMCU doesn't like any components connected to it which were initially connected to GND. Tried 2N2222 and other NPN transistor to drive relays with no success. I ended up using PNP BC557 with its emitter connected to 5V and the Collector to the other pin of relay's coil and the other pin to the Gnd. I use 10k ohms to trigger the base. Successful.
@ChunkySteveo
@ChunkySteveo 5 років тому
I have a technical correction for your video...... (hehe) The milk chocolate buttons are Jazzies, the white chocolate are Snowies.... haha Very interesting video though David, those relay boards are everywhere now!
@williammiller4143
@williammiller4143 5 років тому
I have experienced this problem frequently. There is an excellent video on this issue on "The Hookup" UKposts page where he examines which pins will and will not exhibit this behavior.
@djDblessed
@djDblessed 5 років тому
This behavior is only present on certain pins of the esp8266. Another youtuber called “The Hook Up” did a great video explaining what pins are best to use for different purposes. This is the link to that video: ukposts.info/have/v-deo/b5hjlntprYSgwo0.html. You should definitly check it out. 😉
@azayles
@azayles 5 років тому
Whenever there's a segment by "Future Dave", he needs to burst into the room wearing some kind of futuristic time travelly suit :P
@angelo.piletti
@angelo.piletti 3 роки тому
Thanks man! Brazilian subscriber
@UnexpectedMaker
@UnexpectedMaker 5 років тому
Those versatile 595's - amazing IC's - Cook-yer-dinner they can!
@blackz06
@blackz06 3 роки тому
I'm not seeing the problem you allude to, and maybe it's different on arduino, but I digitalwrite all the pins high in the setup to prevent all the relays from trying to engage on reboot. Solved that issue for me.
@stylesoftware
@stylesoftware 5 років тому
All true, great vid, however the point of the opto-coupler module vrs the non, for ESP and arduino users, is it can be switched at 3v logic levels. The other modules require extra circuitry, so the opto route (isolated or not) is the prefered choice. Excellent point on the isolation.
@prabbit237
@prabbit237 5 років тому
Exactly. The LED in the isolator and the indicator LED will almost certainly drop at least 3v. Infrared could be in the isolator so it could be as low as 1.5v. Visible LEDs are normally >=1.7v. So the two has a drop of 3.2v or better. If the power into the LEDs is 5v, then the MCU has to pull it down to at least 1.8v before the relay triggers. an MCU at 2.25v or greater probably has a Vio-high of 1.8 or greater and thus a high level turns the relay off since it can't get the voltage dropped low enough for the isolator to power on. The Vio-low on the MCU is usually around
@tablatronix
@tablatronix 5 років тому
Which pins though? thats the question. There are know issues with using some ios on boot, some output tx some output clock
@1962ralf
@1962ralf 5 років тому
The SDx pins are for the Flash, while boot the flash is adressed and so the relay responds
@MatsK007
@MatsK007 5 років тому
Phototransistor is the name for the photo sensitive transistor, and it has been commented on that the ESP8266 during the boot cycle can the GPIO pin's be in an unknown state.
@DavidWatts
@DavidWatts 5 років тому
Thanks for the insight :-)
@MatsK007
@MatsK007 5 років тому
By the way, it is also sending some garbage on the serial port before it is properly booted.
@electronash
@electronash 5 років тому
David Watts Almost all bipolar transistors are light-sensitive, btw. You can actually shave the casing off of a transistor, and make a crude phototransistor. ;) As long as you use specific pins on the ESP to hook up to the serial pins to the shift register, it should be fine on power-up / reset. But, as Mats said, some ESP pins can do weird things during reset, and obviously certain pins get driven High or Low during programming, or even when the USB UART chip connects to the PC. Definitely not ideal to power the relays from the ESP board. Even if the +5V rail has enough juice to power the relays... Although that board does seem to have a protection diode on each relay (to circulate the back-EMF spikes from the coils), they're not always ideal, and the voltage spikes can get back into the +5V supply rail on the MCU board, and sometimes upset them. It's probably fine in projects like this, to be fair, it's just something to watch out for if your MCU starts acting up when the relays switch. (the back-EMF spikes mainly occur when the coil is switched off, and the magnetic field collapses.)
@electronash
@electronash 5 років тому
David Watts btw, if you just saw a sub from me, I was already subbed, but UKposts still has an issue where I can't click the bell icon unless I unsub and re-sub, for some reason? It's quite bad, as lots of channels probably aren't sending out all notifications. It does give an error message when the bell is clicked, but many people might not know about the workaround.
@marcrives279
@marcrives279 5 років тому
For the record, this is not garbage ;) github.com/esp8266/Arduino/issues/3047
@DigicoolThings
@DigicoolThings 5 років тому
If you want to just use a GPIO to drive the relay, you could use a tri-state buffer with a high-level OE (output enable). The high level OE pin could then be connected to an existing power-on reset signal, or, use a resister/capacitor for a power-on OE delay (if reset signal not long enough). Something like a pretty cheap 74HC126 quad buffer (with active high OE) would likely do the trick (for all 4 relays!). :)
@DigicoolThings
@DigicoolThings 5 років тому
Undefined Lastname - Good point! Experimentation needed, to see if the GPIO pins only toggle during power-on, or if they also toggle during a hardware or software watchdog reset. Alternatively, a quick search suggests GPIO’s 4 & 5 are stable (high impedance) during boot-up. So another option (if you can't just use these for up to 2 relays), would be to connect the tri-state buffer’s OE to one of these stable GPIO pins, with your code then controlling when the relay outputs are actually enabled. For this approach you’d need an OE pull-down resistor, or, use one of the more common active-low OE tri-state buffers with a pull-up resistor. :)
@DigicoolThings
@DigicoolThings 5 років тому
Undefined Lastname - What you are describing for debounce is essentially a digital circuit low-pass filter. This could also work, but only if: (a) The unwanted power-on / reset pulses are acceptably short. (b) The latency (delay) this introduces into the relay switching is acceptable for the application. (c) The added minimum cycle time (relay on or off time period) this introduces is also acceptable for the application. If you were to use the tri-state buffer approach, then there’s no real added relay switching latency or extended minimum cycle time, during normal operation.
@DigicoolThings
@DigicoolThings 5 років тому
Undefined Lastname - LOL. Yes, the simplest approach would just be to use a better behaving MCU. :) The appeal of the ESP devices is clearly low cost performance for applications requiring wireless connectivity. But as you’re pointing out, we should be selecting an appropriate MCU choice to suit the application. I’d agree an ESP8266 is very likely not the right choice if implementing a non-wireless relay controlling application.
@DigicoolThings
@DigicoolThings 5 років тому
Undefined Lastname - Totally agree with you on your analysis, especially in relation to newbies and Arduino with ESP. I was attracted to the ESP32 initially as being best fit for a BLE project I was working on (I think it still is). But prior to my wireless needs, I was most recently using PIC, coded in MPLab’s XC C compilers. Also agree, having used microcontrollers going way back to Motorola MC68HC11’s, you would generally expect that digital GPIO pins were initialised as inputs. I don’t have much experience with ESP8266, other than some Wemos Mini’s I picked up for playing around with. :) The ESP does have merits for the true hardware hackers who delight in hardware hacking and discovery (like Neil Kolban) I do also have that discovery urge, but when you just want to design an end project, you don’t want to be figuring out how the tools actually work! So, as always, with so many microcontrollers to choose from these days (and languages), you should always be considering what's the best fit for purpose. :)
@prabbit237
@prabbit237 5 років тому
"tons of bootstrapping pins that eat up a few of the already limited pins" There's 11 GPIO pins that are FULLY usable on an ESP-12 if set right with pullup/down resistors (GPIOs 0-16 but less the 6 that access the flash.) Even on the ESP-01, which has 8 pins exposed, you have 4 GPIO's available (you may have to be careful about peripherals that may try to pull them up or down at startup.) That's still plenty for a simple remote light switch, LED controller, etc. The only thing the ESP-8266s lack is a decent number of ADC pins. "the typical way is pull resistors to define the default state" That's the typical way to set an INPUT pin, not an output one. Pullups/downs can't do anything if the pin is set as output at bootup. True, it might be best to have the pins all default to input at boot but if they are set as output, then resistors mean nothing.
@tablatronix
@tablatronix 5 років тому
Those SD pins are flash spi which are tied to internal flash chip, they typically should not be used as io
@bobsort
@bobsort 4 роки тому
He must be joking or trolling us I guess. connecting trigger of a relay to RX and then to TX too!
@MatsK007
@MatsK007 5 років тому
The solution to prevent it could be an RC circuit with an inverter connected to an OR gate. Before the RC circuit is charged will it be in a low state and after a time it will be charged to a HIGH state. The RC signal is then inverted so it is HIGH during startup and then switch to low. If the inverted signal is then fed into one of the inputs of an OR gate for each GPIO that should be kept HIGH during startup and the GPIO pin is connected into the other OR input it should be high during startup and then controllable by the GPIO pins.
@jeffmerlin2580
@jeffmerlin2580 5 років тому
Or an RC delay loop for the relay power. Then you don't need the OR-gate. Just one transistor (or MOSFET) to switch on the relays (with a delay).
@prabbit237
@prabbit237 5 років тому
The solution to prevent it could be not to hook up relays to pins that are connected to the flash chip (or just to...I dunno, maybe RTFM?. The SD0-SD3 are NOT intended for GPIO use.)
@MatsK007
@MatsK007 5 років тому
My answer is a generic GPIO not limited to SD0-3!
@juanmadg1
@juanmadg1 5 років тому
There's a simple trick you can use that is introducing a timer which delays the powering up of the relays board (this is somewhat similar at what hi-fi chains do at the amplifier output to avoid undesired clicks at the loudspeakers - you will hear a click after a couple of seconds on many of them which connects them via a relay once the amplifier is ready). The way you implement the timer is up to you... simple transistor with an RC network at its base... ol'pal 555 timer (depending on the board's consumption this might still require a driver transistor)... If you prefer it, you can turn relays board power under controlled command ... Stablish a NPN transistor as a power driver with a pull-down resistor at its base. This will keep the relays board powered off until its base will be powered high via an ESP8266 output. You can also RC time the base of the transistor so as that only after a predetermined high time the power is applied (this can avoid flickering if the outputs would also go high during boot time).
@CollinSale
@CollinSale 5 років тому
I think I will pick up some of these chips :-)
@DustinWatts
@DustinWatts 5 років тому
I had a similar problem with a WIFI 220V distributing box I designed using a relay board and a WEMOS D1 mini. I "solved" (actually got around it) by putting a switch before the VCC to the relay board and waiting a few seconds before switching the relay board on. I'll do a video about the box! BTW. I don't think we are family ;)
@leglessinoz
@leglessinoz 5 років тому
It won't help if it's in a situation where manually flipping a switch isn't an option. If there is a brief power out and then the NodeMCU reboots, it will possibly activate some of the relays. In my application even they activate for a fraction of a second it will be a problem. I'm only using the relay as a momentary switch but not to switch mains.
@guatagel2454
@guatagel2454 5 років тому
Do not use GPIO0 as output at boot. If you do, it must be used as a pull down output. If you put a load between GPIO0 and GND, ESP8266 will boot and inmediately reboot depending on the load, lenght of the cables and electric noise of the environment.
@1978jra
@1978jra 5 років тому
I suspect that different versions of bootloader/firware do work differently. I have not really used esp8266, but maybe try to flash different firmware verdions.
@hencosteenberg6685
@hencosteenberg6685 Рік тому
use a esp 32. the relays cause a brownout on the esp
@SurajGrewal
@SurajGrewal 5 років тому
My way woukd have been (esp8266) >serial> (avr atmega or attiny) >> optocouples.
@hencosteenberg6685
@hencosteenberg6685 Рік тому
it doesnt happen with a proper 5v supply
@leglessinoz
@leglessinoz 5 років тому
for reliability sake, I just don't try to control more than 6 relays using an ESP-8266 based board. If you wan to control more use an ESP-32 based NodeMCU board.
@bobsort
@bobsort 4 роки тому
Why is that? this board also have 8 bit data out you can even use it to control 255 relays
@pleisterman8660
@pleisterman8660 5 років тому
sd stands for serial data.
@leglessinoz
@leglessinoz 5 років тому
Those chocolates are called "Freckles" in Australia. They are only milk chocolate though with hundreds and thousands on top.
@DavidWatts
@DavidWatts 5 років тому
They didn't last long :-)
@leglessinoz
@leglessinoz 5 років тому
@@DavidWatts they seldom do
@wilfredswinkels
@wilfredswinkels 5 років тому
David, less bass more high in your audio please.
@oskimac
@oskimac 5 років тому
there is a chrome extension "equalizer" for these.
@SimoWill75
@SimoWill75 5 років тому
13:45 Why does every lefty I've ever met write with their pad/paper cocked on such a huge angle?
@DavidWatts
@DavidWatts 5 років тому
As a lefty it is because otherwise I would not be able to see what I have just written. It would be on the other side of my hand, righties don't have that problem.
@SimoWill75
@SimoWill75 5 років тому
Thanks David, that actually makes a lot of sense. Being right handed myself(obviously) and as you say, not a problem for me, I had never even considered the problem existed! My son is a lefty but he's not writing yet, at least I'll understand now if he has problems as he learns. Cheers!
@Ed19601
@Ed19601 5 років тому
SimoWill75 also..... When writing with ink/ballpen you avoid smudging the ink with your hand in case it wouldn't be fully dry yet
@SimoWill75
@SimoWill75 5 років тому
Ed19601 I had considered that, but then I tried writing right to left and it didn't happen, my right hand stayed clear of the fresh ink. David's reply makes perfect sense though.
@Ed19601
@Ed19601 5 років тому
SimoWill75 it does make perfect sense, but the ink argument was told to me by left writers in my youth........ But mind you, I am from a time that we learned to write with liquid I know you had to dip a pen in and only when I was about 8 the first ball-pe s were introduced...... And the were not as good as now
@browaruspierogus2182
@browaruspierogus2182 5 років тому
Aren't relays isolated? This is very bad design. Optocouplers are useless. Each relay needs large RC as backup.
@leglessinoz
@leglessinoz 5 років тому
I wouldn't be using these little Songle "10A" relays to switch more than 1-2A anyway. I tend to use 16A or 30A relays to reliably switch higher currents (even 10A).
@oskimac
@oskimac 5 років тому
i think optocupler prevent you from using transistors and diodes to drive the relay coil . and also provide total isolation from the coil also. You only are driving a led from your esp. not a transistor and a coil that can generate a HV spike
@crazyboy2006cashier
@crazyboy2006cashier 5 років тому
First comment - great video
@tinkmarshino
@tinkmarshino 5 років тому
ah david.. your a left hander! Makes a difference ya know...
@prabbit237
@prabbit237 5 років тому
There's no mystery and there's no bug. There's simply a lack of understanding and knowledge of how the board/chip works (and not a lot of understanding about other things as well.) I'm sorry but this is a really BAD video. He says you'd get 2.8v out after two LEDs. Either that is connected to ground (to turn it on) in which case you get...wait for it....0v or it's connected to logic high, in which case the ESP is putting around 3.3v to it and the LEDs have NO current through them (and thus no voltage drop across them.) When it's at the 0v, the LEDs probably drop around 1.7-1.9v each and the resistor drops the rest. Then he can't even do simple subtraction of 2.8 from 5 without mumbling through it. He's going to try and explain what an opto-isolator is/does without understanding it really himself. He says he's driving the relay off the ESP and that's probably not good without understanding that the ESP is either shunting 5v right from the USB out or it's providing 3.3 through the regulator, which actually does have some room for that (those small relays probably only take about 50ma and the ESP will have that much to spare. Then he's using pins that are actually connected to the flash chip (the ONLY pins on that side of the Wemos/Lolin that are usable are the A0 (the one tied direct to the ADC pin and only good for 0-1v), ADC (the one tied to a voltage divider, thus allowing 0-3.3v), the EN and RST pins (to allow something else to disable or reset the ESP), VIN (for external power in), the 3.3v (for 3.3v in or out.) and GND. The whole "I don't know what the SD0 is but it sounds like serial data" just shows why "hey, let's hook this up without even understanding what it is and then when it seems to work weird, let's call it a bug/flaw" way of doing things is NOT the way of doing things. The SD0-SD3 are NOT usable as GPIO. pins (well, you MIGHT be able to get away with using SD2 and SD3 IF you undo those two pins from the flash chip and then never try to use QIO or QOUT for the flash), nor are the CLK and CMD. Those 6 pins all control the flash memory and it's no wonder you'd get the relays activating at bootup. Depending on which one was used, you may even not GET a bootup and/or you may kill the board. I don't know why they even break those out unless its so someone could use a different flash chip or something on a separate board. There's pages all over the place that say "don't use GPIO pins 6-11 for GPIO." This is the very reason he couldn't duplicate the issue with the smaller board (it doesn't break out the flash/6-11 pins.) I don''t know if all of this person's videos are like this and I'll never know since I'm not even going to bother with any of the rest. I couldn't even sit the rest of the way through this one.
@DavidWatts
@DavidWatts 5 років тому
Thanks for the time you took to write a comment, I thought I might take the time to reply even if your comment is not aimed at me. Thanks for your comment about my mathematics ability, perhaps you would be better off with the numberphille channel if that is your bag. The root of the video is based of another person's observations and not mine, in fact I think I said I did not understand why people had experienced what was described in the email feature, I couldn't exactly replicate it myself. When I spoke about driving the relays from the ESP I was talking about bridging those power pins which as I am sure you are aware exist to separate the controller from the power to the relays. I am sure the designer had their reasons. At the start I mentioned that the pins I used did not cause in odd behaviour in the relays so I explored which pins might do it and offered a solution in the form of a shift register without (mentioned in the video multiple times) knowing the reason for the 'mystery behaviour' I don't know if all your comments are like this but this but the community I exist in is all about sharing experiences, knowledge and helping other people. This channel is an electronics vlog, not a tutorial channel or featuring someone with any advanced training. I also don't make a living from it, I just enjoy sharing my experiences. While I dislike your approach to the comment I am sure it comes from a place of experience so if you care to input, please do it respectfully.
@prabbit237
@prabbit237 5 років тому
I still stand behind WHAT I said, even if I may not have been the most politically correct about HOW I said it. Yes, it was more on the snarky side than it should have been. But the points still remain. And I just see so much junk on UKposts with people trying to explain something without really even understanding the issue (and actually, your video was FAR from the worse I've seen in that regard) that sometimes it really gets to me. But that being said....... You never explained how you got the 2.8v number. Either it's going to be close to 3.3v (or whatever the high logic-level is for whatever's connected to it) or it's close to ground. It's probably not going to be 2.8 with an ESP8266 unless you're powering it from under 3v (although the datasheet does say the high level out can be as low as 0.8xVDDIO (which should be 3.3v on both of those boards and thus a high output COULD be as low as 2.64v.) If the resistor connects to 5v and the visible LED is connected to something else, then either the something else is pulled down to (close to) 0v and the LEDs conduct/light up or it's set to something above around 1-2v, in which case the LEDs can't conduct (not enough voltage drop available) and the control pin will either be 5v (if the control pin isn't being driven at all but is more or less floating) or whatever the controlling circuit manages to drive the control pin to. On the relay board, the designers had their reasons for adding that jumper BECAUSE the MCU or other control source may be at too high or too low of a voltage to properly operate the relay board. Or maybe the MCU board simply can't handle the load of the relay board, you're worried about high voltage if the relay shorts out and thus want to isolate the power. etc. So you have flexibility. You CAN power the board from the same source as the MCU, as long as there's not too much other peripheral load or you can power only part of it (the visible LED and the LED half of the optoisolator.) But my point about powering the relay board from the ESP board was simply that, under normal use, one relay should be fine. Four at the same time MIGHT be pushing it, though. And it was the "exploring other pins" that was part of the problem. If you have a device that seems to be flakey in how it works, you need to FIRST know what the pins are for. A search on the ESP8266 shows what IO are usable all the time (1, 3, 4, 5, 12, 13, 14 & 16), which are used at bootup but can still be used afterwards as long as you do it right (0, 2 & 15) and which ones are NOT (easily or at all) usable (6, 7, 8, 9, 10 & 11.) Then you'd find out what pins are what on each board. On the Lolin one (the long, skinny one) you'd find all the pins labeled D* are the readily usable GPIOs (but again, keep in mind the ones used at boot.) So you'd then try those one at a time and say "Hmmm...none of those caused an issue. Maybe they connected the relay to one of the reserved pins and THAT's what caused the issue. Let me try those. AHA! These ones labeled SD* seem to cause issues because they HAVE to go high during parts of the bootup process. That's probably what happened is that they simply were using the ESP wrong. But......JUST in case they really did use one of the proper pins and it really is a quirk of the ESP, here's how a buffer chip may help." I.e be methodical about it instead of "well, I don't know what this pin is for and haven't researched its use but I'll just plug something to it and see how fast the magic smoke appears." And one last note on the video. The resistor feeding the LEDs was probably a 1kohm, not a 100ohm. If it'd been a 100ohm, then driving an LED with a drop of 2.2v (whether it's one or two that add up to that), you'd be pouring 28ma into the ESP, which is only rated for 12ma max on the GPIO pins. With it being a 1k, it'd only be using 2.8ma, which would be fine for pretty much any controlling chip. But basically, the the two LEDs probably have a total voltage drop around the 3.5-4.5v area (depending on the color and, of course, we have no idea what color the one in the isolator is without a datasheet.) With that drop and the 100ohm, the current would be 5-15ma and could still fry some boards. So, as mentioned, my guess is that it was a 1k, not a 100 so that it'd be compatible with pretty much anything thrown at it.
@DavidWatts
@DavidWatts 5 років тому
Thank you for the detailed response, it was very interesting to read.
@Karl_Levine
@Karl_Levine 3 роки тому
Dead on Mike Anderson. Accurate and brilliant reply. Fact I'm the only one who liked and thanked you for it shows just how bad it is.
Connecting a Relay Module to a Microcontroller
11:41
Brad Henson
Переглядів 205 тис.
#232 How to secure our devices using SSL (ESP8266, ESP32, Tutorial)
17:27
Andreas Spiess
Переглядів 113 тис.
НЕОБЫЧНЫЙ ЛЕДЕНЕЦ
00:49
Sveta Sollar
Переглядів 6 млн
Не пей газировку у мамы в машине
00:28
Даша Боровик
Переглядів 2,1 млн
Everything you need to know about RELAYS
22:48
Playful Technology
Переглядів 47 тис.
How To: Pick the right pins on the NodeMCU ESP8266 and ESP32
4:20
The Hook Up
Переглядів 73 тис.
How to Build an Automated Arduino-Controlled Ouija Board
42:57
Playful Technology
Переглядів 12 тис.
Is Adam Savage Still an Atheist?
8:16
Adam Savage’s Tested
Переглядів 261 тис.
ESCAPEROOM Puzzle - Interesting Way To Turn ON Your PC
17:13
Electronoobs
Переглядів 23 тис.
Where People Go When They Want to Hack You
34:40
CyberNews
Переглядів 71 тис.
Tasmota and Tasmotizer - Easy Flashing Guide for ESP8266 devices
20:01
NodeMCU ESP8266 Pin Description Explained
7:14
BINARYUPDATES
Переглядів 76 тис.
How Neuralink Works 🧠
0:28
Zack D. Films
Переглядів 26 млн
APPLE УБИЛА ЕГО - iMac 27 5K
19:34
ЗЕ МАККЕРС
Переглядів 84 тис.
поворотний механізм для антени
0:17
Lazeruk
Переглядів 14 тис.