Difference between revisions of "Electronic Greeter (X02)"

From Microduino Wiki
Jump to: navigation, search
(Assembly)
(userDef.h)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Electronic Greeter Project.jpg|right|thumb|Electronic Greeter Project Build]]
+
[[File:Electronic_Greeter_X02_Side_View_1.jpg|right|thumb]]
 +
[[File:Electronic_Greeter_X02_Side_View_2.jpg|right|thumb]]
 
=About=
 
=About=
This project uses the [[PIR sensor]] to detect heat. If a heat signature is detected. Sound will play, such as a song or a sound byte. An addition, the LED Matrix will turn on. When there is no heat signature the sound will turn off. Along with the LED Matrix.
+
This project uses the [[Sensor-PIR|PIR sensor]] to detect heat. If a heat signature is detected. Sound will play, such as a song or a sound byte. An addition, the LED Matrix will turn on. When there is no heat signature the sound will turn off. Along with the LED Matrix.
  
 
This project was designed for the second generation mCookie Maker kits (202 Advanced and 302 Expert kits).
 
This project was designed for the second generation mCookie Maker kits (202 Advanced and 302 Expert kits).
Line 37: Line 38:
 
1. Connect [[mCookie-Core|mCookie Core]] to the PC with the USB Cable. Open the Microduino IDE.
 
1. Connect [[mCookie-Core|mCookie Core]] to the PC with the USB Cable. Open the Microduino IDE.
  
2. Copy and paste the code below and upload.
+
2. Download the project file and unzip: '''<big>[[File:Electronic_Greeter_X02.zip]]</big>'''.
 +
*Using the Microduino IDE and go to '''File > Open...''' and navigate to the unzipped folder. Open the '''Electronic_Greeter_X02.ino''' file.  
  
<source lang="cpp">
 
 
</source>
 
 
3. Select the board, processor and port:
 
3. Select the board, processor and port:
 
*Go to '''Tools > Board'''  and select '''Microduino/mCookie-Core (328p)'''
 
*Go to '''Tools > Board'''  and select '''Microduino/mCookie-Core (328p)'''
Line 47: Line 46:
 
*Go to '''Tools > Port''' and select the available port
 
*Go to '''Tools > Port''' and select the available port
 
4. Upload the program by clicking on the '''right arrow icon''' on the top left of the window. Or under '''Sketch > Upload'''.
 
4. Upload the program by clicking on the '''right arrow icon''' on the top left of the window. Or under '''Sketch > Upload'''.
==Debugging==
+
 
 +
'''NOTE''': If not using the default Core module included in the kits, please follow the '''[[Selecting_board,_processor,_and_port|selecting the board and processor guide]]'''.
 +
 
 +
=Debugging=
 
*Open the Serial monitor. Information on detecting the the Audio module (successfully or failed) and start / stop playing of music will be outputted.
 
*Open the Serial monitor. Information on detecting the the Audio module (successfully or failed) and start / stop playing of music will be outputted.
  
==Tweaking==
+
=Tweaking=
 
Variables can be edited to change the threshold / detection value for various functions to better fine tune to your environment.  
 
Variables can be edited to change the threshold / detection value for various functions to better fine tune to your environment.  
 +
==userDef.h==
 +
'''DEBUG''' will enable debugging mode. Which outputs information to the Serial Port.
  
'''DEBUG''' will enable debugging mode. Which outputs information to the Serial Port.
+
'''PIR_SENSOR_PIN''' is the pin that the PIR sensor is connected to.
 +
 
 +
'''LED_MATRIX_PIN'''  is the pin that the LED Matrix is connected to.
 +
 
 +
'''LED_MATRIX_LED_COUNT'''  defines the number of pixels on the LED Matrix.
  
'''LED_BRIGHTNESS_*''' is brightness value of the (R)ed, (G)reen and (B)lue elements in the RGB LED.
+
'''LED_BRIGHTNESS_*''' is brightness value of the ('''R''')ed, ('''G''')reen and ('''B''')lue elements in the RGB LED.
 
*Adjustable between 0 ~ 255
 
*Adjustable between 0 ~ 255
 
*Default is 20
 
*Default is 20
  
'''PLAY_ENTIRE_FILE''' will play the entire mp3 file once the PIR is triggered.
+
'''VOLUME_DEFAULT''' is the default volume of the speaker outputs. The lower the value, the louder the sound. The higher the value, the quieter the sound.
 +
*Adjustable between 0 ~ 255
 +
*Default is 40
 +
 
 +
'''PLAY_ENTIRE_FILE''' if true, will play the entire MP3 file once the PIR is triggered.
 
