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

BlueTooth_Control

The document outlines a project to control home appliances using a Bluetooth terminal and STM32F407VG-DISC1 board via UART communication. It includes a list of required components, hardware connections, and a program to handle Bluetooth commands for turning a motor on and off. The output demonstrates the functionality by sending specific characters from the Bluetooth application to control the motor's state.
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)
3 views

BlueTooth_Control

The document outlines a project to control home appliances using a Bluetooth terminal and STM32F407VG-DISC1 board via UART communication. It includes a list of required components, hardware connections, and a program to handle Bluetooth commands for turning a motor on and off. The output demonstrates the functionality by sending specific characters from the Bluetooth application to control the motor's state.
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/ 5

Controlling the Home Appliances through Blue

tooth Terminal
Aim
To send the status of the push button to Bluetooth application using UART Communication

Components Required
1.Discovery Board - STM32F407VG-DISC1
2. Bluetooth terminal hc-05
3.Blue Tooth application- to be installed in Android Mobile
4.Leds or D.C Motor or Relay

Application Required
Install Serial Bluetooth terminal application in Android Mobile

Pin Details & Hardware Connection


COnnect
Blue Tooth Terminal has 4 pins:
As we are going to USART 1:
1.Tx pin of Blue Tooth Terminal is connected to RX pin of STM32F407VG-DISC1 – PA10
2.Rx pin of Blue Tooth Terminal Connected to TX pin of STM32F407VG-DISC1 -PA9
3.Gnd is connected GND pin of STM32F407VG-DISC1 Board
4.Vcc - is connected to +5v pin of STM32F407VG-DISC1board
Procedure
RCC,SYS and Clock Settings has to be done as Previous Project. To enable UART
Communications, Following Settings has to be done.
Program
#include "main.h"

/* Private includes ----------------------------------------------------------


*/
/* USER CODE BEGIN Includes */
UART_HandleTypeDef huart1;
uint8_t rxData;
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------


*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------


*/
/* USER CODE BEGIN PD */

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------


*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */


/* Private variables ---------------------------------------------------------
*/
UART_HandleTypeDef huart1;

/* USER CODE BEGIN PV */

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------


*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------


*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------
*/

/* Reset of all peripherals, Initializes the Flash interface and the


Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */


SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */


MX_GPIO_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
HAL_UART_Receive_IT(&huart1,&rxData,1);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */


}
/* USER CODE END 3 */
}

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)


{
if(huart->Instance==USART1)
{
if(rxData==79) // Ascii value of 'O' is 79
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, 1);
}
else if (rxData==88) // Ascii value of 'X' is 88
{
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, 0);
}
HAL_UART_Receive_IT(&huart1,&rxData,1); // Enabling interrupt receive
again
}
}

OUTPUT
1. Send Character ‘O’ from Blue Terminal Application and you can see the
motor is ON.
2. Send Character ‘X’ from Blue Terminal Application and you can see the
motor is OFF.

You might also like