Difference between revisions of "Electronic Welcome"
From Microduino Wiki
(Created page with "Electronic Welcome") |
|||
Line 1: | Line 1: | ||
− | Electronic | + | {{Language| Electronic Greeter}} |
+ | {| style="width: 800px;" | ||
+ | |- | ||
+ | | | ||
+ | ==Objective== | ||
+ | This Electronic Greeter will play happy music when someone walking by. | ||
+ | [[File: Electronic_greeting-music.jpg|600px|center]] | ||
+ | |||
+ | ==Schematic== | ||
+ | Microduino-PIR sensor will detect if there is someone moving. If there is, this device will get lighten and play music, which lasts for a while and then stop. | ||
+ | [[File: Electronic_greeting-sch.jpg|600px|center]] | ||
+ | |||
+ | ==Equipment== | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | |Module||Number||Function | ||
+ | |- | ||
+ | |[[mCookie-CoreUSB]]||1||Core board | ||
+ | |- | ||
+ | |[[mCookie-Hub]]||1||Sensor pin board | ||
+ | |- | ||
+ | |[[ mCookie-Audio]]||1||Audio module | ||
+ | |- | ||
+ | |[[ mCookie-Amplifier]]||1||Amplifier module | ||
+ | |- | ||
+ | | [[mCookie-BM]]||1||Battery management | ||
+ | |- | ||
+ | | [[Microduino-PIR]]||1||Pyroelectric Infrared Radiation sensor | ||
+ | |- | ||
+ | | [[Microduino-Color led]]||1||Colored light | ||
+ | |} | ||
+ | |||
+ | *Other Equipment | ||
+ | **Two Loudspeakers | ||
+ | **One cell of battery | ||
+ | [[File: Electronic_greeting-module1.jpg|600px|center]] | ||
+ | [[File: Electronic_greeting-module2.jpg|600px|center]] | ||
+ | ==Program Download== | ||
+ | *Setup 1:Connect CoreUSB and PC/Mac with an USB cable, and open Arduino IDE. | ||
+ | [[Image:CoreUSB_Ble_pc.jpg|600px|center]] | ||
+ | *Setup 2:Click file>example>> mCookie > _204_JoyfulGreeter. | ||
+ | [[File: Electronic_greeting-upload2.jpg|600px|center]] | ||
+ | *Setup 3:Select the right board card and COM port, then download the program. | ||
+ | [[File: Electronic_greeting-upload3.jpg|600px|center]] | ||
+ | ==Software Debugging== | ||
+ | *Function description: | ||
+ | **” audio.h”(File that controls Audio to play music.) | ||
+ | **“colorWipe()”(Function to control LED color.) | ||
+ | *Serial port usage of the Audio module needs to be decided jumpers on the board. Default Serial (2,3) | ||
+ | <source lang="cpp"> | ||
+ | #include <SoftwareSerial.h> | ||
+ | |||
+ | SoftwareSerial mySerial(2, 3); // RX, TX | ||
+ | |||
+ | //#define AUDIO_PORT Serial1 //Core+ | ||
+ | #define AUDIO_PORT mySerial //Core</source> | ||
+ | * Control pin description | ||
+ | <source lang="cpp"> | ||
+ | #define humanHotSensor 4//PIR sensor D4 | ||
+ | #define PIN 6//Colored light | ||
+ | </source> | ||
+ | |||
+ | *Send serial instruction to control Audio by detecting human movement via PIR. | ||
+ | <source lang="cpp"> | ||
+ | if (humanHotState) { | ||
+ | colorWipe(strip.Color(125, 125, 125));//The colored light is on | ||
+ | |||
+ | if (!playing) { | ||
+ | Serial.println("play sound....."); | ||
+ | // audio_play(); | ||
+ | audio_choose(1);//Play audio | ||
+ | playing = true; | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | playing = false; | ||
+ | //audio_pause(); | ||
+ | Serial.println("stop sound....."); | ||
+ | colorWipe(strip.Color(0, 0, 0)); | ||
+ | } | ||
+ | </source> | ||
+ | ==Hardware Buildup== | ||
+ | *Setup1:Connect PIR sensor to D4 pin of Sensorhub and colored light to D6 pin. | ||
+ | [[file: Electronic_greeting_setup_1.jpg |600px|center]] | ||
+ | For connection method, please refer to the following picture. Mind connection order, which starts from LED interface IN to Out. It can control six LED lights at most. | ||
+ | [[File:CoreUSB_Ble_steup11.jpg|600px|center]] | ||
+ | *Setup 2:Insert TF into AudioShield. | ||
+ | [[File: _MusicBox_Joystick _TF.jpg|600px|center]] | ||
+ | *Setup 3:Stack AudioSheild and Audio together for TF card reader use. Connect PC via Auido, you can save music into TF card. Here it can only save one piece of music and the play duration shouldn't be long. | ||
+ | *Setup4:Connect two loudspeakers to Amplifier and stack Audio, AudioShield and Amplifier. | ||
+ | [[file: Electronic_greeting _3_speak.JPG|600px|center]] | ||
+ | *Setup5:Connect the activated battery box to BM. | ||
+ | [File:CoreUSB_Ble_steup2.jpg|600px|center]] | ||
+ | *Setup6:Stack all the modules without fixed order (Except that Audio, AudioShield and Amplifier should be stacked together.) | ||
+ | [[file: Electronic_greeting _steup_ok.JPG|600px|center]] | ||
+ | |||
+ | ==Result== | ||
+ | When it detects someone moves, the colored led will turn on and play music. You can build a beautiful frame with LEGO. | ||
+ | [[file: Electronic_greeting _legao-ok.JPG|600px|center]] | ||
+ | |||
+ | ==Video== | ||
+ | |||
+ | |} |
Latest revision as of 08:17, 22 September 2015
Language: | English • 中文 |
---|
ContentsObjectiveThis Electronic Greeter will play happy music when someone walking by. SchematicMicroduino-PIR sensor will detect if there is someone moving. If there is, this device will get lighten and play music, which lasts for a while and then stop. Equipment
Program Download
Software Debugging
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
//#define AUDIO_PORT Serial1 //Core+
#define AUDIO_PORT mySerial //Core
#define humanHotSensor 4//PIR sensor D4
#define PIN 6//Colored light
if (humanHotState) {
colorWipe(strip.Color(125, 125, 125));//The colored light is on
if (!playing) {
Serial.println("play sound.....");
// audio_play();
audio_choose(1);//Play audio
playing = true;
}
}
else
{
playing = false;
//audio_pause();
Serial.println("stop sound.....");
colorWipe(strip.Color(0, 0, 0));
} Hardware Buildup
For connection method, please refer to the following picture. Mind connection order, which starts from LED interface IN to Out. It can control six LED lights at most.
[File:CoreUSB_Ble_steup2.jpg|600px|center]]
ResultWhen it detects someone moves, the colored led will turn on and play music. You can build a beautiful frame with LEGO. Video |