0% found this document useful (0 votes)
216 views

STM32 With HC-05 Bluetooth Module Using Devices Control

The document describes connecting an HC-05 Bluetooth module to an STM32 microcontroller board to control DC motors using an Android app. Key points: 1) The HC-05 module connects to the STM32 board via RX, TX pins and uses an L293D motor driver and motor control pins to control two DC motors. 2) An Android app sends Bluetooth commands to control motor direction and speed. 3) An Arduino sketch on the STM32 receives Bluetooth data and uses the motor driver to move the motors accordingly.

Uploaded by

Kamal Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
216 views

STM32 With HC-05 Bluetooth Module Using Devices Control

The document describes connecting an HC-05 Bluetooth module to an STM32 microcontroller board to control DC motors using an Android app. Key points: 1) The HC-05 module connects to the STM32 board via RX, TX pins and uses an L293D motor driver and motor control pins to control two DC motors. 2) An Android app sends Bluetooth commands to control motor direction and speed. 3) An Arduino sketch on the STM32 receives Bluetooth data and uses the motor driver to move the motors accordingly.

Uploaded by

Kamal Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

STM32 WITH HC-05 BLUETOOTH MODULE USING DEVICES

CONTROL

Lcd connections

lcd Stm32 other


1 ground
2 Vcc
3 Gorung with 1k
resistor
4 B11
5 GROUND
6 B10
7
8
9
10
11 B0
12 B1
13 C13
14 C14
15 VCC
16 GROUND

Stm32 BT
A9 TX
A10 RX

OUTPUTS
B5,B6,B7
Description
STM32 Blue Pill is a high-performance, breadboard friendly development board with loads
of features in a small form factor. It features a 32-bit ARM Cortex M3 processor running at
72MHz frequency with 64Kbytes of flash memory and 20 Kbytes of SRAM. It has an
extensive range of I/O and peripherals, including multi-channel Direct Memory Access,
several high resolution ADC, and three general purpose 16-bit timers plus one PWM timer. It
also has multiple communication interfaces including two I2Cs and SPIs, three UARTs, an
USB and a CAN. Further, it allows you to add additional flash by soldering an SPI Flash to
the board.
This development board is pre-flashed with an Arduino bootloader, so you can download the
sketch just like other Arduino board.
The STM32 Blue Pill can be programmed using either the Type-C USB connector (if
bootloader is flashed), the STLink USB dongle, or an external USB to 3.3V TTL adapter.
A set of 2.5mm pitch male headers is included (soldering is required).
Check out the following tutorial for detailed instructions on how to program the STM32 Blue
Pill with Arduino IDE:
Program STM32 Blue Pill (STM32F103C8T6) with Arduino IDE
Note: This board does not support microPython. Not all I/O pins are 5V tolerant - refer to the
pinout diagram for details.
Features:
 STM32F103C8T6, 72 MHz ARM Cortex-M3
 64K Flash, 20K SRAM.
 32.768KHz crystal for RTC
 3 buttons: user, boot and reset
 USB type-c connector
 32 digital I/O Pins (12 of which are PWM)
 14 Analog Inputs
 3 UART Ports
 2 I2C Ports
 2 SPI Ports
Serial Bluetooth Terminal for Android
Developer's Description

'Serial Bluetooth Terminal' is a line-oriented terminal / console app for


microcontrollers, arduinos and other devices with a serial / UART interface
connected with a bluetooth to serial converter to your android device.

This app supports different bluetooth versions:

- Bluetooth Classic

- Bluetooth LE / Bluetooth Low Energy / BLE / Bluetooth Smart

This app supports different bluetooth devices:

Bluetooth Classic (implementing standard Bluetooth SPP profile):

- HC-05, HC-06, ...

- Raspberry Pi 3

- ...

Bluetooth LE (implementing vendor specific Bluetooth GATT services):

- predefined:

* BBC micro:bit, (based on Nordic Semiconductor nRF51822, )

* HM-10, CC41-A, (based on Texas Instruments CC254x)

* Telit Bluemod

- custom profile:

* TI CC2640 serial service, except config characteristics

* Microchip BM70/71 'transparent UART service'

* Silabls BLE113

* uConnect BLE serial adapter

* ...

All features in this app are free. In-App purchase is only used for the
'Donate' option.
Looking for source code? Here you find simplified variants of this app:

https://github.com/kai-morich/SimpleBluetoothTerminal

https://github.com/kai-morich/SimpleBluetoothLeTerminal

l if

NOW

Full Specifications
WHAT'S NEW IN VERSION 1.24
GENERAL
ReleaseJune 7, 2019

Date AddedJune 7, 2019

Version1.24
OPERATING SYSTEMS
Operating SystemsAndroid

Additional RequirementsRequires Android 4.3 and up

All about HC-05 Bluetooth Module | Connection with


