4

It's the first time I use an ESP8266 and I didn't manage to get a proper response in the Arduino serial monitor. I only see weird characters, when I move the 3.3V wire.

You can see the connections in the following picture:

enter image description here

The code I run is the following one:

#include <SoftwareSerial.h>
SoftwareSerial BT1(3, 2); // RX | TX

void setup()
{
    Serial.begin(115200);
    BT1.begin(115200);
}

void loop()
{
    String B= ".";
    if (BT1.available())
    {
        char c = BT1.read();
        Serial.print(c);
    }
    if (Serial.available())
    {
        char c = Serial.read();
        BT1.print(c);
    }
}

Maybe it's something really stupid. I am a total beginner, so I appreciate any help.

EDIT: I think power supply is 3.3Venter image description here

SOLUTION: the problem was the power supply. I tried exactly the same using the 3.3V from the arduino instead of the power supply and it works perfectly!

  • 1
    where is the logic level shifter? – Juraj Sep 13 '17 at 09:52
  • @Juraj ESP8266 GPIO pins are 5V tolerant. – gre_gor Sep 13 '17 at 13:49
  • You might want to put the breadboard power supply on the other end, so the + an - markings actually match and doesn't look like you just shorted everything. – gre_gor Sep 13 '17 at 13:51
  • Also that breadboard might have a split in the middle of the side rails. – gre_gor Sep 13 '17 at 13:56
  • Do a sanity check, connect pin 2 - 3 and see if the Arduino terminal echo back a char that you send. – MatsK Sep 13 '17 at 17:43
  • @MatsK do you mean take off all the wires and connect ports 2 and 3 of arduino with the same code? Sorry for the beginner question! – Alberto Carmona Sep 13 '17 at 20:36
  • I found the problem. It was the power supply. I tried the same with the 3.3 V from the Arduino. I´ve read that this is not recommended. Is there something extra I need to connect in order to avoid any problems? – Alberto Carmona Sep 13 '17 at 20:54
  • Nice that you found the problem. But what I mean is by removing the wires from pin 2 and 3 on the Arduino and place a jumper directly from pin 2 to pin3 on the Arduino will verify that the softserial is working. – MatsK Sep 14 '17 at 01:05
  • These are probably really stupid questions. 1. From the picture it doesn't look like the Arduino has any power? Does it have power and is it 5v? I had one of these power boards and it required 12V input to generate 5v and 3.3v. If I gave it 5vIn it gave me 3.3V and 1.8V out. Is your 3.3V really 3.3V? – Code Gorilla Sep 14 '17 at 10:02
  • I believe the reason you are not supposed to run the ESP off the Arduino is you might exceeded the current that the Arduino can supply, which will cause the ESP to reset. The biggest current draw will be when the radio is transmitting, so you might get away with it. – Code Gorilla Sep 14 '17 at 10:04
  • In this website it is explained in step by step how to give connections and how to flash esp8266 to avoid garbage values 1. To flash ESP8266: https://mybtechprojects.tech/microcontrollers/esp8266/flash-esp8266-with-arduino/ 2. To connect esp8266 with arduino: https://mybtechprojects.tech/microcontrollers/esp8266/interface-esp8266-01-with-arduino/ – Gowtham S Jan 07 '18 at 11:24

2 Answers2

1

You may well have killed the ESP by supplying it 5v, you have to have a logic level shifter, as Juraj says.

Assuming it's not dead then your next problem is there have been posts about that hardware setup and SoftwareSerial doesn't work at high speed. I can't tell you what it is that doesn't work because turning the speed of the link cures the problem, try 9600 maximum.

[Edited to be less accusational, which was not the original intent]

[Update]

Please see the datasheet here: https://www.mikrocontroller.net/attachment/231858/0A-ESP8266_Specifications_v4.pdf

The table in section 8.4.4 says that the maximum input voltage is 3.6V Just after that it says all digital pins are "protected from over-voltage with a snap-back circuit". This snap back voltage is typically 6V. So does that mean the GPIO are safe up to 6V?

(It might be that this datasheet has been superseded, I am unable to access the EspressIF site at the moment).

Code Gorilla
  • 5,637
  • 1
  • 15
  • 31
  • 1
    To me, it looks like the jumpers on his power supply are set to 3.3V. – gre_gor Sep 13 '17 at 13:54
  • SoftwareSerial: 115200 is valid. Ref.: https://www.arduino.cc/en/Reference/SoftwareSerialBegin – MatsK Sep 13 '17 at 17:41
  • I´ve edited the post with a picture of the power supply. I´ve also tried changing the code to 9600 but still not working. – Alberto Carmona Sep 13 '17 at 20:13
  • 1
    @MatsK - Sorry I worded that badly. I have seen plenty of comments on here about comms between an Arduino and ESP failing at high board rates when using Software Serial. I didn't mean to point a finger :) – Code Gorilla Sep 14 '17 at 10:05
  • @gre_gor - Are the Tx and Rx pins on the ESP 5v tolerant? I know they are on NodeMCU type boards, but I don't know on the bare board. – Code Gorilla Sep 14 '17 at 10:06
  • 1
    No problem @CodeGorilla, I think the politically correct is to say"To use higher baud rates with Softserial isn't recommended!". – MatsK Sep 14 '17 at 10:52
  • 1
    Regarding 5volt tolerant or not, this is a quite comprehensive article about it, https://hackaday.com/2016/07/28/ask-hackaday-is-the-esp8266-5v-tolerant/ – MatsK Sep 14 '17 at 10:54
  • 4
    @MatsK - That's long :( So in summary the official data sheet says that the GPIO pins work at 3.3v Max, an unofficial early datasheet reportedly says 5v, some people say 3v, some 3.6v, some 5v and one thinks it could be 6v. There is a Facebook post reportedly from the CEO that says 5V (but I can't see this). Personally I will stick to using level convertors, because an ESP may only be $2 but a lvlconv is only $0.2. BUT don't use 5V for the power, that will smoke the flash chip. :) – Code Gorilla Sep 14 '17 at 12:37
-1

Step 1: Turn On Your ESP8266 Module by Using Arduino Nano 3.3V Dc Output Pin. Remeber sometimes Arduino board is not delivering sufficient voltage to the ESP8266 module. You can use a 3.3 V ( Do not exceed input voltage from 3.3v) regulator ( AMS1117 ) to power this module. A voltage divider circuit is used to drop the Arduino 5V to ESP8266 3.3 V.

Step 2: Here is the schematic Diagram, in my code I used Digital pin 2 as a Tx and D3 as an RX. enter image description here

Click Here for Necessary At Commands

Abid Jamal
  • 59
  • 4
  • I think you mean the 3.3V may not supply enough CURRENT (voltage is fine) for the ESP8266, especially if you try to use the WIFI on it. – Code Gorilla Feb 10 '18 at 12:28