999精品在线视频,手机成人午夜在线视频,久久不卡国产精品无码,中日无码在线观看,成人av手机在线观看,日韩精品亚洲一区中文字幕,亚洲av无码人妻,四虎国产在线观看 ?

Design and establishment of a sensor-controlled mood lamp with a buzzer that can play music

2016-10-19 02:39:53ZhaoRuimin
無線互聯科技 2016年17期

Zhao Ruimin

(University of Liverpool, Liverpool L69 3BX, England)

Design and establishment of a sensor-controlled mood lamp with a buzzer that can play music

Zhao Ruimin

(University of Liverpool, Liverpool L69 3BX, England)

The aim of this project was to construct a sensor-controlled mood lamp composed of 16 LEDs which can display different patterns of lighting and can play songs using a buzzer. The microprocessor used was an Arduino board and the two sensors implemented onto the circuit were a light sensor and a distance sensor.

Arduino; Pulse Width Modulation (PWM); mood lamp; LED

1 Introduction

Lighting systems, electrical systems which can be controlled to provide light by users, has long been an essential part of life in the modern world[1]. The lamps used in different lighting systems have a variety of types such as low voltage lamp, electro luminescent, and neon,which all have their different function features.Lamps may also have the potential to conduct more complex lighting behavior. Typical examples of such multi-function lamps are mood lamp. They do not only aim at providing light but also contain some unique functions such as producing different lighting patterns controlled by sensors or even imitating various types of light to simulate a complex lighting system[2].

The usual lamps used in daily life might not be able to meet some special requirements apart from being turned on and off, while mood lamp using LEDs can achieve more functions which may even possesses entertainment purpose. This project is to make a LED mood lamp which can conduct complex lighting patterns and interact to different environment situations with the aid of sensors and other components such as buzzer.

The main part of mood lamp in this project has similar layout with the “starting point”. It is a 4×4 square board with 16 LEDs on it. The colors of these 16 LEDs are different and the brightness of light can be controlled by the processor. The microprocessor of this mood lamp is Arduino board. This board is very common so it is easy to use it and find relative information. The code in this kind of board is similar to C and C++ language.

The code makes the mood lamp show its light in different patterns such as wave, snake, fireworks and so on. An important feature of the blinking LEDs is that the brightness is various, which is achieved by Pulse Width Modulation (PWM) theory in code[3]. Sensors and buzzer can be added to this board with specific circuit. Each sensor has its code to run and the code can be found online.

The diffculty is how to make a good combination with all codes.

2 Method

The complete circuit of the mood lamp with sensor is presented in Figure 1.

Figure 1 Circuit Diagram of Overall Hardware

The mood lamp consists of 16 LEDs which are controlled by the Arduino processor by editing codes into the board. Light sensor, ultrasonic sensor and a buzzer were added in to the circuit. Moreover, for the wiring, different colors of wires represent different meanings or functions. Red lines are connected to the VCC and black lines are connected to the GND. Pink wires are only connected to LEDs. Grey lines represent that the current flow into the Arduino board, while green lines stand for that the current fow out from the Arduino board. Each electrical component with part of circuit will be explained respectively.

The Arduino board is the core of the mood lamp. It provides a 5 volts voltage to the 16 LEDs and the GND pin should be connected to the bread board. To connect to the 16 LEDs, PWM pins which could get analogue result with digital means were taken advantages of entirely. The serial numbers are from 2 to 13 and from A0 to A3, in total 16 pins. Also, the clock counter of it is 16MHz, which enables output pins to display various brightness using PWM theory[4].

The voltage of lighter sensor is the output signals when the lighter sensor receives lightness outside. One pin of lighter sensor was connected to the analogue input pin on the Arduino board because lightness can be seen as analogue signals. The ultrasonic sensor was taken as a distance sensor. The ultrasonic sensor receives ultrasonic and transform it to voltage signal to the processor. The trig pin controls the sensor to distinguish different level of ultrasonic, so it was connected to the digital input pin. The echo pin was connected to the analogue output pin on the board.

2.1Code Design

The main coding principle which enables the LEDs to generate various lightness than simply being turned on and off is the PWM (pulse-width modulation) theory[5]. Each time when the LED blinks, several duty cycles will be executed in succession in a very fast speed. The pulse width of each clock period is where the voltage is high. The portion of the pulse width over the period is duty cycle which can be expressed using eq.(1), where W represents pulse width, T represents period and D represents duty cycle.

Concretely, in this code, 256 steps were used for each duty-cycle which is repeated very fast (the clock frequency of this Arduino board is 16MHz[5]) for each time of blink. The LED is turned on at the beginning of one duty-cycle can then turned off at certain step, so the earlier it is turned off during the cycle, the dimmer it will be. The 256 step cycle is executed n times as specifed by the input parameter n. For each LED, the lightness value that is associated with the LED is computed frst, then for any LEDs that are not off will be turned on at the beginning of each duty cycle, and at each step, any LEDs that need to be turned off at that step will be checked out and turned off.

