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.

主站蜘蛛池模板: 中文字幕啪啪| 国产视频a| 国产成人1024精品下载| 亚洲国产成人综合精品2020| 2020亚洲精品无码| 午夜免费小视频| 亚洲国产日韩在线成人蜜芽| 综合色婷婷| 久久永久视频| 极品私人尤物在线精品首页 | 亚洲bt欧美bt精品| 国产在线拍偷自揄拍精品| 国产成年女人特黄特色毛片免 | 色噜噜综合网| 2021国产精品自产拍在线| 国产成年女人特黄特色大片免费| 波多野结衣第一页| 无码国内精品人妻少妇蜜桃视频 | 青草精品视频| 国产尹人香蕉综合在线电影| 日韩人妻无码制服丝袜视频| 中文字幕在线看视频一区二区三区| 国产精品亚洲欧美日韩久久| 在线不卡免费视频| 午夜无码一区二区三区| 蜜芽一区二区国产精品| 亚洲自拍另类| www.精品国产| 国产精品99r8在线观看| 91免费国产在线观看尤物| 亚洲精品桃花岛av在线| 国产1区2区在线观看| 欧美一区精品| 波多野结衣一区二区三区四区| 久久综合色天堂av| 无码不卡的中文字幕视频| 华人在线亚洲欧美精品| 国产三级成人| 欧洲一区二区三区无码| 亚洲视频在线青青| 国产欧美视频综合二区| 亚洲免费成人网| 黄色a一级视频| 污网站免费在线观看| 免费 国产 无码久久久| 97精品伊人久久大香线蕉| 777午夜精品电影免费看| 九九热视频精品在线| 日韩国产一区二区三区无码| 国产欧美日韩va| 国产欧美精品一区aⅴ影院| 无码免费的亚洲视频| 国产精品三级专区| 国产乱人免费视频| 免费观看国产小粉嫩喷水| 中文字幕在线永久在线视频2020| 特级aaaaaaaaa毛片免费视频| 国产精品亚洲一区二区在线观看| 久久精品aⅴ无码中文字幕| 又爽又大又光又色的午夜视频| 91九色视频网| 激情综合网址| 亚洲天堂网在线视频| 老熟妇喷水一区二区三区| 国产理论精品| 成人午夜网址| 小蝌蚪亚洲精品国产| 国产69精品久久| 国产在线自揄拍揄视频网站| 国产一区二区影院| 在线无码九区| 无码'专区第一页| 日韩黄色在线| 亚洲啪啪网| 米奇精品一区二区三区| 在线看片免费人成视久网下载| 一本大道无码高清| 在线国产综合一区二区三区 | 日韩午夜伦| 色综合五月婷婷| 中字无码av在线电影| 国产精品白浆无码流出在线看|