Windows on Device Project Practice 3-Flame alarm production

Source: Internet
Author: User

In the first two windows on Device project practice 1-PWM dimming and Windows on Device Project Practice 2-photosensitive lamp production, we learned how to use the Intel Galileo Development Board and Windows on device to Design and complete the production of PWM dimming lamps and light-sensitive lamps. In this project, we will use the flame sensor and buzzer to complete a simple flame alarm production.

1. Flame Sensor

The flame sensor looks like an LED, the infrared receiver transistor is a sensor specifically designed to search for ignition sources, and the sensor is particularly sensitive to flame. Flame sensor using infrared flame is very sensitive to the characteristics of using a special infrared receiver tube to detect the flame, and then convert the brightness of the flame into a high and low level of change signal, input to the central processing Unit, the central processing unit according to the signal changes to make the corresponding program processing.

The short lead end of the infrared receiving transistor is negative, and the long lead ends are positive. Follow the negative to the 5V interface, and then connect the positive and the 10K resistor, the other end of the resistor is connected to the GND interface, and finally from the flame sensor's positive extreme column access to a jumper, the other end of the jumper is connected to the analog port. As shown in 1.

Figure 1: Connection of the flame sensor

2. Components and hardware connections

The components to be used in this practice project are:

    • Flame sensor: One
    • Buzzer: One
    • 10K Resistor: One
    • Breadboard Test jumper: several

1 ) The buzzer connection

The buzzer has two pins, labeled "positive" polarity of the pin-to-Galileo digital interface output, "negative" polarity of the pin connected to the ground Galileo. In the program control, the Galileo digital interface output high and low level can be controlled buzzer ringing.

2 ) connection of the flame sensor

The flame sensor connects the flame sensor to the analog 5 interface of the Galileo according to the wiring method of the flame sensor described in 1. Complete the connection of the entire experiment.

3. Principle of Experiment

The voltage value read by the analog port is variable when there is a flame near and no flame near either of the two cases. The actual multimeter measurement shows that the analog port reads a voltage value of about 0.3V when there is no flame, and when there is a flame approaching, the analog port reads a voltage of about 1.0V, and the closer the flame is closer to the distance, the greater the voltage value.

So at the beginning of the program, we can first store a voltage value of the analog port without the flame. Then continuously read the analog port voltage value J, with the stored value of the difference k=j-i, the difference between K and 0.6V comparison. If the difference k is greater than 0.6V, then it is judged that there is a flame close to the buzzer to make a sound for alarm; if the difference is less than 0.6V, the buzzer does not ring.

4. Source code parsing

Main.cpp:Defines the entry point for the console application.
//

#include "stdafx.h"
#include "arduino.h"

int _tmain (int argc, _tchar* argv[])
{
return Runarduinosketch ();
}

int flame = 0;//defines the Flame interface as an analog 0 interface
int buzzer = 8;//defines the buzzer interface as a number 8 interface
int val = 0;//defines a numeric variable

void Setup ()
{
Pinmode (buzzer, output);//define buzzer as output interface
Pinmode (flame, input);//define Flame sensor as input interface
}
void Loop ()
{
unsigned char I, j;//define variable
val = Analogread (flame);//Read the analog value of the flame sensor
Log (L "Val:%d\r\n", Val);//output analog values and print them out
If (Val >= 600)//buzzer beeps when analog value is greater than 600
{
for (i = 0; i<80; i++)//emit a frequency of sound
{
Digitalwrite (buzzer, high);//Hair Sound
Delay (1);//Delay 1ms
Digitalwrite (buzzer, low);//No Sound
Delay (1);//Delay MS
}
for (i = 0; i<100; i++)//sound of another frequency
{
Digitalwrite (buzzer, high);//Hair Sound
Delay (2);//Delay 2ms
Digitalwrite (buzzer, low);//No Sound
Delay (2);//Delay 2ms
}
}
Else
{
Digitalwrite (buzzer, low);
}
}

4. Debug results

Start Galileo, connect using Telnet, and then click Debug. The program will be downloaded to the Galileo via the network port. When there is a flame near the flame sensor, the buzzer beeps. When the flame goes out, the buzzer alarm stops.

Debug the video link below, you can see the effect of fire alarm: http://v.youku.com/v_show/id_XODU5MzMwNDc2.html

Windows on Device Project Practice 3-Flame alarm production

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.