How To Create a Cross Platform App for the Particle Platform Using Blynk

Jared Wolff · 2018.11.12 · 2 Minute Read · particle · blynk

Phone screen

As “fun” as it is to take days if not months to create a mobile app, no one likes to wait. So, how can you get to something working that you can get up and running and focus on the next thing?

Enter Blynk.

Blynk is an app that creates apps. You can use it to monitor the air inside your house or even turn your lights on and off. Your imagination is your limitation.

The best part about it?

It took about two minutes.

Here’s the steps to get started:

  1. Install the library in Particle Dev

    Install the library in Particle Dev

  2. Include the library in your project.

    #include <blynk.h>
    
  3. Add the auth key

    char blynk_auth[] = "<your key here>";
    

    Note: Once you setup the Blynk app, it should give you your API key. Insert that above.

    Note: Also, for safety, make sure you don’t commit this!

  4. In your setup() initialize Blynk:

    Blynk.begin(blynk_auth);
    
  5. Write data where needed:

    Blynk.virtualWrite(<Vpin>, millis() / 1000);
    

    Where is the virtual “pin” you’re writing to.

    Here are some examples of how I’m using it in my project:

    Blynk.virtualWrite(V0, String::format("%.2f", onboard_humidity / 100.0));
    Blynk.virtualWrite(V1, String::format("%.2f", onboard_temp / 100.0));
    Blynk.virtualWrite(V2, String::format("%.3f", thermo_temp));
    

    String::format generates a string from the floating point data from the sensors.

  6. Compile and load the firmware.

    Compile the firmware

  7. Now, in the Blynk app, and add your widget of choice:

    Adding the widget

    I added a labeled value in this case. I changed the label to match what I wanted it to display.

  8. Finally, connect the virtual pin to that

    Connecting a virtual &ldquo;pin&rdquo;

  9. “Start the application”

    Start the application

  10. Your app should start updating as long as your Particle is up and running. The frequency depends on your update interval. Thus, tweak that as necessary in your firmware.

In conclusion, this was a fast and convenient way to get data into a visual and mobile format. It saved me time and allowed me to focus on other things like writing this post!

Thanks for reading and be sure to signup for my free newsletter below so you’re never be in the dark.

😎👇

Last Modified: 2020.3.7

Subscribe here!

You may also like

Meet Pyrinas a New Way to Use Your Xenon

Talk about how Particle’s Mesh deprecation announcement, many have been left to figure out how to deploy their low power sensor networks. There was always the option of using…

Particle Mesh Deprecation Livestream Reaction

Particle held a Q&A session last week. I listened in and took some notes. I know many of you are upset. I’m not exactly pleased myself. I digress, here are a few key takeaways and…

How to Develop Particle Iot Apps Using NativeScript

If you’re developing any type of IoT product, inevitably you’ll need some type of mobile app. While there are easy ways, they’re not for production use. In this tutorial, we’ll…