Design of high-power dimming and color adjustment LED lights for Bluetooth remote control of mobile phones
Time:2023-05-12
Views:1029
1. Introduction
On October 30, 2012, Philips sold the latest high-tech Hue series LED lights in the Apple Store and will only be sold by Apple. The Hue series will be completely customizable, and 16 million colors of light can be mixed through a red, blue, and green LED in a single bulb. The entire process is completely controlled by the app on the iPhone. This has sparked new thinking on the development of intelligent light control, and relevant domestic scholars have also conducted research. Considering that Hue adopts WiFi wireless control, while WiFi is not widely used in China, this study adopts a more common Bluetooth technology, which uses mobile Bluetooth to communicate with a microcontroller to generate an adjustable duty cycle PWM wave signal and control the LED driver circuit to achieve LED dimming and DIY color adjustment.
2. Pulse width modulation (PWM) dimming technology
PWM dimming is a dimming technique that utilizes simple digital pulses to repeatedly switch on and off LED drivers. The application‘s system only needs to provide digital pulses with different widths and widths to easily change the output current and adjust the brightness of the LED. The advantage of PWM dimming is that it has a wide dimming range. As long as the bandwidth is sufficient, any analog value can be encoded using PWM. PWM dimming can accurately control the brightness of the LED while also ensuring the chromaticity of the LED emission.
2.1 Pulse Width Modulation (PWM) dimming principle
Utilizing the visual inertia of the human eye, the LED brightness is adjusted by operating the duty cycle at a fixed frequency. As long as the dimming ratio, i.e. the PWM wave frequency, is greater than 200Hz, the human eye will not feel the flashing of the LED. The specific dimming implementation is achieved by controlling the LED‘s on/off time, thereby controlling the LED brightness. From the perspective of electricity, it is to control the effective value of the current within a certain period. This method changes the effective value of the current without changing the voltage and current, thus ensuring the chromaticity of LED emission, which cannot be achieved by analog dimming and thyristor dimming.
2.2 Duty Cycle
The duty cycle refers to the ratio of time that a high level occupies within a cycle. The duty cycle of the square wave is 50%, and the duty cycle is 0.5, indicating that the positive level takes up 0.5 cycles of time.
Ts is the pulse period, and Tw is the pulse width
Duty cycle τ= Tw/Ts × one hundred
The explanation of the duty cycle can be summarized as follows:
1) In an ideal pulse sequence (such as a square wave), the ratio of the duration of a positive pulse to the total period of the pulse.
2) The ratio of the time occupied by a pulse to the total time during a continuous working period.
3) In periodic phenomena, the ratio of the time at which the phenomenon occurs to the total time.
That is, the ratio of the effective time for the circuit to release energy to the total release time.
2.3 Dimming ratio
The dimming ratio is calculated as follows:
Foper=working frequency, FPWM=dimming frequency, dimming ratio=Foper/FPWM
In fact, it is the lowest effective duty cycle of dimming, such as Foper=100khz; If FPWM=200Hz, the dimming ratio is 100k/200=500
3. Bluetooth module composition
3.1 Bluetooth Technology Fundamentals
The founder of Bluetooth is Swedish company Ericsson. Bluetooth technology is an open global specification for wireless data and voice communication, based on low-cost close range wireless connections, establishing a special connection for fixed and mobile device communication environments. It has become common practice to achieve data sharing between mobile phones through Bluetooth, and transforming mobile phones into remote controls brings infinite convenience to people‘s lives 1]
Bluetooth technology consists of three parts, including Bluetooth radio technology, Bluetooth protocol stack and Bluetooth interoperability.
3.1.1 Bluetooth radio technology
Bluetooth radio operates globally. 4 G H zISM (i.e. industrial, scientific, medical) frequency band, supporting full duplex transmission, using the IEEE802.15 protocol. Bluetooth devices are ready to connect and use, with strong anti-interference ability and easy to use [2]
3.1.2 Bluetooth protocol stack
The Bluetooth protocol stack includes a software stack and a hardware stack. The Bluetooth hardware protocol stack is provided by Bluetooth hardware, and the Bluetooth software protocol stack is implemented by software. The Bluetooth software protocol stack provides Java Bluetooth APIs for program developers to use.
3.1.3 Bluetooth interoperability
Bluetooth interoperability includes three aspects: ① the general access profile defines the device management functionality; ② The Service Discovery Application Profile defines the content of service discovery; ③ Serial Port Profiles defines the capabilities of interoperability devices and analog serial port cables 3.2 HC-O6 Bluetooth module
BC04 external 8M Flash, with EDR module HC-06 for civilian use, compatible with HC-04 industrial grade. Among them, the TX pin of the HC-06 module is connected to the P3.0 pin of the STC15F204EA microcontroller, and the RX pin is connected to the P3.1 pin. The HC-06 module receives data from the mobile phone and communicates with the microcontroller through the serial port TR and TX pins.
Bluetooth 2.0 with EDR, 2Mbps 3Mbps modulation system, built-in 2.4GHz antenna, external 8Mbit FLASH, low voltage 3.3V operation (3.1V~4.2V), 30-40MA fluctuation during pairing, communication 8MA after pairing, optional PIO control standard HCI port (UART or USB), digital 2.4GHz wireless reception and transmission, CSR BC04 Bluetooth chip technology, adaptive frequency hopping technology, Bluetooth Class 2 power level, operating temperature of -25 to+75, co wave interference of 2.4MHz, transmission power of 3dBm, The effective control distance is 10m
4. Design of mobile app
4.1 Bluetooth connection related program design
Firstly, initialize the local Bluetooth device and establish the LocalDevice class, including obtaining the local device instance, Bluetooth name, setting the discovery mode, and obtaining the discovery proxy. Create public int BTS_ Init() class function, to realize Bluetooth initialization judgment, find the default Bluetooth device, and turn on Bluetooth.
Launch Bluetooth device search and create public voidBTS_ StartScan() class function, start to search for slave Bluetooth devices, register search function, and create public int BTS_ ConnectToDevice (String DeviceAddress) class function to connect to a specified Bluetooth device.
Create public int BTS_ SendDates (Stringbuffer) class function implements sending strings to connected Bluetooth devices to create public int BTS_ Finish() class function ends the Bluetooth communication, and finally creates the receive action_ BroadcastReceiver private BroadcastReceiver mReceiver=newBroadcastReceiver() for FOUND broadcasting.
4.2 Control signal related program design
First, create a class publicclass PwmcontrolActivity extends Activity {} for control signal, which contains the class function public voidonCreate (BundlesavedIn stan ceState) {} for creating the interface, and send the control signal class function public void onStop TrackingTouch (SeekBar seekBar) {}.
Create a class InitThread extends Thread {} to implement the resource loading thread. In it, create a public InitThread (PwmcontrolActivity act) {} class function for conversion between four signals, implement the public void run() thread body of the Bluetooth program interface, and use it as a class function public boolean KeyDown (int keyCo de, KeyEvent event) for software exit.
5. microcontroller control signal design
5.1 Hardware circuit design
The system diagram is shown in Figure 1. The hardware circuit of this system uses the STC15F204EA microcontroller as the main controller, and the TXD of the CH-06 Bluetooth module is connected to the microcontroller 11 pin P3.0, while the RXD is connected to P3.1 to achieve Bluetooth serial communication connection. Four adjustable duty cycle PWM signals are output from the four ports P1.0, P1.1, P1.2, and P1.3, and an L298 chip is used to isolate the microcontroller control signal from the LED power drive, avoiding the disadvantage of weak load capacity of the microcontroller, To achieve driving high-power LED
Disclaimer: This article is transferred from other platforms and does not represent the views and positions of this site. If there is any infringement or objection, please contact us to delete it. thank you! |