<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93047/transmitting-data-to-mqtt-broker</link><description>Hi, I&amp;#39;m currently trying to send real time analog sensor data to hivemq broker using nrf9160 DK, is it possible to provide source code for this kind of project? I&amp;#39;ve attached my current code below as well. Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Oct 2022 09:23:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93047/transmitting-data-to-mqtt-broker" /><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/393174?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 09:23:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42d04f42-6480-4085-ab0a-10eb58e9bbe9</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;Hi, thanks for the reply! I have modified my code I managed to publish the data. But I am facing another issue which is the ADC pin reading data is not updating. I have posted my code and issue in another forum, could you give some advice on the code? Below is the link to the forum.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/93404/error-in-sending-adc-reading-to-mqtt-broker"&gt;Error in sending ADC reading to MQTT broker - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/393163?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 08:42:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7084cd2-4c11-4a3d-95d1-0bc10d7e62d1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What did&amp;nbsp;data_publish() return ?&lt;/p&gt;
&lt;p&gt;It will be printed in the log as &amp;quot;Publish failed: #err_code&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/393101?ContentTypeID=1</link><pubDate>Sat, 29 Oct 2022 07:47:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5571e54a-67be-48ff-a272-e5851532aa55</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;May I ask why this data cannot be publish (instead of string I am publishing integer)&lt;br /&gt;data_publish(&amp;amp;client, MQTT_QOS_1_AT_LEAST_ONCE, 123, 3);&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/393100?ContentTypeID=1</link><pubDate>Sat, 29 Oct 2022 06:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5ba155c-b426-44ca-9cc9-b1734d84a93e</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;it does not publish anything after u added the code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/393058?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 13:58:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48024a78-ad4b-4958-8b55-2ece42746fee</guid><dc:creator>Sigurd</dc:creator><description>[quote user="yeo"]I have added the code above in my function and I am still having the same issue.[/quote]
&lt;p&gt;And did you get any errors returned?&lt;/p&gt;
[quote user="yeo"]but the data_publich function require char form[/quote]
&lt;p&gt;No, it&amp;#39;s just a&amp;nbsp;&lt;span&gt;uint8_t buffer&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/392977?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 09:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2abe5a4f-f102-4e69-b358-63869004a1d8</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;Also, the data I am currently getting is in integer form, but the data_publich function require char form, may I know how to convert integer to char?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/392975?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 09:26:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f52672-2c94-4ec2-8a90-1108b03232f3</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;Hi, I have added the code above in my function and I am still having the same issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/392712?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 21:38:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86a07794-abd6-49b4-a798-9b8115b82948</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;I see you have this line in adc_sample_event().&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;data_publish(&amp;amp;client, MQTT_QOS_1_AT_LEAST_ONCE, &amp;quot;test!&amp;quot;, 14); &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You should check the return code of the function, see the snippet below. (and also 14 is not the&amp;nbsp;correct length of the string you are sending)&lt;/p&gt;
&lt;p&gt;Snippet:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;		int ret;

		ret = data_publish(&amp;amp;client,
				   MQTT_QOS_1_AT_LEAST_ONCE,
				   your_data,
				   length_of_your_data);
		if (ret) {
			LOG_ERR(&amp;quot;Publish failed: %d&amp;quot;, ret);
		}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/392428?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2022 14:09:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d5a6248-4b32-4f53-9400-7ff25c54573f</guid><dc:creator>chow</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi, mqtt_simple example to publish my data out. I am including data_publish function to sent out the string &amp;quot;test&amp;quot; if my data is being collected and shown in the terminal. However, I am not able to publish the data to the broker. I am including the data_publish function in adc_sample_event and I am using a timer to call the function. The modification can be seen from line 614 onwards. Can i get some advise from this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqtt_5F00_simple_5F00_sensor-_2800_2_2900_.zip"&gt;devzone.nordicsemi.com/.../mqtt_5F00_simple_5F00_sensor-_2800_2_2900_.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/391881?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 12:17:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95a0cc55-819f-486f-bf8a-3e0897549f9c</guid><dc:creator>Sigurd</dc:creator><description>[quote user="chow"]Do you have any example that sends the sensor data to mqtt broker?[/quote]
&lt;p&gt;We have, as you have likely already seen, the&amp;nbsp;mqtt_simple sample.&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/samples/nrf9160/mqtt_simple/README.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/samples/nrf9160/mqtt_simple/README.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Use the function&amp;nbsp;&lt;span&gt;data_publish() to send/publish the data to the MQTT broker.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/391866?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 11:46:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a353a4c1-d68f-4a33-a4a4-b0e170c38b66</guid><dc:creator>chow</dc:creator><description>&lt;p&gt;&lt;span&gt;We are currently connecting a sensor to nrf9160_dk and we have successfully gotten the data and print them on serial monitor. We have also succesully connected lte link to print simple string on mqtt broker(hivemq) by using the mqtt_simple sample source code. So we are trying to send the data from the sensors to the mqtt broker but we are unable to do that. Do you have any example that sends the sensor data to mqtt broker?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting data to MQTT Broker</title><link>https://devzone.nordicsemi.com/thread/391604?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 10:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef970295-1e71-4eb3-a0d8-e0fd9cd0c0e6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]is it possible to provide source code for this kind of project?[/quote]
&lt;p&gt;What do you mean by this? Could you explain some more?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>