Hello, I'm trying to get serial communication from arduino to nodemcu. I'm wondering that given that the arduino runs off 5v and NodeMcu runs off 3V, if this particular wiring is safe between the RX and TX ports? If not, could I be directed to a safer hookup between the RX and TX pins? much appreciated.
Upon further research, it looks like I'll be needing a logic converter. I think I understand how to work one, but I'll send through a wiring diagram shortly to confirm.
I would connect the NodeMCU via a software serial port on different pins to save the hardware serial port (pins 0 & 1) for program upload, monitoring program flow and variable values (debugging).
Besides following groundFungus's suggestion, you can make a simple level shifter with 2 10k ohm resistors in series between arduino softserial TX and gnd. Have esp RX connected between the resistors. Then esp TX directly connects to arduino softwareserial RX. Don't use very long wires and you can go up to 115200 baud with this.
liuzengqiang:
Besides following groundFungus's suggestion, you can make a simple level shifter with 2 10k ohm resistors in series between arduino softserial TX and gnd. Have esp RX connected between the resistors. Then esp TX directly connects to arduino softwareserial RX. Don't use very long wires and you can go up to 115200 baud with this.
thank you for the suggestions, I think I'll just stick with the logic converter for simplicity though
Well, that just shows how dangerous "helpful" articles on the Internet are.
For at least one version of that "logic level converter" you indicate, the conversion from 5 V to 3.3 V actually is no more than the two resistors liuzengqiang cites but with different values, so saying "for simplicity" is somewhat nonsensical.
A significant problem is that you are proposing to connect the primary serial ports of the two boards together. For each board, these ports are already connected to a USB interface chip, by 1k resistors in the Nano and 470 Ohm on the NodeMCU. These resistors will load down whatever you use to connect the boards together and the particular "logic level converter" may not reliably drive them.
As explained, it is generally not necessary to convert the 3.3 V to 5 V level for the Nano as the latter will accept 3.3 V logic and a direct connection will overcome the 1k resistor. In the other direction, a diode with cathode to Nano TX and anode to NodeMCU RXD will drive it perfectly well using the 470 Ohm resistor in series with the USB chip as a pull-up.
One single diode as the level converter.
The overarching question is if you have a NodeMCU which is a substantially more powerful processor, why would you even want to use a Nano at all?
Nick_Pyner:
Seems to me that you can use a 1k/2k voltage divider, just like you would/should with Bluetooth.
Aah ok thank you. just checked out a few diagrams, seems a lot simpler. that's what I'll do!
Paul__B:
The overarching question is if you have a NodeMCU which is a substantially more powerful processor, why would you even want to use a Nano at all?
I'm hooking up a current sensor to an arduino, and the data is sent to the nodemcu. The nodemcu also has quite a few other functions, which get slowed down significantly when I run the current sensor on it as well.