The four patterns of lighting display can be run in set order. This fluent change of the patterns, is achieved by function pointers. A function pointer is pointer which can point to different functions. The function pointer is used to direct the performance to different functions with all the pattern functions listed in an array.

For the triggered buzzer to play songs, we defined an array containing integers representing different tones at the beginning. These integers will be used as frequency which influence the buzzer sound. Then for a specific song, we create another array containing its own tones expressed using those defned integers in the previous array to drive the buzzer to play certain song.The arduino function tone()and noTone() were used to start and stop the generation of square wave based on the frequencies sets defned in array as explained above. This wave is the signal that controls thebuzzer to be turned on and off in a certain rhythm.

The code flow chart which illustrates how the sensors and buzzer are controlled is presented in Figure 2.

Figure 2 Sensors and Buzzer Flow Chart

2.2Procedure

Step One - LED socket soldering: The sockets were soldering with a 330 resistor and a wire on the worktable one by one. After soldering, isolated tape was used to fix two pins to prevent short circuit. This was to simplify the circuit connection and make the circuit more stable.

Step Two: Lamp main body assembling: The layout of the 16 LEDs were designed to be a 4 × 4 square. Therefore,16 marks were made on the lamp base - a plastic board based on the designed allocation of LEDs.

Step Three: Add sensors and test them: For the light sensor, some experiments were done on breadboard to fgure out how it reacted to the lightness change. After reading the material descriptions, we knew that the working principle of this sensor was that its resistance changes with the lightness change. The darker the environment is, the smaller the resistance is.

Step Four: Connect the circuit: First, 16 I/O pins including both PWM pins and digital pin of the Arduino board were chosen, and then each pin was connected to each LED socket across transistor arrays (ULN2803A). Then the sensors were added.

3 Results and Discussion

(1)When the light sensor was triggered either in darkness or under strong light, the buzzer would be triggered to play two different songs respectively. And in the same time, the LEDs would blink according to the rhythms.

(2)When the distance sensor was triggered, the LEDs would display different lighting patterns depending on which range of the distance the object is to the sensor. There were four ranges of the detectable distance from 0 to 40 with a step of 10. When the distance lied in one of these ranges, the LEDs to frst displayed 1/2/3/4 lines of LED to show which distance range it was and then displayed some specifc patterns.

(3)When none of the two sensors were triggered, the lamp would randomly display different lighting patterns.

There results were achieved by the circuit design mainly concerning the sensor connection. The changing voltage of the sensor was sent to Arduino board via PWM pin and was detected using function analogRead()in code which divided the VCC(5V)into 1024 parts so that an integer from 0 to 1024 represented the changing input voltage divided by the light sensor. The buzzer sensor was connected to Arduino board via digital pin. The distance sensor was connected to Arduino board with its sound receiving and sound sending pins both connected to board via PWM pins.

4 Conclusion and remarks

To sum up, the mood lamp built in this project has met most of the objectives since it could react to environment with the aid of a distance sensor and a light sensor by playing songs using the buzzer or display lighting patterns using the LEDs as expected. However, there are also some slight nonperfect performance which are the time delay of the reactions of the sensors and the noise produced by the buzzer when lamp is frst connected to power.

[Reference]

[1]N RODRIGUEZ. Lighting control system[EB/OL].(2016-09-10)[2013-02-10].http://casaplex.com/ what-is-a-lighting-controlsystem/, 2013.

[2]K C LIN, C S LIN. The study of a novel control method of the mood lighting emulator[J]. Optics Communications, 2015(35): 75-76.

[3]MICHAEL.Arduino-controlled mood lamp made with leds and glass vials[EB/OL].(2016-09-10)[2010-03-14].http:// nootropicdesign.com/projectlab/2010/03/14/mood-lamp/.

[4]MICHAEL B, Pulse width modulation[EB/OL].(2016-09-10)[2001-11-02].http://homepage.cem.itesm.mx/carbajal/ Microcontrollers/ASSIGNMENTS/readings/ARTICLES/ barr01 pwm.pdf, University of Maryland, 2001.

[5]ARDUINO UNO. Microcontrollers, Readings and Assignments[EB/OL].(2016-09-10)[2010-07-03].http://www.rapidonline.com/ pdf/73-4440.pdf.

帶有傳感器與奏樂蜂鳴器的LED燈的設計與裝配

趙睿敏
(英國利物浦大學,英國利物浦L69 3BX)

