A post in "MQTT TCP connection getting closed using SIM800 with PIC18F4620" requires staff attention

Just I want to know that,In your video about arduino coding,have you used add any header file?

Yes Ravi. I increased some delay. Now am getting correct output from transmitting side. But from receiving side,there is error after AT+CIPSEND

I have used your coding and saw the output. But at the receiving side,Error was coming. Then I have changed the loop as I have attached. But TCP connection is getting closed.
Please help me.

You should put a large delay before loop starts. As you can see in your screenshot, you are sending AT commands too early and module is still in initialization state where it prints CALL READY, SMS READY URC.
You should wait for a long time until you get these URC when module boots up or Arduino execution starts.
Check for module response whether it replied OK or error. Use Libelium library for sending AT commands. Dont directly use what i have showed in video. Its for demo only and needs further tune up to implement in a final project.
P.S : Please don’t flag and post in forum only. Mails are not answered.

Thanks for your kind support Ravi.
Now am getting correct output.I am able to send message to cloud server.
But still I am facing 2 problems.

  1. I can receive message only 1 time. If I want to receive the message agian I need to reset Arduino board.

  2. I am unable to receive the message from cloud.Only One way communication is going on.

Thank you so much!

Sukanya, Glad that it worked. :slight_smile:
You need to put the SendPublishPacket in loop so that it keeps sending repeatedly.

Hi Ravi,

Now am getting continuous data on server.All problems got solved.But last problem is that I am unable to receive the data from server,
I tried to put subscribe packet in loop.But then also no effect.
Could you tell me please which changes I need to do for getting the message from cloud to arduino board?

Hi Sukanya,
Glad that you got it working. :slight_smile:
Subscribe packet needs to be sent only once. Send a connect packet and send the subscribe packet and just wait and send ping packets to keep connection alive.
Observe the packets and communication data and tell me whats happening exactly.

My code.docx (17.3 KB)

I have attached my working code.Could you tell me what changes I need to do??
I am getting confused because I tried by doing so many changes in it!

Thanks!

Are you connecting to CloudMQTT or Adafruit?
The feed name should be used in place of TOPIC. You are using your name with Space in between. I think it is not correct. Also code will not help. You should post the transaction between modules with UART data captured.

I am using cloud MQTT server.
Even if I will remove the “char AIO_TOPIC[] = “CRISP”;”,then also I am getting the output

Use the sample subscribe packet as shown in my video. Its really very simple. You must be doing some mistake in forming packet. You need to check the data log between module and UART by tapping the lines.

If I will use the code as shown in your video,TCP connection is getting closed immediately.
I have attached the code as per shown in VIDEOCode 1.docx (11.2 KB)

And showing the ERROR while passing the AT commands

This code you sent is for publishing and it doesn’t call Subscribe packet. Please check.

Need the guidance about MQTT arduino code with SIM 800