Go Down

Topic: Nodemcu/esp8266 serial hdw requires sacrificing the console capability (Read 2626 times) previous topic - next topic

PaulRB

Frank, please start using "Reply" instead of "Quote" all the time. Use Quote when you want to refer to something specific.

frank2644

PaulRb, I was using "quote" because each  time I was responding to a "specific" person's posting.

In that situation isn't "quoting" better than "reply" since any reader could see the post i was responding to without having to search for it?

Are you sure "reply" is better for those situations?

Put another way, above I stated an upside to "quoting"(no search), is there a downside that I don't see?

I'm not that savvy in forum etiquette so please let me know if I am off-base.

Thanks,
Frank



PaulRB

Quoting entire posts just makes the whole thread longer without adding any value to the discussion.

Usually it is obvious from the context what you are responding to. If there is a doubt, just quote a few key words of a post, or refer to someone by their forum name, for example "@PaulRB: why not quote entire posts?"

frank2644

PaulRB ,

Okay, you have a lot more experience here than me so I'll accept your recommendation to minimally use "quote" and mostly use "reply".

Thanks for taking the time to explain it to me.

Frank


frank2644

I give up...It looks like there is no way to see the normal console data when the console Serial port is swapped to support my Nextion serial display. And swapping is the only way to receive data from my nextion display. There are no other usable serial Rx ports on the Nodemcu/esp8266.

Furthermore, if you logically want to use the  swapped-to Tx port (pin15,D8) for sending to the Nodemcu you really cannot do that because the Nextion biases that pin high and that causes any subsequent Nodemcu load, reset, or power cycle to fail (known limitation).

Sounds like I have to use Serial1 to send data to the Nextion via pin 2 (D4) and receive data from the Nextion via "Serial" on the swapped-to port (pin 13, D7). I think I can dynamically swap ports as needed for receiving from the Nextion, and then unswap to allow for console data.

BTW, I would guess that any serial device has the above problems, not just the Nextion.

I gotta say the Serial capabilities of the Nodemcu/ESP8266 are pretty bad.

Frank

PaulRB

Agreed, this is not the esp8266's strong point. But it has caused a revolution in the low-cost MCU world, enabling cheap WiFi capability. That's it's strong point.

Have you looked into esp32?

frank2644

 PaulRB,

I would like to look at the ESP32, but I can't stand the thought of another lengthy exercise to learn another MCU. I'm 77 years old and can't afford to waste too much time.  ;) 

As you rightly point-out the esp8266 is a very capable MCU and except for the serial capabilities serves my purpose very well.

At this point I think I'm over the hump and I believe I can live with the serial shortcomings of the esp8266.

Although if anybody reading this note happens to know if the esp32 has superior serial capability to the esp8266 I would like to hear about it.

Frank

PaulRB

Although if anybody reading this note happens to know if the esp32 has superior serial capability to the esp8266 I would like to hear about it.
I wouldn't have suggested it otherwise. The esp32 was designed to address the shortcomings of the esp8266. It has 3 UARTS. Lots more features than its predecessor, but you don't have to use them. The same code will probably run almost if not completely unaltered.

ardcp

@frank2644,

If you can accept the use of SoftwareSerial for the standard RX-TX pins, here is a test program I used to test a PMS7003 dust particle sensor connected via a serial port using swap and using SoftwareSerial to output via the standard serial port.

Now the project has been changed to use ESP32 due to long sleep periods and more pins required.

Code: [Select]

//Esp8266 swap serial test

/*
*  SWAP_PINS:
*  
*  Configure Hardware Serial port on RX:GPIO13 TX:GPIO15
*  and use SoftwareSerial for logging on
*  standard Serial pins RX:GPIO3 and TX:GPIO1
*/


#include "PMS.h"

#define BAUD_LOGGER 115200
#define BAUD_PMS    9600


#include <SoftwareSerial.h>
SoftwareSerial* logger = nullptr;   //If use softwae for std rx tx pins

#define MS_DELAY 10000              //10 sec
long timevalue;

PMS pms(Serial);
PMS::DATA data;

