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 various kinds of lamps at home, it is necessary to carefully match them together to achieve the most suitable atmosphere effect for high-quality life. At present, the control of lights is mainly manual, controlling all lamps one by one, which 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 lighting and provide functions such as scene combination not only has practical value, but also has broad market prospects.
2 Design Goals
Design an intelligent light controller and install it in each room of the house, providing rich functions such as wireless remote control, light touch light control, scene combination, preset storage, etc. Use a handheld remote control to control all lights in the house; use the scene setting button on the remote control to conveniently set the light scene and quickly switch. You can control the switch and brightness of the light by touching the button on the panel, or multiple lights enter a certain preset scene. Each light controller communicates with the home Ethernet network terminal through the RS485 bus to realize remote control and query of 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 computing speed, and is very suitable for the design of this system. The principle of the intelligent lighting controller is shown in Figure 1.
3 LPC2104 Functional Overview
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.
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 terminal, which realizes the switching of the transmission state and the reception state by setting and resetting TXEN, and is controlled through the GPIO port. PWR_UP is the energy-saving control terminal, which is programmed using a GPIO port of LPC2104 to realize the switching of the working mode and the sleep state of the wireless module; CS can be used for channel selection. 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 hardware does not have an automatic wake-up function, and a reasonable communication protocol must be adopted through software to ensure energy saving without 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, which can also realize the isolation of strong and weak currents.
Traditional dimming methods use phase-shifted triggering of thyristors to control the output power by controlling the conduction angle of the thyristors.
MOC3041 contains a zero-crossing detection circuit. When a 15mA current is input to input pin 1 and the voltage between 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. The dimming control circuit is shown in Figure 3.
[page]
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.
LPC2104 has two universal asynchronous serial interfaces (UARTs). The UARTs are disabled by default at startup and must be enabled by programming the GPIO registers.
This system uses UART1 to connect to nRF401. UART1 has a modem interface, 16-byte receive and transmit FIFOs, a built-in baud rate generator, and standard modem interface signals.
When using UART1, you must first set the connection method of the TXD1 and RXD1 pins, and then set the baud rate and working mode of the serial port to send and receive data. This system uses an 11.0592MHz crystal oscillator, does not apply PLL, and VPB is divided by 4. Set the UART1 baud rate 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 applications are often multi-arbitrary systems. In order to monitor serial port messages in real time, a serial port scanning task is generally opened in the operating environment to ensure that information is not lost. The serial port register initialization code is added to the main function of an existing project file, and a serial port scanning task is added. Due to the control of the wireless module and the system's GPIO, the scanning program must also include I/O operations. When the system receives serial port information, it will actively send a serial port information to the main task. The main task will call the response function after receiving the information to respond to the message.
7 Conclusion
The wireless communication module nRF401 integrates transmission and reception, which greatly simplifies the complexity of the lighting controller design. The intelligent lighting controller can be easily networked through the RS485 interface, providing convenience for the realization of smart home networking.
Previous article:Design of USB-CAN converter based on LPC2119
Next article:LPC2148 micro urine analyzer design
Recommended ReadingLatest update time:2024-11-16 19:27
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
- Allegro differential pair equal length setting
- Help, the turn-off speed problem related to the MOS tube drive resistor
- SIwave Chinese Training Manual
- Job hunting after the epidemic
- What are the advantages of machine vision defect detection systems?
- Happy New Year to everyone!
- How can a car's keyless entry system be hacked?
- What is a battery monitoring system (BMS)? What are its main functions? What is the BMS architecture? This article explains
- I want to learn quantum mechanics by myself. What kind of mathematics books should I read first? Thank you.
- What books are there on the desk for reading? [Show it]