ESP8266 two serial ports with SoftwareSerial library

In certain cases we need to use more than one Serial port in the case of arduino, I use the arduino mega 2560 which has 4 serial ports including the programming port, in the case of arduino’s as the nano has a single programming port and as a solution Have created the softwareserial library, given the incompatibility of certain functions the softwareserial library for arduino does not work on esp8266.

Softwareserial Library

I have tested with ESP8266 NodeMCU and SoftwareSerial library of the espsoftwareserial repository created or supplied by plerup thanks for your contribution to the community.

Recommendations

In the case that these libraries that create a uart in code must be taken into account that at high speeds it is possible to have bit errors since they use interrupts and the microcontroller you are in many tasks at a time, in my case and the tests that I have I configured the port at Maximo 9600 Bauds, it is a relatively low speed but I consider it to be safe.

Test

To verify the operation of the softwareserial library, I downloaded the library for esp and I have temporarily replaced the serial software version for arduino.

Tutorial ESP8266 12E NodeMCU  & SoftwareSerial

 

Arduino IDE Code

This test creates a bridge between the 2 serial ports.

View

ESP8266 SoftwareSerial

 

Materials

1 Esp8266 12e  NodeMCU

1 Converter  USB -TTL (FTDI)

ConnectionsESP8266 SoftwareSerial

 

References and Downloads

SoftwareSerial for ESP8266






Conclusions

Although this is a basic test, it requires more complete tests regarding the configuration of more serial serial ports.

The idea is to use this library in future integrations in Modbus RTU, Recommended TrialCommand.

 Youtube Channel

PDAControl

You may also like...

Leave a Reply