Tutorial – Bluetooth module with Arduino and Blynk

Tutorial – Bluetooth module with Arduino and Blynk

In this tutorial we are going to explain how to use a bluetooth module with Arduino and Blynk!

Do you remember when we used the WeMos D1 mini with the Blynk app? So now we are going to use another wireless connection! Bluetooth.

With a Bluetooth communication you can send data between devices! We will use that for a communication between a Smartphone and an Arduino Board!

Let’s Start!

Blynk app

The first thing you have to do is download the Blynk app (AndroidIos). Create a free Blynk account.

You can follow our guide to make all this necessary things -> guide to setup Blynk

If you already have a Blynk account…you have to create your Project!

Create a New Project. I called it “BT Test”.

Select your devide, I’m actually using an Arduino Nano but you can use also other boards!

Add a a button widget and a Bluetooth widget.

New Blynk Project
add widgets

Press on the button widget and set PIN = D13.

set pin for button widget

We have finished with the Blynk setup.

Sketch for the Arduino IDE

Now we have to upload a sketch to the Arduino IDE. we will upload a Blynk example.


#define BLYNK_USE_DIRECT_CONNECT

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

void setup()
{
  // Debug console
  DebugSerial.begin(9600);

  DebugSerial.println("Waiting for connections...");

  // Blynk will work through Serial
  // 9600 is for HC-06. For HC-05 default speed is 38400
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

void loop()
{
  Blynk.run();
}

Copy and Paste the code, then Upload the code on your Arduino board. You have to Upload it before doing the circuit. That’s because you will connect the Bluetooth module to the Tx and Rx Arduino pin.

Schematic

Make this circuit.

  • Vcc -> 3.3V
  • GND -> GND
  • Rx -> Tx
  • Tx -> Rx

What will happen?

Now you have the code running on the Arduino and the Bluetooth module is working. Open the Blynk app, press on the Bluetooth widget and connect the smartphone to the module.

Then press play on the Blynk app.

You will see a led blinking each time you press the button on the screen!bluetooth module with Arduino and Blynk

Enable notifications to know when we publish new tutorials!

Follow us on instagram, facebook and twitter!

Davide Busco

Davide Busco is an engineering student at Federico II University of Naples. He uses his passion and studies to create his projects. He loves be a maker and spread his knowledge. Moreover he has gained the second place in a national makers-tournament between Italian's Universities.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_GBEnglish (UK)
it_ITItaliano en_GBEnglish (UK)
%d bloggers like this: