Go Down

Topic: Replacing Softwareserial by Altsoftserial (Read 402 times) previous topic - next topic

geologic

Hi all

I have a Uno connected to a ESP8266 to send a GET request to a webserver. I use softwareserial and wifiesp library like this:

Code: [Select]

WiFiEspClient client;
#include <SoftwareSerial.h>
SoftwareSerial Serial1(8,9);

  // initialize serial for ESP module
  Serial1.begin(9600);
  // initialize ESP module
  WiFi.init(&Serial1);

...

    // Make a HTTP request
    client.println(F("GET /sensor.php?id=1 HTTP/1.1"));
    client.println(F("Host: www.domain.com"));
    client.println(F("Connection: close"));
    client.println();

    //read HTTP response
    while (client.connected()) {
      while (client.available()) {
        char ch=client.read();
        Serial.print(ch);
      }
    }



The request is done and I can see the HTTP response on the serial monitor.
Now i want to replace  softwareserial for Altsoftserial so i made this changes:

//#include <SoftwareSerial.h>
//SoftwareSerial Serial1(8,9);

#include <AltSoftSerial.h>
AltSoftSerial Serial1;

I double check my wires, ESP8266 module is working, request is sent to PHP page but i cannot see HTTP response on the serial monitor.

If i put back softwareserial on code, it works ok.

Any ideas?



Juraj

#1
Feb 01, 2018, 07:44 pm Last Edit: Feb 01, 2018, 07:45 pm by Juraj
turn on some debug prints of the WiFiEsp library to see what is going on
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

geologic

Well, according to Altsoftserial author, this library doesn't work with ESP...

Juraj

NeoSwSerial is a little better then SoftwareSerial
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

fixit9660

Hi geologic.

I'm just about to do the same as you, try replacing softwareserial with Altsoftserial; did you get this sorted please?

Juraj

Hi geologic.

I'm just about to do the same as you, try replacing softwareserial with Altsoftserial; did you get this sorted please?
why?
You can't write an Arduino sketch if you didn't learn programming. Not the language, but the concepts of programming - algorithms and data types.

fixit9660

why?
I've replaced it because the comms are corrupted when using SoftwareSerial with an Arduino Uno to talk to an M590 Module. Comms are perfect when using Altsoftserial. It's not a logic level conversion issue, I've observed the perfect translation of signal levels in both directions using my storage oscilloscope. Similarly I've confirmed my supply voltages are all exactly correct with no noise/ripple, or drop-out due to too much current being drawn. Ive even used a different Terminal Emulator to send and receive AT commands. I've even tried varying the baud rates with varying degrees of success.

The only thing that makes any difference is changing from SoftwareSerial to Altsoftserial. I'd say that's pretty damning evidence.

Go Up