這個項目的目的是搭建一個帶有傳感器,能夠通過蜂鳴器奏樂的,由16個發光二極管(Light-Emitting Diode,LED)組成的情緒燈。項目中使用的微處理器是Arduino板,使用的兩個傳感器是光敏傳感器和超聲波傳感器。完成這個項目的步驟包括硬件和軟件兩部分。16個LED燈以一個塑料板為支撐物被焊接在一起構成一個正方形圖案。一個在面包版之上搭建的主要包含傳感器和蜂鳴器的電路和這16個LED燈相連接。至于軟件部分,主要的編程技巧是基于對脈沖寬度調制原理的運用,以此來實現使燈的亮度能夠平緩變化和調節的目的。不同的亮燈模式則由不同的基于Arduino編程軟件的代碼控制。最終完成的燈能夠在環境亮度低到一定程度時演奏《歡樂頌》,在環境亮度高到一定程度時演奏《一閃一閃亮晶晶》。并且在演奏音樂的時候,燈會隨著音樂節奏的快慢開和閉。而當超聲波傳感器被觸發時,將手放在距離該距離傳感器不同距離時,燈群會以不同的模式亮出不同的動態圖形。

Arduino;脈沖寬度調制(PWM);情緒燈;LED

introduction:Zhao Ruimin(1995— ), female, Shandong Jinan, undergraduate; Research direction:telecommunication.

The approaches to complete this project included both hardware and software aspects. The 16 LEDs were arranged into a 4 × 4 square shape soldered onto a plastic board and connected to a circuit containing the Arduino board and a breadboard with the two sensors and a buzzer on it. While in terms of software, the core coding principle used was pulse width modulation(PWM) which enabled the LEDs to display various levels of lightness, and all the lighting patterns were designed using coding in Arduino coding software.The fnished mood lamp was able to play when the lightness of environment detected by the light sensor is weak enough and play when the lightness is strong enough. At the same time when the buzzer was playing songs, the LEDs would light in a consistence pace with the rhythms The lamp could also display different sets of lighting patterns depending on the detected distance of an object to the distance sensor.

主站蜘蛛池模板: 亚洲中文字幕无码mv| 欧美亚洲第一页| 青草娱乐极品免费视频| 亚洲中久无码永久在线观看软件| 老熟妇喷水一区二区三区| 日本爱爱精品一区二区| 亚洲色欲色欲www在线观看| 国产av无码日韩av无码网站| 国产内射一区亚洲| 99久久国产精品无码| 亚洲一区二区视频在线观看| 久久99久久无码毛片一区二区 | 四虎影视8848永久精品| 国内精品小视频福利网址| 久久久无码人妻精品无码| 成人国产一区二区三区| 亚洲国产av无码综合原创国产| 日韩国产无码一区| 欧美亚洲国产精品久久蜜芽| 乱人伦视频中文字幕在线| 亚洲精品动漫在线观看| 日本欧美在线观看| 全午夜免费一级毛片| 精品三级在线| 任我操在线视频| 免费国产小视频在线观看| 日韩大片免费观看视频播放| 亚洲成人网在线观看| 在线无码九区| 粗大猛烈进出高潮视频无码| 99视频在线观看免费| 四虎成人精品在永久免费| 日韩一级毛一欧美一国产| 99久久亚洲综合精品TS| 日韩亚洲高清一区二区| 色网站在线视频| 亚洲国产成人麻豆精品| 国产无码精品在线播放| 无码啪啪精品天堂浪潮av| 秋霞午夜国产精品成人片| 亚洲精品第五页| 欧美精品色视频| 国产精品久久久久鬼色| 日韩区欧美国产区在线观看| 亚洲天堂免费| 麻豆AV网站免费进入| 亚洲天堂日韩av电影| 欧美一区二区啪啪| 在线无码av一区二区三区| 高清无码一本到东京热| 人妻丰满熟妇αv无码| 国产一在线观看| 日韩黄色精品| 国产内射在线观看| 国产一级无码不卡视频| 亚洲欧洲自拍拍偷午夜色无码| 日本少妇又色又爽又高潮| 国产爽妇精品| 国产亚洲美日韩AV中文字幕无码成人| 亚洲一级毛片| 青青极品在线| 久久一日本道色综合久久| 小说区 亚洲 自拍 另类| 狠狠干综合| 国产精品永久久久久| 波多野吉衣一区二区三区av| 日韩欧美91| 亚洲精品大秀视频| 国产美女在线免费观看| 亚洲清纯自偷自拍另类专区| 亚洲最大福利网站| 久青草网站| 欧美一区二区啪啪| 亚洲成a∧人片在线观看无码| 国产91色| 亚洲天堂网视频| 日韩无码视频播放| 国产高清免费午夜在线视频| 国产青榴视频| 99热线精品大全在线观看| 97成人在线观看| 国产91在线|日本|