*Default is false
 
*Default is false
  
 
=Usage=
 
=Usage=
Wave your hand in front of the PIR sensor and the MP3 should start playing. (Or it does it randomly...)
+
Wave your hand in front of the PIR sensor and the MP3 should start playing and the LED Matrix will light up.
 +
The MP3 will play as long as motion is detected. The MP3 will pause once no motion is detected. The project can be configured to play the entire MP3 file once the sensor is trigger. Refer to the [[#Tweaking]] section for more information.

Latest revision as of 22:31, 3 May 2017

Electronic Greeter X02 Side View 1.jpg
Electronic Greeter X02 Side View 2.jpg

About

This project uses the PIR sensor to detect heat. If a heat signature is detected. Sound will play, such as a song or a sound byte. An addition, the LED Matrix will turn on. When there is no heat signature the sound will turn off. Along with the LED Matrix.

This project was designed for the second generation mCookie Maker kits (202 Advanced and 302 Expert kits).

Required Materials

  • 1 x mCookie Core
  • 1 x mBattery (202/302 Kit)
  • 1 x mCookie Sensor Hub
  • 1 x LED Matrix
  • 1 x Audio Pro Module
  • 1 x MicroSD Module
  • 1 x PIR Sensor
  • 1 x Sensor Cable
  • 1 x MicroSD Card
  • 2 x Speaker
  • 1 x MicroUSB Cable

Build

Sound File

  • There should be a MicroSD card and reader included in 202 and 302 kits.
  • Put an MP3 file onto the root of your MicroSD Card with the name a.mp3. This is the file this program looks to play when activated. It can be a sound effect or a song (such as Alan Walker's Fade).
  • Or download the a simple tone effect here: http://soundbible.com/grab.php?id=1815&type=mp3. Make sure to save it on the MicroSD card as a.mp3.

Assembly

NOTE: When connecting sensor wires, push on the plastic connector and not on the wires. Pushing on the wire can damage them.

  1. Connect the PIR Sensor to the Sensor Hub on Pin 6/7
  2. Connect the Two Speakers to the Audio Pro Module.
  3. Insert the MicroSD card with the a.mp3 file into the MicroSD Module.
  4. Create two stacks containing:
    1. (Bottom of Stack) MicroSD Module | Audio Pro Module | Sensor Hub (Top of Stack)
    2. (Bottom of Stack) Core | LED Matrix (Top of Stack)
  5. Stack the two stacks onto the mBattery
  6. Plug in the MicroUSB cable to the mBattery to a computer.

Program

1. Connect mCookie Core to the PC with the USB Cable. Open the Microduino IDE.

2. Download the project file and unzip: File:Electronic Greeter X02.zip.

  • Using the Microduino IDE and go to File > Open... and navigate to the unzipped folder. Open the Electronic_Greeter_X02.ino file.

3. Select the board, processor and port:

  • Go to Tools > Board and select Microduino/mCookie-Core (328p)
  • Go to Tools > Processor and select Atmega328P16M,5V
  • Go to Tools > Port and select the available port

4. Upload the program by clicking on the right arrow icon on the top left of the window. Or under Sketch > Upload.

NOTE: If not using the default Core module included in the kits, please follow the selecting the board and processor guide.

Debugging

  • Open the Serial monitor. Information on detecting the the Audio module (successfully or failed) and start / stop playing of music will be outputted.

Tweaking

Variables can be edited to change the threshold / detection value for various functions to better fine tune to your environment.

userDef.h

DEBUG will enable debugging mode. Which outputs information to the Serial Port.

PIR_SENSOR_PIN is the pin that the PIR sensor is connected to.

LED_MATRIX_PIN is the pin that the LED Matrix is connected to.

LED_MATRIX_LED_COUNT defines the number of pixels on the LED Matrix.

LED_BRIGHTNESS_* is brightness value of the (R)ed, (G)reen and (B)lue elements in the RGB LED.

  • Adjustable between 0 ~ 255
  • Default is 20

VOLUME_DEFAULT is the default volume of the speaker outputs. The lower the value, the louder the sound. The higher the value, the quieter the sound.

  • Adjustable between 0 ~ 255
  • Default is 40

PLAY_ENTIRE_FILE if true, will play the entire MP3 file once the PIR is triggered.

  • Default is false

Usage

Wave your hand in front of the PIR sensor and the MP3 should start playing and the LED Matrix will light up. The MP3 will play as long as motion is detected. The MP3 will pause once no motion is detected. The project can be configured to play the entire MP3 file once the sensor is trigger. Refer to the #Tweaking section for more information.