HC05 Bluetooth Module Interfacing With STM32F401CCU
by Manodeep in Circuits > Microcontrollers
3006 Views, 1 Favorites, 0 Comments
HC05 Bluetooth Module Interfacing With STM32F401CCU
The HC-05 is a very easy-to-use Bluetooth to serial converter. HC-05 connects microcontrollers (like Arduino, STM32) to other Bluetooth-enabled devices. This allows the devices to communicate wirelessly with each other.HC-05 is a Bluetooth SPP (Serial Port Protocol) module designed for wireless communication. It can also be operated as a master or slave configuration.
Supplies
1.STM32F401CCU Black Pill
2.HC05 Bluetooth Module
3.Jumper wire
Connect HC05 Bluetooth Module With STM32 According the Diagram.
NOTE: I've used Black Pill in my case but used a Blue Pill to show the wiring diagram because there was no Black Pill available in fritzing. Wiring will be the same for both boards.
Upload the Code to STM32.
HardwareSerial Serial1(PA10, PA9); const int pinout = PA0; // declare pinout with int data type and pin value char inputdata = 0; //Variable for storing received data void setup() { Serial1.begin(9600); //Sets the baud rate for bluetooth pins pinMode(pinout, OUTPUT); //Sets digital pin PA0 as output pin for led } void loop() { if(Serial1.available() > 0) // Send data only when you receive data: { inputdata = Serial1.read(); //Read the incoming data & store into data if(inputdata == '1') { digitalWrite(pinout, HIGH); Serial1.print("LED ON\n"); } else if(inputdata == '0') { digitalWrite(pinout, LOW); Serial1.print("LED OFF\n"); } } }
Downloads
Connect to HC05 From Your Mobile. Install Serial Bluetooth Terminal App From Google Play Store.
The link for the application is given below:
https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en_IN&gl=US
Writing "1" in the app will turn ON the LED and writing "0" will turn OFF the LED.