NodeMCU LUA V3 + 8 channel relay + KY-022 IR remote

I need to make a 8 channel 220v power strip. do these components matche together?
NodeMCU LUA V3

8 channel relay

KY-022 IR remote

the reason I chose NodeMCU LUA V3 is that it’s the cheapest mcu I found that doesn’t need soldering

I have something like this in my mind

Yes, but you need to be careful with wiring.
This will save you some time:

2 Likes

what do you mean? because of ac electric shock?

I couldn’t find the module you suggested. the relay I posted earlier is available
since there are 13 pins in total which pins on nodemcu I should use?
IR remote and relay’s gnd and vin share pins or connect them separately?

Actually, Esp8266 has 9 (somehow) usable gpio pins plus TX/RX.
You need them all. And some pins will trigger relays on boot. I strongly suggest to go with Esp32 board. Cost is maybe $1 more…

https://aliexpress.com/item/1005002231689053.html

2 Likes

if you remember I mentioned I live in Iran and I can’t buy from international websites.
my options are very limited
NodeMCU LUA V3 is 3$ and the cheapest nodemcu esp32 is 10$
with that in mind it would be best if somehow I can use NodeMCU LUA V., if it’s even possible
I know it’s not ideal but it’ll do the job?!

Yes.
Use the same pin configuration from the link above for ESP-12F_Relay_X8

With some of the pins that have states that effect boot or change state at boot, you may be better off using 2 8266’s and only use pins that are stable at boot.
Only difference is there will be 2 devices each controlling half.

I’m literally in war zone, Tehran, and they are shuting off the Internet so I need to do configurations ASAP to be able to control the relay offline
for now I got an 4output relay
please tell me which pins are safest for relays 4 pins an which pins I should use to connect KY-022 IR remote
also please give me a esphome yaml code to control the relay with KY-022 IR remote

I know it’s a lot to ask but it’s emergency

Gpios 4,5,12,13,14

That’s not something I can do. You need to receive and record the codes successfully from you remote control first.

1 Like

these are the code I get

key #1
[15:42:12][I][remote.pronto:231]: Received Pronto: data=
[15:42:12][I][remote.pronto:233]: 0000 006D 0023 0000 003E 001D 0053 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0016 0015 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 
[15:42:12][I][remote.pronto:233]: 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:42:12][D][remote.beo4:086]: Beo4: n_sym=68
[15:42:12][I][remote.pronto:231]: Received Pronto: data=
[15:42:12][I][remote.pronto:233]: 0000 006D 0022 0000 00AE 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 
[15:42:12][I][remote.pronto:233]: 0015 0016 0016 0016 0014 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:42:12][I][remote.samsung:061]: Received Samsung: data=0xE0E020DF, nbits=32

key #2
[15:43:52][D][remote.beo4:086]: Beo4: n_sym=70
[15:43:52][I][remote.pronto:231]: Received Pronto: data=
[15:43:52][I][remote.pronto:233]: 0000 006D 0023 0000 0023 0028 0064 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0017 0014 0016 0015 0016 0015 0041 0015 0041 0016 0040 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 
[15:43:52][I][remote.pronto:233]: 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:43:52][D][remote.beo4:086]: Beo4: n_sym=68
[15:43:52][I][remote.pronto:231]: Received Pronto: data=
[15:43:52][I][remote.pronto:233]: 0000 006D 0022 0000 00AE 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0016 0015 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0016 0015 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0016 
[15:43:52][I][remote.pronto:233]: 0015 0016 0015 0016 0016 0015 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:43:52][I][remote.samsung:061]: Received Samsung: data=0xE0E0A05F, nbits=32

key #3
[15:44:28][D][remote.beo4:086]: Beo4: n_sym=70
[15:44:29][I][remote.pronto:231]: Received Pronto: data=
[15:44:29][I][remote.pronto:233]: 0000 006D 0023 0000 0035 0027 0052 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 
[15:44:29][I][remote.pronto:233]: 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:44:29][D][remote.beo4:086]: Beo4: n_sym=68
[15:44:29][I][remote.pronto:231]: Received Pronto: data=
[15:44:29][I][remote.pronto:233]: 0000 006D 0022 0000 00AE 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 
[15:44:29][I][remote.pronto:233]: 0015 0016 0016 0015 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0041 0016 0040 0015 0041 0015 0041 0015 0041 0015 0181 
[15:44:29][I][remote.samsung:061]: Received Samsung: data=0xE0E0609F, nbits=32

