Music Painting

From Microduino Wiki
Revision as of 04:09, 14 October 2016 by Fengfeng (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Outline

Anywhere musicpaint.jpg

Play your favorite songs with buzzer.


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
Buzzer 1 Sound production

Other Equipment

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


Module Setup

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


Programming

Required Program Block

Programming Thought

At first, popularize the related knowledge to numbered musical notation-note.

Mixly yinfu 1.jpg
Mixly yinfu 2.jpg

Simulate different notes with buzzer, and control the beats with delay program block, to play the song Twinkle Twinkle Little Star.

Mixly-ctrl-musicpaint.jpg
Mixly-ctrl-musicpaint1.jpg

Start to Program

1. The first piece of music
Use "Buzzer on" melody program block to set the melody, delaying 500ms representing this note lasting for one beat, delaying 500ms representing this note lasting for two beat.

Mixly-ctrl-musicpaint-code1.jpg

2. The second piece of music.
Use "Buzzer on" melody program block to set melody, and use delay to select beat.

Mixly-ctrl-musicpaint-code2.jpg

Test the result
After upload, try it to check whether you can hear the song Twinkle Twinkle Little Star as supposed?

  • Q: Why dose the music sound vague, while the program is right, there is no pause between two notes?
  • A: We can add a "buzzer off" program block to the end of each note.



Delay 500ms, so that this mote can last for one beat; add "Buzzer off" and "delay" program block to make the note pause for 50ms, separating from the next not.

Mixly-ctrl-musicpaint-code3.jpg

Test the result
After upload, it is clear between each two notes.
Set up a little music box with Lego, and install buzzer on it, and play your own music with it, then share with your friends.

Anywhere musicpaint.jpg

Technical Specification

  • The product number of buzzer:
  • The buzzer is passive.
  • For details about buzzer, 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. If you want to play music, audio decoder chip and horn are required.