Hello everyone!
It can be said that i am pretty new to Arduino and hardware as it is. Guys, I need your help!
Short background:
I decided to do an IoT project for school that measures the gas concentrations with MQ-XX sensors, then sends the data to ThingSpeak or database in order to be stored and analyzed... (Not the point of this topic)
However I decided to use Arduino Uno and I needed a Wi-Fi connection to send the data (obviously). I bought an ESP8266 NodeMCU: (At the time I did not know that it can be used as micro-controller itself and is even more powerful than ArduinoUNO)
But that does not matter right? it can be still used as just a Wi-Fi Module?
I am having a very HARD time wiring up the nodeMCU and Arduino together. Looked on every possible website but nothing eventually helped.
So you have a clear picture, this is my hardware and how I tried to connect it in the first place.
Everything works, except the communication between NodeMCU and Arduino.
I even flashed the NodeMCU with AT commands (It was flashed with NodeMCU firmware).
Now, when i connect to the NodeMCU directly with USB, I can send the AT commands through serial monitor and it works (I can even connect to my wifi...)
But because I want to use it just as a Wifi Module, I want to talk to it via Arduino Serial communication (Send AT commands via Arduino for example) And THIS does not work.
I tried several connections, as on one website it was said to connect tx-tx and rx-rx and on another tx-rx and rx-tx. In another example someone used a level shifter. I bought one but it did not work with it as well.
Is it possible that I am using too much hardware and Arduino cannot power the ESP8266?
You have a nodemcu. It's not programmed with the AT deal, so that tutorial is not applicable. The nodemcu is programmable via the arduino IDE.
Focus like a laser beam on communications (hello world from nodemcu turns on uno LED; goodbye world turns it off).
That's right. Early projects were a nightmare because the esp (a 3.3V device) has to be connected to something like an Uno (a 5V device), which requires level shifting, the esp has to be powered correctly, often requiring extra voltage regulator circuitry, and then there are the difficulties of communicating between the Arduino and the esp, which is done with serial communications, and most Arduino have only one hardware serial port which is dedicated to sketch upload and serial monitor, so software serial had to be used instead, bringing it's own problems, and then there is the AT command set which is not easy to use...
Then there was a breakthrough that made everything so much easier. Some clever guys worked out how to use an esp as an arduino, so you didn't need an Arduino as well as the esp. all those problems above went away.
It's still not perfect. Esp are 3.3V device and some sensors and displays are only compatible with 5V, but you can usually avoid those and find 3.3V compatible replacements. And esp only has one analog input. But there are ways to add more, for example using analog multiplexers or i2c modules to add more analog inputs.
My suggestion would be to remove the Uno and program the esp directly with the Arduino code. Because you need 3 analog inputs for your sensors, get an ads1115 module, or maybe a 74hc4051.
You need to think about power for those gas sensors. They contain heaters, so can consume a lot of current. Why are you using 3 anyway?
Thank you so much for your answer and suggestions!
I am afraid I cannot afford to change hardware and speculate how to interface it from the beginning. I am very short on time
Because they detect different types of gases and I wanted the values to "calculate" the Air Quality index.
But is there a way how to do it with the hardware I have? So you are basically saying that the arduino is "exhausted" and is not able to provide enough power to the esp?
You are right! I missed it. Thank you! I tried it once but it did not help. Fortunately, now it works!
However, I had to connect the ESP to my laptop via usb. Now I am using the code from the tutorial I mentioned above and opened two instances of Arduino IDE to see both serial monitors. It works (see screenshots)
I tried a direct connection from Vin to 5V of Arduino. I also tried a direct connection from 3V3 (NodeMCU) to 3V3 of Arduino. It seems that the nodemcu does not receive any power.
Should the GND, RST and EN pins of the NodeMCU be wired? and how?
I just have GND to GND but i am not sure with the other two