I have had the smart hardware Arduino 101 development board for a while now. I have bought several textbooks and have gained a preliminary understanding of Arduino’s design philosophy after flipping through them for a few months. I have also attempted a few practical operations based on examples, but unfortunately, I have not been able to get suitable sensors, which has prevented me from delving deeper into practical operations.
Today, I received a small package from the delivery guy, which contained a carefully selected variety of sensors. Since I am on duty at school this weekend, I chose one of them to try my hand at making a voice-controlled light.
Experiment Preparation
What components are needed to design a voice-controlled light?
We need one sound sensor, one LED, and three connecting wires as shown in the figure above.
Of course, the smart hardware Arduino 101 development board is essential. This small board can barely be covered by half a palm, but it is relatively expensive, costing 250 RMB out of pocket.
When doing electronic experiments, a breadboard is indispensable, as it greatly reduces the hassle of wiring.
Circuit Connection
Using a breadboard, connect the sound sensor, Arduino 101 development board, and LED with wires.
Programming
int soundPin = 0;
int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
int soundState = analogRead(soundPin);
//Serial.println(soundState);
if (soundState > 200)
{
digitalWrite(ledPin, HIGH);
delay(5000);
}
else
{
digitalWrite(ledPin, LOW);
}
}
Uploading the Program
Upload the above program to the Arduino 101 development board.
Keep the Arduino 101 development board powered on, lightly clap your hands, and you will find that the LED lights up immediately, staying lit for 5 seconds before turning off.
Experiment Insights
The entire experiment took about two hours. The circuit connections were fine, and the program design was fine, but there was no voice control effect. It was only at the end that I realized the sound sensor needed an external power supply…
As someone who studies physics, I actually did not realize that I needed to power the sound sensor…
The Arduino 101 development board is like the brain of a person, the sensors are like the eyes and ears, and the effectors are like the hands and feet. Arduino obtains external information from the sensors, analyzes and evaluates it, and then responds to the outside world through the effectors…
| Jiaozuo No. 11 Middle School Innovation Studio |
Henan Jiaozuo No. 11 Middle School’s Innovation Studio is a renowned teacher’s studio launched as part of the Qinglan Project at Jiaozuo No. 11 Middle School, and is a highly influential educational public platform in Jiaozuo City. It focuses on innovative education as its main research direction, sharing innovative cases, explaining innovative methods, inspiring creative design, guiding thesis writing, organizing participation in scientific and technological innovation competitions and patent applications, and discovering, cultivating, and achieving a group of students with innovative potential.
HenanPublic Number: huaihua_zhang
HenanSchool Homepage: http://www.jzsyz.jzedu.cn
HenanFamous Teacher Blog: http://blog.sina.com.cn/updays
Long press to recognize, follow, and share
– END –