Your current wiring diagram has some problems…
-
you’re attempting to power the SIM800 via the 3v3 pin on the NodeMCU. You can’t do this, as the NodeMCU can’t provide sufficient current on this pin to power tge SIM800 in transmit mode.
-
you’ve connected the SIM800 to tge Tx and Rx pins on the NodeMCU. These are the same pins that are used by the serial interface connected to the USB port, which are used for uploading firmware and for debug messages. This is the HARDWARE serial port, and it already exists.
You need to create a SOFTWARE (virtual) serial port which used different pins, so that the NodeMCU can talk to the SIM800 without the communication being messed-up by debug data being sent to the serial monitor. -
You’ve connected the Tx pin on the NodeMCU to the Tx pin on the SIM800 and the same for the Rx pins. This isn’t how it works. When your NodeMCU is transmitting data to the SIM800 the SIM800 listens for that data on the Rx pin and vice-versa. You have to connect:
Tx —> Rx
Rx —> Tx
Obviously this will be the SoftwareSerial Rx and Tx pins on the NodeMCU, not those pins labelled Tx and Tx on the board.
Now for your code issues…
As already discussed, these need to be different pins.
I very much doubt of your SIM800’s default baud rate is 115200. However, as you’ll be connecting it to a SoftwareSerial power which is relying on the processor to emulate a COM power, this baud rate needs to be lower. The NodeMCU is good for baud rates up to about 38400 when using SoftwareSerial, but the important thing is that the NodeMCU and the SIM800 are talking to eachother at the same baud rate. If your SIM800’s baud rate I’d higher than 38400 then you’ll need to reconfigure it, probably via an AT command.
I’d increase this to at least 5 seconds (5000ms) if you’re using the DHT range of sensors.
Is this really the APN for your SIM card?
I’d suggest that you read this to understand more about SoftwareSerial etc…
Pete.