Intelligent Acoustic-optic LED lamp

Intelligent Acoustic-optic LED lamp

Objective:

1.Understand how the light sensor works and how to use the “StartSwitch” node

2.Understand how to connect the light sensor, the sound sensor, and the LED  correctly to create an Intelligent Acoustic-optic LED Lamp.

3.Master the programming behind the multi-sensor cooperation.

I. Overview 

As environmental issues become more serious with time, the concept of energy saving is a significantly important subject up for discussion. There have been a lot of intelligent electrical devices with low power consuption, including the intelligent acoustic-optic lamp (Picture 1). With this unique lamp, it will light it up if there is any noise. Think we can make one with the Arduino/Genuino101? Let's give it a shot!

Picture 1: Acoustic-optic Lamp in a lobby

Ⅱ Analysis

There are two problems that need to be solved:

1. Judge the luminous intensity of the environment.

2. Judge the sound intensity when the luminous intensity is low. Brighten up the light when the sound intensity is higher than a certain value.

The entire project analysis is shown in Figure 1

Figure 1 : Project Analysis- Intelligent Acoustic-optic Lamp

Project Name

Intelligent Acoustic-optic Lamp

Function 

Light up when the luminous intensity of the environment is low and the sound intensity is high

Material List

Light sensor, LED

III. Basics

A. Light sensor

The light sensor, also known as an ambient light sensor, we are using this time is the analog ambient light sensor for the Arduino made by DFRobot. As shown in Picture 2, this module can detect the luminous intensity of the environment and can be used to create various interactive projects.

Picture 2: Light sensor

The light sensor is a type of analog sensor. It should be connected to the analog pin on the Arduino/Genuino101’s control panel. The range og value is between 0 to 1023 and it will output different values based on the luminous intensity. The output is proportionate to the luminous intensity. Connect the black line to GND and the red to 5V. Lastly, connect the third line to the analog pin.

B. StartSwitch node

The StartSwitch node (Picture 3) is used as the switch of the sensor. When the SmartNode program is deployed to the Arduino/Genuino101, the StartSwitch node will send 1 to the next node as a switch. 

Picture 3 StartSwitch node

C. Cooperation among multiple sensors

The SmartNode is supported by the data stream. It is completely different from traditional programming concepts in terms of multiple sensor cooperations. In this case, we will use a light sensor and sound sensor together to control the LED lamp. The general idea is to judge the data sent from the light sensor. When the figure is over a certain value, it will send “1” to the sound sensor. Otherwise, it sends “0”. When the sound sensor receives “1”, a final respond will be triggered. Finally, the system controls the LED based on the data collected by the sound senor.

Note: the SmartNode doesn't work until signal "1" passes through.

IV. Tutorial

A. Connection

First, we need to connect the Arduino/Genuino 101, extension board, sound sensor, light sensor and LED.

Here we connect the LED to digital pin 5, the sound sensor to analog pin A0 and connect the light sensor to analog pin A5, as shown in Picture 4.

Picture 4: Connection diagram

B. Program

To make the Intelligent Acoustic-optic LED Lamp, we need to judge the luminous intensity in real time. When the light intensity is lower than a certain value, judge the sound intensity and trigger the LED if the the sound intensity is larger than a certain value. We then use the delay node to turn the light off after 5 seconds. This process is shown in Picture 5.

Picture 5: Reference of the Intelligent Acoustic-optic LED Lamp

C. Set Up

To detect the luminous intensity, we need to add a StartSwitch node. Double-click the StartSwitch node and a small interface will appear. Set the output to 1 as the switch of the next node.

                                                                   

Picture 6: Setting up the StartSwitch node

We also need to add a light node from SmartNode to detect the luminous intensity. Double-click it and set it as Picutre 7 suggested.

Picture 7: Setting up the Light node

Double-click the switch node to set the value. As shown in Picture 8, click the “+ rule” button, select “<” and input 10 while creating point 1; select “>” and input 10 while creating point 2. Lastly, name it as you like.

Picture 8: Setting up the Switch node

Add a "change" node to trigger the next node when the real time luminous intensity is lower than a certain value. Double-click the change node to set it. In this case, we will set the change node to “1” or “0”, as Picture 9 suggested, to control the sound sensor and LED.

Picture 9: Setting up the Change node

Add a sound node to obtain the value of the sound intensity. Double-click to set it as Picture 10 shows.

Picture 10: Setting up of the Sound node.

Double-click the switch node to set the value of the sound. Like in Picture 11, click the “+ rule” button, select “<” and input 10 while creating point 1; select “>” and input 10 while creating point 2.

Picture 11: Setting up the Switch node

The settings of the delay node are much easier. Simply double-click it and set the time as Picture 12 shows.

Picture 12: Setting up the Delay node

The LED node settings are also very simple as we only need to enter the number as Picture 13 shows.

Picture 13: Setting up the LED node

By now, you are all set!

D. Testing

Click "Deploy", adjust the value according to the situation and you can test the device's new functionality! If it's not working as expected, ask your friends or simply post your question on our forums!

Last but not least, don't forget to share your work and learning process with your friends and colleagues!

Ⅴ. Challenge

The progamming behind the Intelligent Acoustic-optic LED lamp can be complicated, however can be quite simple after arranging the data of the nodes. However, some may think that this design is not perfect. In order to judge if there is someone passing by more accurately, how about change the sound sensor to a passive infrared sensor (PIR sensor)? Tell us what you think of this idea and whether it could work even better!

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to toolbar