0

I'm using a NodeMCU board to send commands to my home electricity switching box - using RS485 communication.

For that, I've connected MAX485 TTL-to-RS485 converter module to my TX and RX pins.

Currently, I can see the serial commands (that my program sends via RS485) also on my Serial monitor (in Arduino IDE), because the CH341 on the NodeMCU is bridged to the serial pins of it.

My problem is that if I want to send debug strings to my Serial monitor (like 'time was updated using NTP') - the RS485 bus will get them also.

I found some documentation about second TX pin available that can be used for debug messages, but I have 2 questions:

  1. Will it be a HARDWARE port? I don't want to load another library and deal with software Serial ports.
  2. Is there a way to get its output via the USB cable connected between the NodeMCU and my computer? Or will I have to connect another USB converter externally to that port to get its output into computer?

Many thanks!

  • Just found now a board ESP-32, which supposed to be very similar to NodeMCU, but has another 2 (one usable) UART ports. Not a solution to my current project, but should be considered in the future for such need. – Offer Dec 27 '19 at 10:12
2

ESP8266 Arduino core has Serial1 as write only hardware Serial on io 2 as TX. IO 2 is D4 on NodeMcu and Wemos D1 mini.

To use the USB chip of the NodeMcu/Wemos with Serial1 you could wire io 2 (D4) to TX. This would not disturb the flashing mode, because bootloader would still listen on standard Serial pins. I tested it.

And for RS485 adapter swap the Serial to io 13 (D7) as RX and io 15 (D8) as TX with the Serial.swap() command.

| improve this answer | |
  • So, I understand there is no way to connect the on-board serial-to-USB converter (CH341 in NodeMCU ver. 3) to Serial1. Right? Also, how can I tell Arduino IDE to use one port for program uploads and another port for Serial monitor? Also, how do I wire USB-TTL external converter to one-pin only on the NodeMCU as you suggested? Thanks! – Offer Dec 24 '19 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.