1 Introduction
With the improvement of people's quality of life, lamps are no longer just basic indoor lighting tools, but also a kind of practical art for architectural decoration. When there are all kinds of lamps at home, it is necessary to carefully match them together to achieve the most suitable atmosphere effect. At present, the control of lights is mainly manual, and all lamps are controlled one by one. This is not only troublesome but also inefficient, and does not meet the standards of modern comfortable life.
Therefore, designing an intelligent lighting system that can conveniently control lights and provide functions such as scene combination is not only practical, but also has broad market prospects.
2 Design goals
Design an intelligent lighting controller, which is installed in each room of the home, and provides rich functions such as wireless remote control, touch-type lighting control, scene combination, preset storage, etc. All lights in the house can be controlled by handheld remote control; the scene setting button on the remote control can be used to conveniently set the lighting scene and quickly switch. The switch and brightness of the lights can be controlled by the touch button on the panel, or multiple lights can enter a preset scene. Each lighting controller communicates with the home Ethernet network terminal through the RS485 bus to realize remote control and query of the light brightness.
The intelligent lighting control system is divided into two parts: receiving external control signals and executing control operations. In order to receive control signals, the system needs to have wireless receiving function and key input panel. In order to control the lamps, a 220V dimming control circuit needs to be designed.
LPC2104 has rich peripheral interface resources, high reliability and operation speed, which is very suitable for the design of this system. The principle of the intelligent lighting controller is shown in Figure 1.
|
3 Introduction to LPC2104 functions
LPC2104 is a cost-effective microcontroller solution provided by PHILIPS for embedded applications. It adopts ARM's 16-bit/32-bit RISC structure, the core is ARM7TDMI-S, the CPU operating frequency can reach 60MHz, and the on-chip integration includes: 128KB Flash program memory with ISP and IAP functions, 16KB static RAM, 2 UARTs, 1 I2C serial interface, 1 SPI serial interface, up to 6-way PWM output, 2 timers, each with 4 capture/compare channels, real-time clock and watchdog timer, etc. It can achieve seamless connection with commonly used peripheral devices and has powerful functions. This article takes LPC2104 as the core to design an intelligent lighting controller with simple structure and stable performance.
4 Wireless data transmission module design
4.1 Introduction to nRF401
There are three solutions for wireless communication: Bluetooth communication, infrared wireless remote control, and short-range wireless data transmission devices. For the Bluetooth solution, the transmission distance and device cost are issues worth considering. Bluetooth is mainly used for short-range transmission (up to 10m), and the cost has always been high. Although infrared transmission does not need to consider the cost issue, from the perspective of the power consumption that handheld devices can provide, the transmission distance is too short, only a few meters, and there are certain requirements for the infrared emission angle. There are fatal defects such as "it must be ensured that the two devices transmitting information are facing each other, and there must be no obstacles in the middle". Compared with the first two solutions, the short-range and low-power wireless RF device nRF401 is the best choice. [page]
The nRF401 wireless communication transceiver integrates functions such as high-frequency transmission/reception, PLL synthesis, FSK modulation/demodulation and multi-channel switching. It has outstanding technical advantages in low-cost digital communication applications. Its main technical features are: (1) It works on two internationally used channels: 433.92MHz and 434.32MHz, and can be used without channel application; (2) It adopts DSS+PLL frequency synthesis technology, and the external components are only one crystal oscillator and several resistors, capacitors and inductors. It can basically work without debugging and has good stability; (3) Digital communication adopts FSK modulation with high anti-interference ability, supports direct data input and output operations, and can be directly connected to the UART serial port of the MPU; (4) There are 2 selectable working channels, using half-duplex working mode, and the maximum data transmission rate can reach 20bk/s; (5) The operating voltage is 2.7V-5V, and the power consumption in standby state is only 8μA, which can meet the requirements of low-power devices.
The nRF401 device does not require initialization and configuration, does not require Manchester encoding of data, and can use cheap PCB antennas. It does not require complex RF circuit design and debugging, making product development and application more convenient.
4.2 Connection between nRF401 and LPC2104
There are many options for connecting nRF401 and LPC2104, such as GPIO, I2C, UART, etc. From the perspective of hardware connection and communication protocol simplification, it is the best solution to connect the serial port to the wireless module. TXD1 and RXD1 of UART1 are connected to DIN and DOUT of nRF401 respectively. The interface circuit of nRF401 and LPC2104 is shown in Figure 2.
|
As shown in Figure 2, the control interface of the embedded CPU to the wireless module is mainly composed of 5 signal lines, namely DIN, DOUT, TXEN, PWR_UP, and CS. Among them, TXEN is the transmission enable end. By setting and resetting TXEN, the transmission state and the receiving state are switched, and it is controlled through the GPIO port. PWR_UP is the energy-saving control end. It is programmed using a GPIO port of LPC2104 to switch the working mode and sleep state of the wireless module; CS can select the channel. Through GPIO settings, the UART1 serial port of LPC2104 can be used to control the DIN and DOUT signals.
In order to save energy, nRF401 should be turned off in most cases. The wireless part does not have an automatic wake-up function in hardware. A reasonable communication protocol must be adopted through software to ensure energy saving and data loss.
5 Dimming control circuit design
The thyristor is controlled by the method of current injection through the microcontroller I/O port to realize switching and dimming control. The optocoupler MOC3041 with an internal zero-crossing detection circuit is used as the driver of the thyristor, and it can also achieve isolation of strong and weak electricity.
Traditional dimming methods use phase-shifted triggering thyristors to control the output power by controlling the conduction angle of the thyristors. Not only is the synchronous detection circuit complex, but also high-order harmonic interference will be generated at the moment of thyristor conduction, causing grid voltage waveform distortion and affecting the normal operation of other electrical equipment and communication systems. In this system, the ratio of the conduction and shutdown time of the zero-crossing triggering thyristor is used to adjust the power of the lamp. Since the zero-crossing trigger does not change the waveform of the voltage but only changes the number of times the voltage full wave passes, it will not cause pollution to the grid. Therefore, this system uses the zero-crossing triggering method.
MOC3041 contains a zero-crossing detection circuit. When the input pin 1 inputs a current of 15mA and the voltage between the output pins 6 and 4 slightly passes zero, the internal bidirectional thyristor is turned on, triggering the external thyristor to turn on. When the input current of the MOC3041 input pin is 0, the internal bidirectional thyristor is turned off, and the external thyristor is also turned off. Its dimming control circuit is shown in Figure 3.
|
6 Wireless module software design
The wireless module is connected to the system through the UART serial port, so the UART must be initialized. The UART serial port of LPC2104 complies with the RS232 standard and also supports the 550 industrial standard. [page]
LPC2104 has two universal asynchronous serial interfaces (UART). The default state of UART is unusable at startup, and they must be enabled by programming the GPIO register.
This system uses UART1 to connect to nRF401. UART1 has a modem interface and 16-byte receive and transmit FIFOs. It has a built-in baud rate generator and contains standard modem interface signals.
When using UART1, first set the connection mode of TXD1 and RXD1 pins, then set the baud rate and working mode of the serial port, and then you can send and receive data. This system uses an 11.0592MHz crystal oscillator, does not apply PLL, VPB is divided by 4, and the baud rate of UART1 is set to 9600bit/s, then the divisor value N=18, that is, 12H. The initialization procedure of UART1 is as follows:
In the operating system environment, the serial port will be automatically initialized when the system starts, so it will become easier for the application to call serial port resources. It is worth noting that the application is often a multi-arbitrary system. In order to monitor the serial port messages in real time, a serial port scanning task is generally opened in the operating environment to ensure that the information is not lost. In the main function of an existing project file, add the serial port register initialization code and add the serial port scanning task. Due to the control of the wireless module and the system's GPIO, the scanning program must also include the operation of I/O. When the system receives the serial port information, it will actively send a serial port information to the main task. The main task will call the response function to respond to the message after receiving the information.
7 Conclusion
The wireless communication module nRF401 integrates transmission and reception, which greatly simplifies the complexity of the lighting controller design. The smart lighting controller can be easily networked through the RS485 interface, which provides convenience for the realization of smart home networking.
Previous article:Application of T46R14 in cold cathode fluorescent lamp converter
Next article:Program implementation of state machine idea in single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- I need help. I am using AD17 to learn how to draw a 4-layer board. Is there any good teaching guide?
- Also on the G-question of the electronic competition
- Basic Concepts of A/D and D/A
- Dear masters, please answer this for me. I am waiting.
- EEWORLD University Hall----Live Replay: ADI Motor Control Solutions
- Here are some more
- Personal understanding of DSP_28335's interrupt PIE system
- Introduction to the method of board-level online compilation and downloading of C6000 DSP code
- How to draw this shape of 0.35x0.35
- EEWORLD University ---- ARM (IMX6U) bare metal video tutorial (punctual atom)