Software Serial Esp8266

Software UART / Software Serial / SoftUart for ESP8266 to connect more than one UART

This library is very similar to the Arduino SoftSerial. It can be used to connect multiple GPIO's of the ESP8266 to UARTs.

Does this work with eps8266 Arudino?

No: If you want to use a library for Arduino with ESP8266 (https://github.com/esp8266/Arduino), consider https://github.com/plerup/espsoftwareserial

Hit there, I know it's been a while but I'm trying to do the same and having a problem with the software serial. My ESP8266 works fine alone without serial, as well when it's running software serial without wifi but when I try to combine both, it stops the wifi communication with computer. I’ve done this also for official ESP8266 Software Serial library, see this pull request. Note that this implementation is only for ESP8266 based boards, and will not works with other Arduino boards. To detect an unknown baudrate of data coming into Serial use Serial.detectBaudrate(timet timeoutMillis). This method tries to detect the.

This library is just a plain C library, which you can include in your esp8266 sdk code (or with some modifications even in your Arduino code).

If there are any problems, please add issues and pull requests!

How to use this example

  1. Download this code
  2. Edit Makefile and change the Paths to your location of the sdk and compiler
  1. run make clean && make
  2. connect your esp8266 in flash mode to your computer
  3. run make flash
  4. connect UART (e.g. of computer) to rx and tx of the esp at 9600 baud, you shoud see some dots '...'
  5. connect UART (e.g. of computer) like this: rx -> PIN 12, tx -> PIN 14 and you should see some output like 'oneoneone'
  6. connect UART (e.g. of computer) like this: rx -> PIN 5, tx -> PIN 4 and you shoudl see some output like '2222'
  7. start changing the example code

(Self-) Loopback is not supported!

When you connect a software tx with a software rx (wire from pin tx to pin rx), the rx will not receive the data because of timing issues.

If you use an external tx source, e.g. your computer, then rx will work (at least up to 38400 reliable).

How to use this code in your project

Downlaod code and include folder 'softuart' in your project

Minimal example of how to setup one Softuart and send and receive some data:

How to use multiple softuart

How to use RS485 support

This library can be used to send data over a RS485 interface. To convert the signla, e.g. a MAX485 can be used. The rx and tx of the MAX485 are connected to the rx and tx of the esp8266 softuart pins. The additional pin to enable tx on the MAX485 chip will be connected to another GPIO of the esp82666, e.g. 13.

Just add this code after the normal initialization: Softuart_EnableRs485(&softuart, 13);

Then every time when the softuart wants to send some characters, it first enables the rs485 send (control pin HIGH) and after the character it will disable it again (control pin LOW).

Example code:

Problems / Pull request

Please contribute to this project and add issues / pull requests when you find any problems :)

Based on ITEAD's library this library improves communication when using SoftwareSerial to comminucate between the Arduino and the ESP8266.

Free software serial no

We have modified the original library due to Software serial baudrate problems.Now, the init function, when using software serial only, will set the ESP8266 baudrate to 9600.

You'll need:

Esp8266 Arduino Serial

  1. ESP8266

Esp8266 Software Serial

See example usage in Firmware.ino

  • If you receive partial response from the esp8266 when using software serial -go to C:Program Files (x86)ArduinohardwarearduinoavrlibrariesSoftwareSerialsrcSoftwareSerial.hChange line 42: #define _SS_MAX_RX_BUFF 64 // RX buffer sizeTo: #define _SS_MAX_RX_BUFF 256 // RX buffer sizethis will enlarge the software serial buffer.
  • Sometimes setting the baudrate on initialization fails, try resetting the Arduino, it should work fine.
  • On some cases it might be necessary to flash the ESP's firmware. See Flashing the ESP

Esp8266 Serial Library

  1. Use a 3.3v FTDI board like this one
  2. Hookup the ESP to the FTDI
  3. Get the ESP8266Flasher
  4. Get the 1.1.1.1 Firmware
  5. Flash the ESP!

Released under GPLv3. View the license

Posted :