-->
Page 1 of 3

ESP8266 control system

PostPosted: Tue Jul 28, 2020 11:38 am
by SentinelAeon
Hello,

I have a few questions about ESP8266 D1 mini. I plan to use it in a simple system. I will hook this things to it:

1) 2x red led, 2x green led. Only 2 leds will be turned on at the same time, if all is working well, 2 green ones will glow, if there are any errors in the system, 1 or 2 red ones will glow. I will use such resistor that each led will draw at most 10mA, possibly even 5mA, since the system will be in a dark place and leds will be clearly visible even at low power. I plan to power them from the esp8266 but if there is a better way, i would like to hear it.
2) relay board with 2 relays on it. Relay itself will be powered from external source and esp8266 will only send signal to either 1 or both relays at the same time
3) 4x DHT22 sensor that will be powered by the esp8266 itself

I have a few questions.

1) is this setup within safety margins regarding how much juice the ESP8266 can suply ? If not, is there a better way of doing this ?
2) usualy when doing things with esp8266 board pins, i just start at D0 and then keep adding things to pins i need. So in this case i would look leds to pins D0 - D3, relay board to D4 - D5 and DHT22 sensors to pins D6 - D9. Is this an ok way or should i use certain pins for certain thing ? I am not using pwm or USART or anything like that at the moment so i am asking purely from the perspective of power handling of different pins and what is optimal.
3) all 10 devices will be connected to the same ground pin on esp8266 board (when i say esp8266 pin i mean esp8266 board pin), will that be a problem ?

Re: ESP8266 control system

PostPosted: Tue Jul 28, 2020 4:33 pm
by icons
hello
you should definatelly look at this document:
https://randomnerdtutorials.com/esp8266 ... nce-gpios/

For instance just a quick look, D4 is HIGH at boot, so after a reset your relay will turn on and off quickly, it could be ok for you or it could not...

Re: ESP8266 control system

PostPosted: Mon Aug 10, 2020 1:27 pm
by SentinelAeon
I have a few questions ...

1) I plan to power 3 LEDs from 3.3V pin on the ESP8266 board. Why ? Because that 3.3V pin can handle a lot more current than the IO pins can. And the negative wire will go into 3 separate IO pins. That way when i make pin high, there will be no current flowing and LED will be turned off. And when i pull the pin low, current will flow. And since the IO pin is connected to ground in this manner, it should be a lot less stress for the ESP8266 board as opposed to me using the IO pin to power the led and connect the negative to ground. Am i right in this ?

2) I will need 3 resistors to power LEDs. But since all resistors will be of equal value since LEDs are identical ... what if i would just use a single resistor ? So i would connect 3.3V pin to a single resistor and out of that resistor would go 3 wires, each to its own + of the LED. And then the minus from each LED would go to its own IO pin. That should work, right ?

I added a scheme of 3 situations. The top one obviously doesn't work properly since leds will be powered even if only 1 IO pin works. The bottom one should work because if you cut the + from any LED, it simply will not get power no matter what. In this situation we use IO pins to suply the voltage. And last, the right one, this is the one i plan to use. IO pins act as ground in this case and the power comes from 3.3V pin. They all share the same + pin, but since their ground is separate it should work as intended. Please correct me if i am wrong.

Re: ESP8266 control system

PostPosted: Mon Aug 10, 2020 1:52 pm
by schufti
a) it does - for esp8266 - not matter if the i/o pins sink or source current - here typically 12mA max.

b) either you only activate one led at a time or the current will split to 2/3 leds and the brightness will decrease accordingly.

resistors are not so expensive that one or three should break your budget...