1

I have with me an Arduino UNO and an ESP8266 (12E) WiFi Module. I need to make a webserver using the two. I read that the default baud rate for ESP8266 is 115200, and that the software serial pins can't handle such high speeds. I dont have an USB-UART converter at hand. Is there a way to use my Arduino as one to change the baud rate, so that I can interface with the chip using the software serial pins of the Arduino later.

  • if you have an uno you don't need a usb-uart; just rx-tx, tx-rx, g-g, uno's rst-gnd – dandavis Mar 19 '17 at 23:35
  • @dandavis Okay. In that case on which pin should I connect the voltage divider to reduce the logic levels to 3.3V? – sixter Mar 19 '17 at 23:39
  • you don't actually need one just to flash an ESP, but you would "stepdown" the uno's TX pin for long-term connectivity, the 5v-tolerant ESP's pins put out enough for the uno w/o modification. using a red LED instead of a wire for the uno's TX to the esp's RX suffices. – dandavis Mar 19 '17 at 23:42
1

Use SoftwareSerial library for your module and define your own tx and rx pins like this and then you can define baud rate for your specified serial pins.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(8,9); // RX, TX for your module
void setup(){
   mySerial.begin(115200);
}

for more details visit https://www.arduino.cc/en/Reference/SoftwareSerialBegin

  • But from what I heard, SoftwareSerial doesn't support such high baud rates. – sixter Mar 19 '17 at 16:38
  • go to this link arduino.cc/en/Reference/SoftwareSerialBegin – Tanmay Yerunkar Mar 19 '17 at 16:40
  • Yeah, okay. It says it's supported. Thanks. It seems there's a lot of misinformation on the internet. – sixter Mar 19 '17 at 16:41
  • SoftwareSerial can't receive reliably at higher than 9600 baud, but it can transmit reliably enough for you to command the ESP board to change its baud rate to 9600. From then on, use SoftwareSerial at 9600 baud. – JRobert Mar 19 '17 at 21:39
1

You can use this block of code in Arduino to set baud rate...

void setup() 
{
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {}

Change value in serial.begin() as per your value.

0

You can use the SoftwareSerial library and define your own tx and rx pin and set baud rate according to your requirement.

#include <SoftwareSerial.h>   // SoftwareSerial library
SoftwareSerial mySerial(2,3); // RX, TX for your module

void setup()
{
   mySerial.begin(9600);      // Set your buad rate
}

And you can also do without this library.

void setup()
{
  Serial.begin(9600);        // Set your baud rate
}

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.