1 Reply Latest reply on Jan 16, 2020 12:21 AM by ZhengbaoZ_96

    MQTT client on AP

    EyLa_3227556

      Hi,

       

      We are about to begin developing a portable WIFi based IoT sensor. Occasionally the sensor wakes up and transfers some data to the cloud.

      Two use cases should be covered:

      1. Where there's WIFI coverage - the device connects as STA and runs MQTT client. This is a straightforward case; and
      2. If there's no WiFI, the device uses the user's smartphone (Android/iOS) as a gateway to the cloud.

       

      What are my options in case #2?

       

      Is the following feasible/reasonable approach:

      • The IoT device wakes up and tries to connect to its 'known' AP
      • If it can't find any it switches to AP mode itself and waits for a smartphone to make a connection to itself.
      • The IoT device (acting as AP) runs MQTT client while the smartphone runs MQTT broker that in turn relays the messages (as an MQTT client) to the clout MQTT broker.

       

      Can the above work? Can the AP device be also an MQTT client and initiate transfers to smartphone/gateway MQTT?

       

       

      We thought about another approach of using WiFi Direct to communicate with the smartphone. However, if I understand correctly, WiFI Direct is not supported on the iPhone...

       

       

      Other ideas are welcomed.

       

       

       

      Many thanks in advance for any advice.

        • 1. Re: MQTT client on AP
          ZhengbaoZ_96

          Hello:

           

          If it can't find any it switches to AP mode itself and waits for a smartphone to make a connection to itself .

          I think this process is very normal and easy to have a role switch in the code .

          For Mqtt client running on STA mode or AP mode, I think the device normally runs as STA mode to connect with a AP which can ping internet successfully.     I think your smart phone should run as  a Hotspot to make the connection stable.

          about relaying the messages (as an MQTT client) to the clout MQTT broker  it sounds reasonable to me.

          1 of 1 people found this helpful