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:

  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 "pin"

  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.


The Ultimate Guide to Particle Mesh Cover

Get Ready for the Ultimate Guide

Signup to get updates on The Ultimate Guide to Particle Mesh. Early subscribers get a discount when it becomes available!

Sign me up!

You may also like

How to Upgrade Particle Mesh Device OS

In this excerpt from my upcoming guide on Particle Mesh, you’ll learn the different ways to upgrade the OS on your Particle Mesh device. That way you can un-bork your device or add…

How to Presence Tracking Using Particle Argon

Ever want to add presence or location tracking to a project? Frustrated by the solutions (or lack thereof)? Do not worry, you’re not the only one! In this post you’ll learn how to…

The Hackster Soracom Contest

I recently participated in a contest on Hackster sponsored by Soracom. I poured my heart into the project with little time I had before heading out of town for a few months. The…