key #4
[15:44:56][D][remote.beo4:086]: Beo4: n_sym=68
[15:44:56][I][remote.pronto:231]: Received Pronto: data=
[15:44:56][I][remote.pronto:233]: 0000 006D 0022 0000 00AE 00AE 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0016 0015 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 
[15:44:56][I][remote.pronto:233]: 0015 0016 0015 0016 0016 0015 0015 0016 0015 0041 0015 0041 0015 0041 0016 0015 0015 0041 0015 0041 0015 0041 0015 0041 0015 0181 
[15:44:56][I][remote.samsung:061]: Received Samsung: data=0xE0E010EF, nbits=32
[15:44:56][D][remote.beo4:086]: Beo4: n_sym=68
[15:44:56][I][remote.pronto:231]: Received Pronto: data=
[15:44:56][I][remote.pronto:233]: 0000 006D 0022 0000 00AE 00AE 0015 0041 0015 0041 0015 0040 0016 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0016 0015 0015 0016 0015 0016 0015 0016 0015 0041 
[15:44:56][I][remote.pronto:233]: 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0040 0016 0041 0015 0041 0015 0040 0016 0181 
[15:44:56][I][remote.samsung:061]: Received Samsung: data=0xE0E010EF, nbits=32

If you use:
dump: samsung
instead of “all”, do you catch all button presses?

[16:29:36][I][remote.samsung:061]: Received Samsung: data=0xE0E020DF, nbits=32
[16:29:43][I][remote.samsung:061]: Received Samsung: data=0xE0E0A05F, nbits=32
[16:29:47][I][remote.samsung:061]: Received Samsung: data=0xE0E0609F, nbits=32
[16:29:56][I][remote.samsung:061]: Received Samsung: data=0xE0E010EF, nbits=32

code:

esphome:
  name: esphome-web-85b6cd
  friendly_name: Desk Fan
  min_version: 2025.5.0
  name_add_mac_suffix: false

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome
  password: "sha935"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

web_server:

remote_receiver:
  pin:
    number: GPIO14
    inverted: true
  dump: samsung

Try with these:

binary_sensor:
  - platform: remote_receiver
    name: "Remote Input1"
    samsung:
      data: 0xE0E020DF
      nbits: 32
    on_press:
      then:
        - switch.turn_on: relay_1

switch:
  - platform: gpio
    id: relay_1
    name: "Relay 1"
    pin: GPIO4

thanks
they shut off Internet that’s why it took so long

I get this

[13:34:35][D][binary_sensor:036]: 'Remote Input1': Sending state ON
[13:34:35][D][switch:012]: 'Relay 1' Turning ON.
[13:34:35][D][binary_sensor:036]: 'Remote Input1': Sending state OFF
[13:34:35][I][remote.samsung:061]: Received Samsung: data=0xE0E020DF, nbits=32

relay doesn’t turn on/off
do I need an external 5v for the relay?
nodemcu is connected to the pc via micro usb and relay is conected to G,3v and GPIO5 pins


Uploading: harelay2.JPG…

code:

esphome:
  name: esphome-web-85b6cd
  friendly_name: Desk Fan
  min_version: 2025.5.0
  name_add_mac_suffix: false

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome
  password: "sha935"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

web_server:

remote_receiver:
  pin:
    number: GPIO14
    inverted: true
  dump: samsung

binary_sensor:
  - platform: remote_receiver
    name: "Remote Input1"
    samsung:
      data: 0xE0E020DF
      nbits: 32
    on_press:
      then:
        - switch.turn_on: relay_1

switch:
  - platform: gpio
    id: relay_1
    name: "Relay 1"
    pin: GPIO5

Can you send a link to that relay module. You probably have it wired incorrectly.

I hope it helps it’s in farsi
https://thecaferobot.com/store/4chanel-5v-relay

Doesn’t open for me. Post an image from your link if you can’t link to something identic.


I realized few things

I can turn on /off the relay via dashboard .in1 led turns on/off but I don’t hear anything. don’t relays suppose to have a clicking sound?

it seems ir remote can turn relay off. in1 led turns off but can’t turn it back on

dashboard indicator is wrong. when it shows it’s off relay led is on and when it shows it’s on relay led is off


in product discription it says it’s active low
does it have anything to do with that? and can it be fixed?

  1. yes, click and LED
  2. it’s wired incorrectly and will also damage your Esp
  3. for active LOW relay you need to add inverted: true
switch:
  - platform: gpio
    id: relay_1
    name: "Relay 1"
    pin: 
      number: GPIO5
      inverted: true


5V to JD-VCC, not to VCC

1 Like

I removed the jumper

it curently wired like this



black wire from vcc on relay to 3v on esp
green wire from gnd on relay to G on esp
blue wire from in1 on relay to D1/GPIO5 on esp

what else I should change?

I’m going to use the relay for AC. do I need to connect 5v to that jumper pin?