Design of intelligent lighting controller based on LPC2104

Publisher:小牛队Latest update time:2012-07-09 Source: 国外电子元器件 Keywords:LPC2104 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Click to browse products in a new window

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.

Click to browse products in a new window

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.

Click to browse products in a new window

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:
Click to browse products in a new window
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.

Keywords:LPC2104 Reference address:Design of intelligent lighting controller based on LPC2104

Previous article:Application of T46R14 in cold cathode fluorescent lamp converter
Next article:Program implementation of state machine idea in single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号