Android
Ever wanted to control your Mechanical Bots with an Android Phone or design the robots
with custom remote, here in this tutorial we will learn about a Bluetooth Module HC-05 used
for the above mentioned and many other cases. Here we will be understanding the connection
and working of a HC-05 module and also its interfacing with custom android app.
Basics
Wireless communication is swiftly replacing the wired connection when it comes to
electronics and communication. Designed to replace cable connections HC-05 uses serial
communication to communicate with the electronics. Usually, it is used to connect small
devices like mobile phones using a short-range wireless connection to exchange files. It uses
the 2.45GHz frequency band. The transfer rate of the data can vary up to 1Mbps and is in
range of 10 meters.
The HC-05 module can be operated within 4-6V of power supply. It supports baud rate of
9600, 19200, 38400, 57600, etc. Most importantly it can be operated in Master-Slave mode
which means it will neither send or receive data from external sources.
HC-05 module

Description of pins

Enable - This pin is used to set the Data Mode or and AT command mode (set high).
VCC - This is connected to +5V power supply.
Ground - Connected to ground of powering system.
Tx (Transmitter) - This pin transmits the received data Serially.
Rx (Receiver) - Used for broadcasting data serially over bluetooth.
State -Used to check if the bluetooth is working properly.

Modes of Operation

The HC-05 Bluetooth Module can be used in two modes of operation: Command Mode and
Data Mode.

Command Mode
In Command Mode, you can communicate with the Bluetooth module through AT
Commands for configuring various settings and parameters of the Module like get the
firmware information, changing Baud Rate, changing module name, it can be used to set it as
master or slave.
A point about HC-05 Module is that it can be configured as Master or Slave in a
communication pair. In order to select either of the modes, you need to activate the
Command Mode and sent appropriate AT Commands.
Data Mode
Coming to the Data Mode, in this mode, the module is used for communicating with other
Bluetooth device i.e. data transfer happens in this mode.

Programming HC-05 with Microcontroller


Technical specs of the code:
 Arduino-Uno is used as the microcontroller.

 Name: HC-05

 Password: 1234 (or 0000)

 Type: Slave

 Mode: Data

 Baud Rate: 9600 with 8 data bits, no parity and 1 stop bit
Motor Driver L293D:
To control two dc motors at the same time here two H-Ground motors is used which
gives permissions to DC motors. L293d has H- bridge module which allows to control every
direction of dc motors and speed. Here enables line is used to turn on and turn off the speed
of all motors and motor drivers. It has 4 output pins and 4 input pins to control the motors
independently and easily without any interruptions. Here TTL logic levels is designed to
undertake heavy loads. L293d motor driver can handle the voltages from 5volts to 35volts
easily and freely. To run the DC motors in any voltages motor driver can help to motors to
convert low voltages to high voltages without any disturbances.

Control Pins
1 IN1 These pins are input pins of Motor A. These are
used to control the rotating direction of Motor A.
When one of them is HIGH and the other is LOW,
Motor A will start rotating in a particular direction.
If both the inputs are either HIGH or LOW the
2 IN2 Motor A will stop.
3 IN3 These pins are input pins of Motor B. These are
used to control the rotating direction of Motor A.
When one of them is HIGH and the other is LOW,
4 IN4 Motor A will start rotating in a particular direction.
If both the inputs are either HIGH or LOW the
Motor A will stop.
CODE:
#define RM1 PB7

#define RM2 PB6

#define LM1 PB8

#define LM2 PB9

#define HL PB5

#define HS PB4

char data = 0;

void setup() {

Serial1.begin(9600);

pinMode(RM1,OUTPUT);

pinMode(RM2,OUTPUT);

pinMode(LM1,OUTPUT);

pinMode(LM2,OUTPUT);

pinMode(HL,OUTPUT);

pinMode(HS,OUTPUT);

void loop() {
if(Serial1.available()> 0)

data = Serial1.read();

if(data == 'H')

digitalWrite(HL,HIGH);

else if (data == 'h')

r4e9

digitalWrite(HL,LOW);

else if(data == 'S')

digitalWrite(HS,HIGH);

else if (data == 's')

digitalWrite(HS,LOW);
}

if(data == 'F')

digitalWrite(RM1,HIGH);

digitalWrite(RM2,LOW);

digitalWrite(LM1,HIGH);

digitalWrite(LM2,LOW);

else if(data == 'B')

digitalWrite(RM1,LOW);

digitalWrite(RM2,HIGH);

digitalWrite(LM1,LOW);

digitalWrite(LM2,HIGH);

else if(data == 'R')

digitalWrite(RM1,HIGH);
digitalWrite(RM2,LOW);

digitalWrite(LM1,LOW);

digitalWrite(LM2,HIGH);

else if(data == 'L')

digitalWrite(RM1,LOW);

digitalWrite(RM2,HIGH);

digitalWrite(LM1,HIGH);

digitalWrite(LM2,LOW);

else if(data == 'S')

9digitalWrite(RM1,LOW);

digitalWrite(RM2,LOW);

digitalWrite(LM1,LOW);

digitalWrite(LM2,LOW);

delay(100);

You might also like