Lab 33. MQTT Control Loop

The goal of this lab is to build several control loops: heating up a mote causes the LED of another mote to switch on, over the Internet

Create sensors/actuator pairs

  • list the MAC addresses of the motes you have which can act as :

    • a sensor

      • temperature sensor

      • jumper wire to act as a switch

    • an actuator

      • an LED that can be switched on

      • a buzzer

Answer 1:

Your instructor will coordinate that activity so everyone can see the entire list

  • form [sensors → actuator] pairs. What role is your mote playing, with what other mote?

Answer 2:

Flow 1: subscribe to everything

  • create a first flow which subscribed to all notifications with topic dustacademy/#

In MQTT, # is the wildcard: subscribing to dustacademy/# means you receive all messages published to dustacademy/foo and dustacademy/bar (and to dustacademy itself)

Flow 2: send mote data to broker

  • create a second flow which publishes all "oap" notifications onto the MQTT broker, using MQTT topic dustacademy

  • Draw your flow, indicating the configuration details of the nodes in your flow (including any code):

Answer 3:

  • once everyone is done, make sure you can see data from all motes appearing on the MQTT broker

  • modify your second flow to publish on topic dustacademy/<mac> where <mac> is your MAC address

  • what code did you use?

Answer 4:

Flow 3: trigger actuator

  • create a third flow which prints the temperature of the other mote in your mote pair

  • Describe what you did:

Answer 5:

  • On the actuator mote side, modify your third flow so the actuator (LED or buzzer) toggles on/off depending on temperature

  • describe your changes

Answer 6:

Challenge!

  • we want to be able to trigger your actuator by sending an MQTT message to the broker using your mote’s MAC address

  • Describe your design and implement it:

Answer 7: