Elec P093-Procedure
Elec P093-Procedure
https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p093/electricity-electronics/arduino-voice-controlled-
lamp (https://www.scie nce buddie s.org/scie nce -fair-proje cts/proje ct-ide as/Ele c_p093/e le ctricity-e le ctronics/arduino-v oice -controlle d-lamp)
Experimental Procedure
Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might
want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can
learn more about the engineering design process in the Science Buddies Engineering Design Process Guide (http://www.sciencebuddies.org
/science-fair-projects/engineering-design-process/engineering-design-process-steps) .
Before you buy parts for your project, you will need to decide what appliance(s) you want to control, and how you want to control it. For
example:
Will you control more than one appliance? What commands do you want to use? For example, if you are controlling a single
lamp, the words "on" and "off" are probably sufficient. If you want to control multiple appliances independently, you may need
different commands, such as "turn on the light" and "turn on the fan."
Do you want your voice control system to respond to everyone (speaker-independent) or only to you (speaker-dependent)?
Where will your appliance, Arduino, and microphone be located? For example, do you want to be able to walk into a room and
use your voice to turn on a floor lamp that is across the room? Will you control a desk lamp while sitting at the desk?
What is your budget? Some of the modules are more expensive than others.
Is there potential for background noise?
You can always modify your plan later, but make sure you know what you want to do before you start buying parts.
Based on your plan for your voice control system, you will need to choose a speech recognition module for your Arduino. There are
many third-party modules available with different features. You can read about the features of each module on its website. (See the
Materials section for examples). Before buying one, consider the following:
Some modules come unassembled and require soldering to attach header pins. If you do not have access to a soldering iron,
make sure you purchase a module that does not require soldering.
Some modules come with built-in commands that you do not need to train.
Some modules allow you to train new commands and some do not.
Some modules are speaker-dependent and some allow speaker-independent commands.
Different modules can store different numbers of commands of varying length. For example, some may allow you to record full
sentences, while others may only allow commands that are a second or two long.
Some modules have an on-board microphone, while other modules have a connector for an external microphone.
Determine what features you need for your voice control system based on your plan. For example, if you want the system to work for
everyone in your family, a speaker-independent module may be better. (If you use a speaker-dependent module, you will need to train
each command separately for each person.) Some of the microphones that are built into or come with the speech recognition modules
have a fairly short range. They may only work well when you are very close to them. That could be fine if you will use the device while
sitting at a desk. If you prefer to be able to control an appliance from across the room or from different directions, a module that lets you
connect a higher-quality or omnidirectional external microphone may be better.
There is no single "right answer" for which speech recognition module to buy. They all have different features and different prices. Which
one is "best" for your project will depend on your criteria and constraints. Choosing one is part of the engineering design process.
The following two sections contain instructions for using the Elechouse Voice Recognition Module V3, which allows you to train multiple
speaker-dependent commands, and the Grove Speech Recognizer, which comes pre-loaded with 22 speaker-independent commands
but does not let you train new commands. If you choose another speech recognition module, you will need to follow the instructions for
the module you purchase.
Watch this video for an overview of how to set up and use the Elechouse Module V3, or follow the written steps below.
https://www.youtube.com/watch?v=YZ0SOAFXVAQ (https://www.youtube.com/watch?v=YZ0SOAFXVAQ)
1. Solder header pins to the GND, VCC, RXD, and TXD pins.
2. Plug the microphone into the microphone jack.
3. Plug the header pins into a breadboard. Alternatively, you can use male-female (M-F) jumper wires to connect the module directly
to the Arduino without using a breadboard.
4. Use jumper wires to make the following connections to the Arduino (Figure 2).
a. Elechouse GND to Arduino GND
b. Elechouse VCC to Arduino 5V
c. Elechouse RXD to Arduino digital pin 3
d. Elechouse TXD to Arduino digital pin 2
Watch this video for an overview of how to set up and use the Grove Speech Recognizer, or follow the written steps below.
https://www.youtube.com/watch?v=z4Az6-MwPJ4 (https://www.youtube.com/watch?v=z4Az6-MwPJ4)
1. Plug the included cable into the 4-pin header on the Grove Speech Recognizer board.
2. Use jumper wires to connect the wires in the cable to your Arduino (Figure 3):
a. Black wire to Arduino GND
b. Red wire to Arduino 5V
c. Yellow wire to Arduino pin 2
d. White wire to Arduino pin 3
Caution:The IoT relay allows you to safely control a high-voltage appliance that plugs into a wall outlet using a low-voltage control signal
from a microcontroller like the Arduino. Remember that you should never cut or modify the high-voltage wires (like the power cord for an
appliance) directly.
Watch this video or follow the written instructions below to learn how to set up and use the IoT relay:
https://www.youtube.com/watch?v=p2yaFh5kuvw (https://www.youtube.com/watch?v=p2yaFh5kuvw)
1. Pull the green screw terminal connector out from the side of the IoT relay.
2. Loosen the screws, insert one end of a jumper wire into each terminal, then re-tighten the screws.
3. Connect the "+" wire to Arduino pin 13 and the "-" wire to GND. (See Figure 4.)
4. Make sure the power switch on the IoT relay is in the Off position.
5. Plug an appliance, like a lamp, into one of the "normally off" outlets on the IoT relay.
6. Upload the Blink example code to your Arduino (File > Examples > 01.Basics > Blink).
7. Turn on the power switch on the IoT relay. Your appliance should turn on and off repeatedly.
8. Turn off the power switch on the IoT relay.
Using the information in the sections above, you should now be ready to set up your own voice-controlled smart home appliance.
1. Set up your voice recognition module. You can follow the instructions in one of the sections above, or follow the instructions that
came with your module if you purchased a different one.
2. Test your voice commands and use them to control the Arduino's onboard LED so you can confirm that they are working.
3. Connect your Arduino to the IoT relay and plug in an external appliance so you can switch it on and off.
4. Depending on what you want your project to do, test it in different scenarios. For example, do the voice commands work for
everyone in your household? Do they work from across the room or if there is background noise?
5. Look at your test results and decide if your solution meets all your design requirements. If not, what can you do to improve it? Do
you need to re-train any of the commands or move the microphone to improve performance? Do you need to revisit the
requirements to get the results you envisioned?
6. Keep track of all your test results and make notes on any changes so you can communicate your work to others.
Copyright © 2002-2023 Science Buddies. All rights reserved. Reproduction of material from this website without written
permission is strictly prohibited.
Use of this site constitutes acceptance of our Terms and Conditions of Fair Use (https://www.scie nce buddie s.org/about/te rms-and-conditions-
of-fair-use ) .
Privacy Policy (https://www.scie nce buddie s.org/about/priv acy-policy)