Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:remotelab:sut:generalpurpose2:u8 [2019/08/11 08:11] pczekalskien:iot-open:remotelab:sut:generalpurpose2:u8 [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 54: Line 54:
 // MQTT messages // MQTT messages
 #define MQTTClientName ...<your client name>...          #define MQTTClientName ...<your client name>...         
-#define analogOutTopic  ...<some topic for flap>... // give it some unique topic i.e. including your name+#define analogOutTopic  ...<some topic for flap>... // give it some unique topic  
 +                                                    // i.e. including your name
  
 //MQTT last will //MQTT last will
-#define lastWillTopic ...<some topic for exposing state and last will>...   // give it some unique topic i.e. including your name   // give it some unique topic i.e. including your name+#define lastWillTopic ...<some topic for exposing state and last will>...    
 +                                                    // give it some unique topic 
 +                                                    // i.e. including your name 
 #define lastWillMessage "off" #define lastWillMessage "off"
 #define mqttWelcomeMessage "on" #define mqttWelcomeMessage "on"
Line 63: Line 66:
  
 == Step 3 == == Step 3 ==
-Declare WiFiCilent, PubSubClient, initialize, instantiate and connect to the network. If in doubt, refer to the scenario U3 on how to prepare networking code for your solution.+Declare WiFiCilent, PubSubClient, initialise, instantiate and connect to the network. If in doubt, refer to the scenario U3 on how to prepare networking code for your solution.
  
 == Step 4 == == Step 4 ==
Line 74: Line 77:
   if(client.connected())   if(client.connected())
   {   {
-    client.publish(analogOutTopic, String(flap).c_str(), false);  // Do not retain messages+    client.publish(analogOutTopic, String(flap).c_str(), false);  // Do not retain 
 +                                                                  // messages
   }   }
 } }
Line 96: Line 100:
 } }
 </code> </code>
-<note warning>Mind to keep a ''delay(...)'', not to saturate MQTT broker and communication channel. Minimum reasonable delay between issuing consecutive MQTT messages is about 100ms.</note>+<note warning>Mind to keep a ''delay(...)'', not to saturate MQTT broker and communication channel. Minimum reasonable delay between issuing consecutive MQTT messages is about 200ms.</note> 
 +<note tip>The ''flap'' variable is a global one, set in the ''mqttPublish'' using ''analogRead(A0)''. This way you have it set for ''sprintf'' formating function.</note>
  
 === Result validation === === Result validation ===
-Observe connection progress on the LCD via video stream. Once WiFi and MQTT are connected you should be able to see analogue input readings on the LCD and additionally those should be sent over the MQTT messages to the MQTT broker. Connect your MQTT client and subscribe to your messages (you may do it using a wildcard character) i.e. with means of the MQTT spy application. Remember to connect MQTT spy to public IP address unless you're a student physically present in our laboratory room and you have direct access to the internal.IOT network. Observe data on the LCD screen the same as over MQTT messages (note, there may be a delay because of the network bottlenecks and MQTT broker load).+Observe connection progress on the LCD via video stream. Once WiFi and MQTT are connectedyou should be able to see analogue input readings on the LCDand additionallythose should be sent over the MQTT messages to the MQTT broker. Connect your MQTT client and subscribe to your messages (you may do it using a wildcard character)i.e. with means of the MQTT spy application. Remember to connect MQTT spy to public IP address unless you're a student physically present in our laboratory room and you have direct access to the internal.IOT network. Observe data on the LCD screen the same as over MQTT messages (note, there may be a delay because of the network bottlenecks and MQTT broker load).
  
 === FAQ === === FAQ ===
-This section is to be extended as new questions appear. \\ +**I want to implement PID controller of the position of the flap, using TX air pushing node (VRELS 2 and 4). 200ms latency between consecutive reads seems too large, to implement efficient loopbackWhat to do?**: In this case, you should drop MQTT communication and communicate directly between nodes, i.e. your RX node (VREL1 and 3) can send a UDP message over the network. Our WiFi ''internal.IOT'' is a pretty efficient one, and should handle it with ease.
-When using the printed version of this manual please refer to the latest online version of this document to obtain the valid and up-to-date list of the FAQ. +
-//Provide some FAQs in the following form:\\ +
-**Question?**: Answer. +
-//+
  
en/iot-open/remotelab/sut/generalpurpose2/u8.1565511118.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0