I was trying to use MQTT protocol based data logging on ThingSpeak website. My Final application will be based on GSM modem such as Quectel (or SIM900 module). But I wanted to understand the protocol well and try on PC before trying on embedded board, which may have more issues (such as current consumption and GPRS data loss/ drop). Hence I used Python script with socket programming to dump data on ThingSpeak. After some trials and big Thank you to Ravi, I am able to do the data dump. As a word of appreciation, I want to upload the python script on this forum so that others can help from it.
Link to my data dump: -
Please let me know if it is OK.
Thank you for posting and glad that the tutorials helped.
Sure, please go ahead and upload , People would love it. It might help someone.
Also if you have any tutorial suggestions, you can create a topic in the Suggestions category. I would like to work on it in my next slot.
Unfortunately, python or txt files are not allowed to be attached. What should I do?
Try again, i enabled .py and .txt extensions.
If there are other extensions i need to enable then let me know. I will enable them.
ThingSpeak_MQTT.py (2.7 KB)
Attached file works good with ThingSpeak website, data upload. The code is self explanatory with adequate comments. If you are already using python, you can take advantage of this file for following reasons: -
- You do not need to install and run other softwares (like Hercules).
- Hex, decimal, string conversion taken care by python, there are usually the palces where people makes mistake.
- Using the file gives you proper idea about MQTT protocol.
There are more scope of improvement, but this file takes care of basic MQTT.