Door Bell

From Microduino Wiki
Jump to: navigation, search


Outline

Anywhere doorbell.jpg

Let's learn about the new sensor——"Buzzer", and make a door bell with it.
Suitable kits: mCookie102, mCookie202, mCookie302, IBC


Module Bill

Module

Module Number Function
mCookie-Core 1 Core board
mCookie-USBTTL 1 Program download
mCookie-Hub 1 Sensor adapter plate
Crash 1 Crash sensor
Buzzer 1 Produce sound

Other Equipment

  • USB cable*1
  • Sensor cable*1
  • Sensor shell*1
  • Lego or other fixation structure
Anywhere doorbell-module.jpg


Module Setup

Anywhere doorbell-module—step.jpg
  • Assemble the modules and sensors together:
    • Stick the red core module, USB upload module and green extension module together;
    • Connect the buzzer to pin 6/7 of Hub;
    • Connect the crash sensor to pin 4/5 of Hub;
    • Insert one end of USB cable into USB upload module, and connect the other to computer;


Programming

Required Program Blocks

Programming Thought

If it has detected that the switch was pressed, the buzzer will emit "dingdong" sound.

Mixly-ctrl-doorbell.jpg

Programming

1. Wait for the crash to be pressed.

Mixly-ctrl-doorbell-code1.jpg

2. The buzzer emits "Ding".
Set the frequency of "buzzer on-frequency" program block to 1300; delay 500ms.

Mixly-ctrl-doorbell-code2.jpg

3. The buzzer emits "ding".
Set the frequency of "buzzer on-frequency" program block to 1000; delay 500ms.

Mixly-ctrl-doorbell-code3.jpg

4. Turn the buzzer off, and it will stop emitting sound.

Mixly-ctrl-doorbell-code4.jpg

5. Link the program blocks together, and upload the programs.
Test the result
After upload the program, press the switch, and you can hear the "dingdong" sound produced by the buzzer. At this time, you door bell is completed.

Q: To prevent someone pressing the bell, how can we modify the program to make the bell won't ring again during several seconds after ringing once?
A: You can extend the delay time of the buzzer off, and during this time the bell won't ring.
Add a "delay"
In the last line of the program, add a "delay" program block at the back of "buzzer off", and set the time to 3000ms.

Mixly-ctrl-doorbell-code5.jpg

Test the result After upload the program, press the switch, and you can hear the "dingdong" sound produced by the buzzer. Each time you press the door bell, only after 3s can you press again.

Anywhere doorbell.jpg


Technical Specification

  • The product number of buzzer:
  • The buzzer is a type of passive buzzer.
  • For details, please refer to Sensor-Buzzer


Related Cases


FAQ

  • Q: Why can't the buzzer ring, directly connected to the power supply?
    • A: Because the buzzer belongs to passive buzzer, only changed voltage signal can make it ring. It is the active buzzer that can ring after added voltage.
  • Q: Can the buzzer sing?
    • A: It can emit do, re, mi, fa, sol, la, si of different frequencies, and can make up music, please refer to Music Painting. If you want to play music, audio decoder chip and horn are required.