Analog Sound Device | MindPlus Coding Kit for Arduino Started Tutorial E12

0 4409 Easy
projectImage

Chapter 5 Master Sound Devices

In the previous chapter, we learned how to control the light and brightness. In this chapter, we will learn the alarm device and ultrasonic module.

Project 1 Analog Sound Device

Alarm timer device? Wow, it looks so fancy. In fact, it’s not at all. Alarm timers are already everywhere in our life. The beeps when washing machine finishes procedure, and when memory bars or GPU isn’t properly plugged in, are made the buzzer.

projectImage

Task Navigation

1. Learn the buzzer

2. Making an analog sound device

Key Points Analysis

Learn the buzzer

We should be very familiar with speakers. Common headphones are two small speakers, as well as radios, MP3, MP4 players. The sound elements of TV and sound systems are all speakers. Speaker is also called loudspeaker. During the electro-acoustic conversion, it converts analog electrical signals into sound signals. Speaker is a wide-frequency sound device.

projectImage

The buzzer is an integrated electronic siren, which can emit monotonous sound under different driving waveforms, and is a narrow-frequency sound device. We can change the volume of the buzzer by changing the frequency.

projectImage

Ostensibly, the biggest difference between speaker and buzzer is that speaker is capable of a variety of sounds while buzzer can only make a few. For their sound mechanisms, buzzer uses piezoelectric ceramics to convert electrical signals into mechanical vibration signals, while speakers rely on an electromagnet to do the same conversion.

Command List

projectImage

Hands-On

Hardware connection

Connect button to Digital Pin 3 and buzzer to Digital Pin 8

projectImage

Hardware connection (button-3, buzzer-8)

Please match the colors when plugging

Programming

Take washing machine as an example. We simulate a simplified alarm timer on washing machine. How do we use the washing machine? First, we turn on the washing machine, and select a duration (8 minutes spin or 15 express). We press start. When the procedure is done, buzzer goes off and washing machine turns off automatically.

Write the program

We first set up the button actions to lay an overall structure:

projectImage

Then set the pitch:

projectImage

Finally, the turning off beep sound.

1. Reference program

projectImage

2. Program results

When the button is pressed, the buzzer will wait a few seconds, go off, and then stop.

3. Program analysis

projectImage

Further Exercise

Now you know how to use a buzzer, can you add LED flashing effects on top of the sound effects?

icon Program 5-1 E12.rar 165KB Download(1)
License
All Rights
Reserved
licensBg
0