Hey, let me be clear, I am completely new to arduino and this stuff and for my project, I wanna setup ESP 01 as a AP for my mobile to connect but im having trouble with just the initial AT to get my esp to respond with ok.
Imma provide the tutorial I am following as well as link to my parts.
Disclaimer: my UNO is not original but is working fine. I suppose the problem is with the Connection of the TXs and RXs of the module and Board. Also i have installed the esp8266 esp01 board json from the github into my IDE.
The pinout and connections are given in step 2 and I followed everything till that point clearly.
The problem I encountered was when I tey to use the AT command in the serial monitor, it just returns 3 black and white question marks in a diamond shape which likely means a bad character and the next AT commands add that b.char to the previous ones in a line. If anyone requires a ss, let me know.
Also, was I supposed to write any code as the article noted to only load the bare minimum. If that is where im wrong, I am extremely sorry in advance and thank you very much for your help.
Then please reproduce the wiring diagram or better yet the schematic here, and please also show a photo of your actual setup that shows how everything is connected in real life. We can take your word for your having everything connected correctly, but here we are with your project not working, so let's start verifying the basics first.
Or it means you've got the baud rate set incorrectly for the ESP8266 module. What baud rate is your serial monitor set to? Does it correspond with what the ESP8266 is sending? Note that the ESP8266 cannot query your serial monitor for the correct baud rate. It just spits out its response regardless if it's at the right speed. Conversely, your serial monitor throws data at the ESP8266 regardless if the latter reads it OK. The baud rate on both sides therefore needs to match for this to work.
Any code that doesn't use 'Serial' or pin 0 & 1 on the UNO will do, i usually use 'blink' because it is then fairly clear to see what is actually running on the UNO.
That schematic omits the voltage divider on the ESP-RX line exposing it to 5v logic level which can and at some point will damage your ESP-01. The pins are not 5v tolerant regardless of information you may find that states otherwise.
All in all, set the baud-rate in the Serial monitor to 115200 and set the line-ending to Both NL & CR, and that should do the trick.
Please do add the voltage divider on the UNO-RX -> 1K -> ESP RX -> 1K -> 1K -> GND to reduce the logic level to a safe 3.33v
Sorry but I can't speculate Baud Rate being the issue as i also thought that since the tutorial was following on 9600 but i read somewhere that the default rate is 115200. I checked for both.
I cant exactly remember but onky one of the gave me output and those where the bad chars.
As for @rsmls sorry for not including the project picture. I will set everything and try again. If the problem persists, i will post a pic or two here of the setup.
mikedb , i mentioned that i have not written any code except for the empty setup and loop but i will try with serial begin too, thanks for that.
@Deva_Rishi i couldn't actually understand. I checked 4 to 5 times before connecting to power that i have 3.3 v because i know very well it can fry my esp. I couldn't understand what u meant by line ending , NL and CR, please explain it.
As for last voltage divider you mentioned i suppose its to safeguard against accidental 5v connections?
Regardless thank you for replying i will let you guys know here if things work out.
In the Serial monitor at the bottom next to Baud Rate setting there is another setting. There are 4 options and you need to choose 'Both NL & CR' . The ESP expects a NL & CR at the end of every command or it will not respond at all.
The default is 115200. The ESP also puts out a boot message at 74880, most likely the characters you see are the result of that.If you want to see that boot message, try switching the baud rate to that, and reset the ESP. The ESP will not respond to it though.
That will only disturb things more and can do damage to the ESP.
Good. Well there are cases where an the 3.3v coming from the UNO can not provide enough current. Usually on clones. Particularly during WiFi connection stage this can show up. I have been using my original UNO for years without issue though.
No it isn't. It is to protect the ESP against the 5v Logic level that the UNO uses. The UNO has an onboard USB to TTL converter (an Atmega 16U2 is being used for it), We disable the Serial connection on the main MCU (The Atmega 328p) simply by not using it. The TX line of the ESP sends data from the ESP to the 16U2 using 3.3v logic levels, which can easily be interpreted by the 16U2 although that is running at 5v. The 3.3v HIGH is enough.
In the opposite direction the 16U2 sends data to the ESP-RX using 5v for HIGH and 0v for LOW. This is what you have to protect you ESP from. That is what you need to reduce to 3.33v. There is nothing accidental about the connection, it's intentional, and your ESP may break at any time (or keep running for years..)
Here are the Images Of my Work done with connections, Again I double checked it while assembling. And I got it. Turns out @Deva_Rishi Thank you for your suggestions
This was the Problem apparently. I need to set NewLine to NewLine and Carraige Return.
Thank you mikedb and rsmls too for helping out.
For any future devs trying having a similar problem like mine, check the serial monitor properly. I will attach one here for your help.
(Also, is it okay for a esp to heat up quickly? You dont have to answer that. Deva_Rishi I will mark your suggestion as the Solution. Again I thank others for helping out too.)
No it isn't ok, a little warm maybe, but not hot. Add the voltage divider as specified (use 1k resistors as higher values tend not to work so well)
As for future plans, this is also the connections you should use to upload your own firmware to the ESP (with the addition of a connection between GPIO 0 & GND at boot) Which will overwrite your current AT firmware of course, but it will be a lot better that trying to control the ESP using AT-commands, from the UNO.
Ok thank you for that just to make sure once again, I should route my UNO RX through a 1k res to the ESP RX and then? Route my ESP RX through 2 1k res to GND?
Also for my future (curently) the only thing I need my esp01 to do is send a message like "this is a message dipshit" or something to my ph through AP connection and I will be later buying a Proper NodeMCU board for serious future projects.
For the Uno to 'talk to' the ESP, the UNO TX will need to go through a voltage divider to the ESP's RX. The ESP's TX should go through a voltage level translator to the UNO RX. You may get away with omitting the level translator on this line.
TX = transmit, RX = receive. So logically, what the Uno transmits (TX) needs to be received (RX) by the ESP.
Also that could more easily be done with your own firmware, but AT-commands will suffice i suppose. Thing is that you will need to instruct your ESP every time you power it up.
An ESP-01 is quite powerful , contains the same MCU as a nodeMCU, just not all pins are exposed and there is less flash memory available (though chances of running out are small for a while) If you don't need more pins an ESP-01 will do for most applications.
This is something that is not covered in the tutorial you linked. You can also make the UNO communicate with the ESP. Then the TX & RX lines should be swapped, but you will not have the USB serial monitor available anymore. There is a way using swSerial, but i do not support this. It is just to 'clunky'
although arguably, the functional requirement is described in a somewhat vague manner. I interpret it as "I want my Arduino to send a simple message through the ESP01."
That is possible, but so far there has been no mention of it and the tutorial that was linked does not explain how to do this. Just direct communication between the Serial monitor and the ESP is described and explained.
Because it is inefficient. The ESP processor is much more powerful than an AVR, So why to use a slow MCU to control a fast one ? Not only this, the limitations regarding webpages on the ESP when using it like that are defined by what you can store on the AVR (read UNO, Nano etc) while the ESP itself has 80KB of RAM and 1MB of flash, and runs at 80 or 160MHz, compared to the 2KB RAM & 32KB of flash of an UNO, that can run up to 16MHz. The UNO has more pins, but if i'd need those, i would rather have the ESP query the UNO than trying the UNO to control the wifi output of the ESP. Most people actually use the ESP the way it is intended, simply as an MCU with WiFi, and get a version with more exposed pins when they need them.
On top of this, if people use it the way you suggest, they tend to use an UNO, which has only 1 hwSerial port, and end up resorting to swSerial which only compounds the issue. Then you first have to switch the ESP to 9600kbps before you can sort of reliable receive what it sends.
So I do not support it. It is like riding a horse in front of a car, to pull and guide it, even though the car has a much bigger engine and much more space and can easily drive without the horse.
I Have had systems where i use an ESP as a UI to control an AVR, but then i upload firmware with webpages to the ESP and get the AVR to perform tasks for it. Still clunky, but better than the other way around. Using more than 1 MCU is usually a complication that should be avoided, even if it is just for the complications of the communication between them.
OK, we're on the same page. I was wondering if there was a 3rd party that somehow discouraged the approach I mentioned, but it's your personal viewpoint. Which, btw, I mostly agree with. However, if you extrapolate that viewpoint, the ESP01 module as such is kind of a dead-end street. It's an in itself capable ESP8266 but with all its useful GPIOs not broken out to the outside world.
Seriously ? No it's not. I use it as a Ledstrip (Ws2812b or simple RGB leds) controller, i can control relays with it, there is quite a few other protocols it can send and or receive, and many application do not require more than a few GPIO pins, and it has 4, mind you with some limitations. (GPIO 0, 1(tx) & 2 should not be pulled LOW during boot) The UART pins are exposed, and connecting a sensor is usually not such a big deal unless it requires the ADC. But swI2C can be made to work. One of the limitations is the power requirements and the lack of an onboard voltage regulator, which with the current draw during WiFi connection can be an issue, but certainly not a dead-end street in my opinion.
I am making a fire fighting robot for my School Exhibition but the tutorial I am following does not include any Networked Alert and I read about ESP01 for another proj a while back so I decided to order both the UNO and the esp together to bring somewhat functionality to My project.
My project is a fire fighting robot btw. I get it, not so original and most of the tutorial on youtube only include that part. I wanted to add something extra so I thought of including the esp inorder to connect it through my phone somehow (Its called soft AP i realized later) and send a kind of message or warning that a Fire and is detected and moves the car/robot as intended but yea, the message part is the only thing I am gonna use this esp for atm for now.
OK, thanks for giving some context.
To clarify the issue I raised: so you can confirm that your intention is indeed to connect the UNO and the ESP together, so that the UNO can use the ESP to issue an alert over WiFi?