I'm a new user of NodeMCU and I would like to make it communicate with a GSM module like SIM900. Can I use the second UART terminal of ESP8266 to interface with the GSM module?
Thanks.
The GSM Sim900A module 3.3V TXD pin is connected with the Nodemcu RX pin, the 3.3V RXD pin is connected with the Nodemcu TX pin, while the ground pin of the GSM Sim900A module is connected with the ground pin of the Nodemcu ESP8266 Wifi Module.
ESP8266 is a world phenomenon microcontroller for bringing WiFi connectivity for things (IoT). It's a fully integrated chip with, among other cool things, wireless and UART interfaces. We can use this microcontroller for sending AT commands to a GSM module.
I wrote a tutorial how to do it: http://atcommander.io/Tutorials/Name/ESPInterface
As cagdas said, essentially you use UART0 from ESP8266, remembering to switch its pins assignment to GPIO13/GPIO15 with uart.alt(1);
in NodeMCU.
To receive debug messages in your computer, you won't be able to use UART0 anymore, but instead you can use UART1 from ESP8266 which is transmit only.
Yes you can. The second serial interface has bounded on gpio 13 (rxd2) and 15(txd2). You can switch to control them via these commands on lua:
uart.alt(1);
uart.setup(..);
So your code gonna be look like :
uart.alt(1) --use alternative gpios
uart.setup(0, 9600,8, uart.PARITY_NONE, uart.STOPBITS_1,0)
uart.on(...)
uart.alt(0) --switch back to standard Rx/Tx pins
Here is the doc for nodemcu uart usage.
If you gonna use arduino, you can use SoftwareSerial library to config any gpio as serial interface like below:
SoftwareSerial mySerial(16, 5); // RX, TX
mySerial.begin(9600);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With