void setup()
{
 Serial.begin(BAUD_PMS);   // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)

 Serial.swap();

 // Hardware serial is now on RX:GPIO13 TX:GPIO15
 // use SoftwareSerial on regular RX(3)/TX(1) for logging
 logger = new SoftwareSerial(3, 1);
 logger->begin(BAUD_LOGGER);
 logger->println("\n\nUsing SoftwareSerial for logging");
 
 pms.passiveMode();
 pms.wakeUp();
 delay(200);
 timevalue = millis();
}

void loop()
{
 if( timevalue <= millis() ) {
    pms.requestRead();
   if (pms.readUntil(data, 2000))
   {
     logger->print("PM 1.0 (ug/m3): ");
     logger->println(data.PM_AE_UG_1_0);
     logger->print("PM 2.5 (ug/m3): ");
     logger->println(data.PM_AE_UG_2_5);
     logger->print("PM 10.0 (ug/m3): ");
     logger->println(data.PM_AE_UG_10_0);
     logger->println();
     
     logger->print("PM 1.0 (ug/sp): ");
     logger->println(data.PM_SP_UG_1_0);
     logger->print("PM 2.5 (ug/sp): ");
     logger->println(data.PM_SP_UG_2_5);
     logger->print("PM 10.0 (ug/sp): ");
     logger->println(data.PM_SP_UG_10_0);
     logger->println();
     
     logger->print("PM 0.3 (total): ");
     logger->println(data.PM_TOTALPARTICLES_0_3);
     logger->print("PM 0.5 (total): ");
     logger->println(data.PM_TOTALPARTICLES_0_5);
     logger->print("PM 1.0 (total): ");
     logger->println(data.PM_TOTALPARTICLES_1_0);
     logger->print("PM 2.5 (total): ");
     logger->println(data.PM_TOTALPARTICLES_2_5);
     logger->print("PM 5.0 (total): ");
     logger->println(data.PM_TOTALPARTICLES_5_0);
     logger->print("PM 10.0 (total): ");
     logger->println(data.PM_TOTALPARTICLES_10_0);
     logger->println("---");
   }
   timevalue += MS_DELAY;
 }
 // Do other stuff...
}

Juraj

@frank2644,

If you can accept the use of SoftwareSerial for the standard RX-TX pins, here is a test program I used to test a PMS7003 dust particle sensor connected via a serial port using swap and using SoftwareSerial to output via the standard serial port.

perfect

PerryBebbington

Hi Frank,
My current project is to separate the Nextion that is the user interface of my heating controller from my heating controller so I can have 1 Nextion accessing more than one device. I am using an ESP8266 (I would have bought ESP32 if I'd known...) connected to the Nextion, will probably re-write my heating controller to run on a MKR WiFi 1010 and let the two talk to each other. Once the data is going to and from the Nextion by Wi-Fi that opens up the possibility of it communicating with other projects easily. I was as frustrated as you when I discovered the ESP8266's limitations but I've learned to work around them.


Quote
I'm 77 years old and can't afford to waste too much time
My neighbours are well past 80 and not showing any signs of pegging out any time soon! Anyway, you are only wasting time if you are not having fun!

frank2644

PaulRB,

Okay, I took a look at the ESP32 and It seems like a big improvement over the ESP8266. I think I'll order one and try it out.

ardcp,

I have looked at software serial, but I see reports that it might introduce some problems if wifi is also used. I use wifi extensively so I have been avoiding software serial, but if I have more problems with the hdw serial I may give it a try.

Thanks to all for the contributions.

Frank

P.S. Hopefully the encouraging words about my age prove true.



Juraj

PaulRB,

Okay, I took a look at the ESP32 and It seems like a big improvement over the ESP8266. I think I'll order one and try it out.

ardcp,

I have looked at software serial, but I see reports that it might introduce some problems if wifi is also used. I use wifi extensively so I have been avoiding software serial, but if I have more problems with the hdw serial I may give it a try.

Thanks to all for the contributions.

Frank

P.S. Hopefully the encouraging words about my age prove true.



the esp8266 core has a new SoftwareSerial library.

frank2644

the esp8266 core has a new SoftwareSerial library.
Thanks, Juraj, is this the new library?

https://github.com/plerup/espsoftwareserial

If I get a chance i'll give it a try.

Frank

Go Up