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!

Iniziamo!

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.

Collegamenti

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 è uno studente di ingegneria dell'automazione presso l'Università Federico II di Napoli. Impiega la sua passione e i suoi studi nella realizzazione dei suoi progetti. Vuole condividere la sua passione nell'essere un maker e condividere così la sua esperienza. Inoltre è arrivato secondo ad un concorso nazionale tra makers provenienti dalle varie Università Italiane.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

it_ITItaliano
en_GBEnglish (UK) it_ITItaliano
%d blogger hanno fatto clic su Mi Piace per questo: