NODEMCU, UNO and 8ch relays

I am using NODEMCU V1.0 and ARDUNIO UNO and 8ch RELAY BOARD...for communication between NODE and UNO i am using serial.swap (D7 and D8) and i cannot use all 8 relays, but only 7 (D0,D1,D2,D3,D4,D5,D6)....how to connect 8th relay?

what is strange is when i am trying to use rx/tx pins on node i will be able to connect 8 relays but i cannot have serial communication...

does anyone know how to connect 8 relays in this project?

Why is the UNO included? It would make more sense to use the NodeMCU for WiFi access and the UNO for its I/O - but that doesn't seem to be the arrangement.

Let me explain @runaway_pancake ..... UNO has 3 acs712 sensors for measuring energy using A0, A1 and A2...NODE is used for WiFi and communication with MQTT....it works good but problem is that i cannot attach 8 relays but only 7....rx/tx works good when i am using D7 and D8 on NODE with serial.swap, but when i am using rx/tx on NODE instead of D7/D8, i cannot get serial communication between NODE/UNO...

Wouldn't it be more practical to connect the relays to the UNO?

Can't you run the relays with the UNO, though ?

Did not think about that....do i have enough digital pins on UNO for 8 relays?
i wanted node to be used for communication with mqtt server and to turn relays on/off, UNO to measure and calculate energy consumption, and not to be disturbed by toggling relays on off

also i would like to know if node is able to run 8 relays when i am using serial.swap, there must be the way

If all you are given is D0-D8 and you lose 2 with 'swap' then you only have 7, that's it.
Why can't you use 'TX' and 'RX' (GPIO1, 3) for comms ?

That's what I want to know too... I have one power supply 5v 3A, which is connected in one point from which one end goes to arduino connector 5v, second end goes to jdvcc for relays and third one goes to usb of nodemcu... Also Vcc pin on 8ch board relay is connected to VV pin of Nodemcu...
Maybe my connection way is not good... What do you think, where am I wrong?

Use a pcf8574 chip/module or similar to control the relays.

Use an ads1115 or ads1015 or similar to read the acs712 sensors.

Connect the pcf8574 and ads1015 to the NodeMCU.

Save the Uno for another project.

Some esp8266 boards fail to have serial on "serial pins", because of how they are connected to usb chip if I remember well...
Anyway, that shouldn't prevent you to use TX pin (GPIO1) for your relay. It's high on boot, but so is D0...

1 Like

So...is there any solution to use 8 relays and serial communication?

You had only one missing, use TX pin (Gpio1).

I have declared TX pin as "1" and nothing...i cannot turn on/off relay on TX pin

I don't know what you mean with that.
If you did swap, TX is on Gpio15.
And you use Gpio1 for relay (pin labeled TX).
digitalWrite(1, LOW);

Not working digital Write pin 1...all others are working but that one, not

Feel free to post the code (in code tags).

My code is huge maybe is better to send me code just for 8 relays so I can upload it and test it... But with tx pin included and d0 1 2 3 4 5 6

Try with this..

void setup() {
  Serial.begin(115200);
  Serial.swap();
  pinMode(1, OUTPUT);
}


void loop() {
  digitalWrite(1, HIGH);  
  delay(1000);                     
  digitalWrite(1, LOW);   
  delay(1000);                   
}

If it doesn't work, you should be able to use GPIO10 (SD3) pin as output. Flash mode has to be DIO or DOUT, which I believe is arduino default for your board.

You used serial.swap but so D7 and D8 pins are used for serial communication.. I want to use rx tx on node... Just make it clear... If I am using serial swap and D7 and D8 for serial how to get 8 relays, how to use sd3 for relay?

I understood you had one pin missing for your setup.
If your RX TX (1, 3) pins don't work for serial, you need to make swap. An you could use 1 as output.
If that's not enough, you have 9 (SD2) and 10 (SD3) available if your flash mode is DIO or DOUT.