Arduino UNO and Bluetooth

Arduino UNO 29-11-24
35 0

Tutorial plan

Introduction

1- How connect Arduino UNO to Smartphone ?

2- Arduino Code

3- Create the App in MIT App Inventor

 

 

Introduction

Arduino boards can communicate over Bluetooth using specific Bluetooth modules or built-in Bluetooth capabilities.

Many Arduino boards don’t have built-in Bluetooth but can add Bluetooth functionality using external modules like: HC-06: Classic Bluetooth modules for simple serial communication (e.g., sending/receiving text data).

How It Works:

Wiring: The module connects to the Arduino's serial communication pins (TX, RX) or via a software serial library for flexibility.

Programming: The Arduino is programmed to send or receive data via the serial port, which the Bluetooth module then transmits wirelessly.

Pairing: Devices like smartphones or laptops pair with the module as a Bluetooth device.

Common Applications

Remote Control: Use a smartphone app to control a robot or LED system.

Data Logging: Send sensor data to a mobile device or PC.

IoT Projects: Communicate between Bluetooth-enabled Arduinos or integrate with IoT platforms.

 

How connect Arduino UNO to Smartphone ?

Connecting an Arduino UNO to a smartphone using the HC-06 Bluetooth module and creating a custom app in MIT App Inventor is a great project! Here’s a step-by-step guide:

1- Components Needed

Arduino UNO

Arduino Uno

It acts as the central processor, receiving data from the HC-06 module, processing commands, and sending output to the LCD display.

HC-06 Bluetooth module

A classic Bluetooth module (not BLE) used for serial communication. It operates as a slave device, meaning it waits for a connection from a master (e.g., a smartphone).

It provides wireless communication between the Arduino and the smartphone.

It sends/receives data wirelessly via Bluetooth.

Smartphone

It serves as the master device, sending commands to the HC-06 and receiving data from the Arduino.

LCD I2C 16x2 Display

It displays messages sent from the smartphone via the HC-06 module or system status (e.g., connection confirmation).

Jumper wires

Fils de connexion

It connects the Arduino and HC-06 module.

Breadboard (optional)

plaque d'essai

It is a reusable platform for building and testing circuits without soldering.

2- Wiring the HC-06 to the Arduino UNO

HC-06 Connections:

VCC → Arduino 5V

GND → Arduino GND

TXD (HC-06) → Arduino RX (Pin 2)

RXD (HC-06) → Arduino TX (Pin 3)

I2C 16x2 LCD Display Connections:

The I2C LCD display requires only two wires for data communication:

SDA → Arduino A4

SCL → Arduino A5

VCC → Arduino 5V

GND → Arduino GND

 

Arduino Code

The following code uses LiquidCrystal_I2C library to communicate with the I2C LCD and handle Bluetooth data from the HC-06.

Create the App in MIT App Inventor

Step 1: Design the App Interface

1- Go to MIT App Inventor and create a new project.

2- Drag the following components from the Palette:

ListPicker: For selecting the Bluetooth device .

Label: To display connection status

BluetoothClient: A non-visible component for managing Bluetooth communication.

We propose to create the design of the application, with the following visual:

Step 2 :  App Inventor Blocks

1- Starting with Android 12, Bluetooth permissions have been enhanced to improve security and user data protection. This is why we must declare the authorizations that your application needs in the AndroidManifest.xml file. For Bluetooth, you'll need to include ACCESS_FINE_LOCATION, BLUETOOTH_SCAN, and possibly BLUETOOTH_CONNECT permissions, depending on the features you're using.

2- Add the the necessary blocks to connect the smartphone to the HC-06 Bluetooth module

Download projectDownload application

 

How It Works : 

1- Power the Arduino and connect the HC-06 module to the smartphone.

2- Open the app, click "Select Device," and pair with the HC-06 module.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info