MQTT newbie - broker and client in one?

I could use help understanding MQTT please. I was using my photons with apps I created in Blynk but migrating to the new Blynk will not work for me so I am looking for other alternatives. I need a solution for apps on iOS so Blynk was easy. I am interested in using Ignition Maker Edition to create mobile apps which will have to run on a server. I’m trying to figure out the best way to connect my photon boards over the web to an Ignition server. I think MQTT is the answer but if I understand it right I will need an MQTT server running local to my photons which means another light weight server to operate.

What I want to ask is can I run a lightweight broker on my photon along with my code so that I don’t need separate hardware running the broker? Basically each photon would be its own broker.

If I’m mixed up about how all this works or if there is another way to accomplish this please set me straight.

I think you can only run an MQTT client.

But before we get into MQTT, would it be possible for you to describe what you have in Blynk today?
Maybe there is a simpler solution than mqtt, like Ubidots.
Best

I use Blynk because I was able to create and app that I can run on my iphone. Blynk then provided a cloud service that passed variables between the app and my photon running the blynk library. I’m looking for an alternative way to accomplish both of these task. An HMI scada software package called Ignition I use has an app that will run on iphone which I can create my custom app in. There are many ways to then connect Ignition to devices but I’m not very knowledgeable when it comes to connecting devices over the web. From what little I know about connecting devices over the web MQTT seemed like it could be the way to go to avoid involving a cloud service that I would have to rely on. That is my problem now. Blynk changed their business model to subscription and the money I spent is now down the drain.

@pitchlynn, I too didn’t like the deprecation of the credit-based blynk servers which had been available since their kickstarter days. So now, I run the (no longer supported) but available local Blynk server on a Raspberry Pi 2W and repointed my Android Phone apps to that server. The only way this works is if you run the older Blynk app on the phone though.

Maybe for that, you wouldn't even need a cloud, or Blynk, or anything else.

How about Ignition calls the Particle API to get cloud variables and call cloud functions?
Cloud variables will be transparent between your Particle device and the Particle cloud, yes, some code is required.

Something like this:
Ignition -> Particle API -> your Particle device

On this leg:
Particle API -> your Particle device
You do not need to do much, since Particle provides that for all of us.

Best

1 Like

I did exactly this over the weekend. But I don’t think the local blynk server will be a good option long term as the app will eventually become outdated and stop working with newer ios versions. It is also no longer available on the apps store so it can’t be reinstalled, well maybe from a back up I’m not sure. So I’m only considering this a stop gap solution until I figure something else out.

2 Likes

Interesting! I don’t quite understand how that would work but that could work and I will be looking into that. I don’t like that I would be relying on particle to provide the cloud service because that could change someday just like Blynk did but I would highly consider going that route and cross my fingers. It will take some time to update my code but I’m ok doing that. In my earlier projects I used particle cloud variables but switched to blynk for the ease of app development and because it would run on my iphone rather than a web app like I used to build.

2 Likes

Ya, it’s one thing deprecating their cloud servers but I wasn’t impressed with them removing the app from the store and not providing an APK that can be side loaded.

1 Like

I got this working from Ignition! I didn’t know how the particle cloud api worked until you mentioned it was rest calls. I have experience with rest calls in Ignition and was able to get the built in rest call functions to work. Now to test an app on my phone and then build it out! Thank you for this idea!

1 Like

that’s awesome to hear! Thanks

Blynk IoT (the new version released mid 2021) should work fine with your photon. You need to use the new library and add the provisioning code to the code on your photon. See this link on what the code should look like: Blynk Example Browser

If you need a phone app, stick with Blynk.

For MQTT, you need a Hosted MQTT Broker. Try free try free mosquitto MQTT, or HiveMQ Cloud, or InfluxDB Cloud. Here is my post on how to build a Particle Webhook to InfluxData.

2 Likes