Bluetooth Internet of Things lighting control design scheme

Mondo Home Updated on 2024-01-31

Bluetooth technology is one of the most widely used wireless communication technologies at present, working in the world's 24GHz of ISM band. Bluetooth has a working distance of about 100 meters, has some penetration, and has no directional limitations. It has the characteristics of low cost, strong anti-interference ability, high transmission quality and low power consumption. Bluetooth technology networking is relatively simple, no additional settings are required, as long as two Bluetooth devices enter the connection range, Bluetooth will automatically search, realize pairing connection, and carry out point-to-point information transmission. At present, personal computers, mobile phones and other terminal devices have Bluetooth communication functions, and can use mobile phone Bluetooth to send control signals to other Bluetooth devices for wireless control.

Ordinary lighting bulbs do not have Bluetooth modules, and there is no way to receive Bluetooth signals, so this design is to transform ordinary bulbs so that the bulbs can receive Bluetooth signals and be controlled. The basic idea of Bluetooth lamp design: the mobile phone and the control board establish a point-to-point connection through the Bluetooth module, and then send instructions by hand, the Bluetooth module on the control board receives the instructions, and finally controls the bulb connected to the control board.

The overall structure of the Bluetooth lamp is divided into three parts: mobile terminal APP, Bluetooth communication, and MCU control. The mobile terminal APP part realizes the user's sending of remote operation instructions to the bulb;The Bluetooth communication part realizes the receipt of operation instructions and transmits them to the MCU controller: the MCU control part realizes the processing of the received operation instructions.

2.1mcu control

The MCU control department chose the Arduino as the main control board. Arduino is a flexible, easy-to-use, open-source** hardware and software platform[3]. The hardware has a rich set of interfaces, with 33V and V power supply, digital port, analog port, and serial port communication are supported. The software programming language does not have a complex microcontroller bottom layer, and the function can be achieved by directly calling simple and practical functions. The following design is based on the Arduino UNO main control board.

2.2. Bluetooth communication

The Bluetooth module is divided into a master module and a slave module, the master module can both receive signals and send signals, while the slave module can only receive signals, but cannot send signals. In this design, the bulb only needs to receive the control signal, and the HC-06 Bluetooth slave module is selected to receive the control signal. The HC-06 module has four pins: VCC (3.)3V), GND (ground), TXD (sender), RXD (receiver). The Bluetooth module communicates with the Arduino, via a serial port. Arduino's digital port 01 is the RX (receiver) and TX (transmitter) of the serial port of the development board, which are connected to the TXD and RXD of the HC-06, respectively.

2.3 bulbs

The bulb is a high-current and high-voltage device and cannot be driven directly by the Arduino's digital port, so relays are used to control the light on and off. The relay uses weak current signals to control the lifting and falling of the relay to realize the closing and disconnection of the circuit. In this way, the Arduino uses weak signals to control the on/off of large currents and high voltages, and indirectly controls the current flow and disconnection in the bulb circuit, and the light bulb turns on and off.

China's lighting adopts a three-phase four-wire power supply system, which requires that the middle line (zero line) is not allowed to install switches and fuses (fuses), and the relay is actually a switch, so the connection of the positive pole of the power supply of the bulb is disconnected from the middle, and the common end and the normally open end of the relay are connected respectively.

Arduino judges that if the received signal is "turn on the light", correspondingly assign the digital port (digital port 8 in this case) to a high level (i), send the high level to the S end of the relay, the relay normally open and close, and the bulb is lit: judge that if the received signal is "turn off the light", accordingly assign the digital port 8 to the bottom level (0), the bottom level is sent to the S end of the relay, the relay normally open switch is reset, and the bulb is off. Bluetooth light specific hardware connection and program:

2.4 Bluetooth light hardware test results

Use the Bluetooth serial port debugging assistant to monitor the serial port data. According to the writing in the Arduino's Bluetooth light program, when you enter 1 in the Bluetooth middle port debugging assistant window of your phone, you receive the "dengliang" string, the relay is engaged, and the bulb is onWhen 0 is entered, the "dengmie" string is received, the relay is reset, and the bulb is off. The test results show that the Bluetooth lamp hardware can realize the function of receiving signal processing.

The mobile terminal app part realizes the user's Bluetooth remote operation of the light bulb. This design uses a graphical mobile phone programming software App Inventor specially developed by a company. This software does not need to have a certain amount of professional knowledge to use, the software has been written in advance buttons, text input and output software** into different modules, users only need to assemble according to their own needs.

The mobile terminal app part needs to have the functions of searching for Bluetooth devices, connecting Bluetooth devices, disconnecting Bluetooth devices, and light bulbs.

Write an Android program that will generate an apk file to your phone by scanning it or a phone cable. After installation, the Bluetooth light app icon will be formed on the desktop of the mobile phone. Open the icon to enter the app interface.

The Bluetooth light app's full control of the bulb hardware also requires further debugging of the two parts. It should be noted that the values represented by the "on" and "off" button operations in the app are "1" and "0", and in the Bluetooth light control part of the Arduino program, "1" and "0" should also be judged.

First of all, turn on the Bluetooth function of the phone, let the phone pair with HC-06, enter the pairing secret "1234", and the pairing is successful. Secondly, open the installed APP on your phone, tap the "Search Bluetooth" button, connect to Bluetooth, and prompt that the APP is connected to the HC-06 Bluetooth module. Finally, tap the light bulb to turn off**, the light bulb is on: Click the light bulb to turn on**, and the light bulb is off. Through debugging, the remote control of the Bluetooth lamp by the mobile phone APP was finally realized.

Source: Computer Knowledge and Technology.

Original title: Design and implementation of Bluetooth lamp based on Arduino.

Written by Jialing Liu.

Related Pages