How to Make an OwlBot: the Bird Intimidator – Part 2: Making Sounds

by Motbots in Circuits > Arduino

69 Views, 0 Favorites, 0 Comments

How to Make an OwlBot: the Bird Intimidator – Part 2: Making Sounds

OwlBot-Website-Banner-Part-2.png
Split - DFRobot DFPlayer Pro MP3 Player (DFR0768).png
DFPlayer-Pro-Mini-MP3-Player.JPG

In this project we’re going to be performing the second step of what will eventually be the OwlBot. The OwlBot will be a device that can be used as a bird intimidation tool to scare away pesky birds in the yard, around the house or barn, at restaurants, or in trees, bushes, and gardens. Hence, the phrase, “The Bird Intimidator”.

To learn why the OwlBot was created and what problem it was to solve, check out the story behind it all here.

The OwlBot (a.k.a. “The Bird Intimidator”) we’ll be making will be done in several parts. The OwlBot is an ambitious project. When complete, the OwlBot will sense motion. When motion is detected, the OwlBot should make owl sounds, perform varying movements, and flash its red eyes to intimidate and scare away pests. To put together all these tasks in one page would be too long and cumbersome, so we’ve decided to split each process we want the OwlBot to do into easy to accomplish chunks or parts as we continue on our goal to complete the OwlBot.


This is Part 2

This is part two. This second part of the OwlBot project will involve setting up its ability to make owl sounds once motion has been detected via the passive infrared sensor (PIR) we set up with our Arduino Uno in Part 1 of this OwlBot project series.

Our goal at the end of this part of the project will be to have the MP3 player, the PIR sensor, and the Arduino Uno communicating with each other so that when motion is detected the MP3 player will play owl sounds over a pair of speakers. Again, we’ll use the serial port on the Arduino IDE to print out whether or not motion is detected.


Goal of Part 2 of the OwlBot Project

A motionless, plastic great horned owl deterrent with a staring gaze might not do much over time. For the OwlBot to be effective enough to deter birds from nesting in an area throughout the year requires lifelike actions, like sound and movement. Our goal for Part 1 of the OwlBot project was to first get it to detect motion:

  1. Motion Sensing: When the OwlBot is complete, we want it to be able to sense motion of a bird or other creatures, and when it does to start making owl hooting sounds. We also want it to perform various movements, as well as flash its red eyes as an added effect to help deter pesky animals in the surrounding area. We’ll end up having all these actions done in sync when motion is detected, and we’ll use an HC-SR501 PIR sensor to get the OwlBot to detect motion.

Our goal for Part 2 of the OwlBot project is to get it to play owl sounds when motion is detected by the PIR sensor, and then we’ll move on to the other stuff later, in the proceeding parts of this build series:

  1. Sound: We want the OwlBot to make owl sounds to notify any birds around that there’s an owl in the vicinity and that they should get the heck outta dodge. This purpose is to deter the birds from nesting close by. We’ll be using the DFRobot DFPlayer Pro Mini MP3 Player to store an audio file of owl sounds to be played. We don’t want the OwlBot to be hooting non-stop all day and night though, so we’ll use the PIR sensor to help the OwlBot sense when a bird has come near it. When a bird comes within the OwlBot’s field-of-view, then it can start making its owl calls. Of course, the OwlBot will not quite be smart enough to distinguish between a human passing by or a bird, but it’ll work fine, so we’ll just ignore those details, for now.


DFPlayer Pro Mini MP3 Player

The DFRobot DFPlayer Pro Mini MP3 Player (DFR0768) is an MP3 player module that allows you to import MP3 files (and other file types) onto its onboard memory. The DFPlayer Pro supports four controlling modes: Arduino, AT command, on-board buttons, and ADKEY. We’ll be using the Arduino Uno for this project.

We’ll be using the DFPlayer Pro to store an MP3 file that contains owl sounds for the OwlBot. So, when motion is detected, this is where the sounds are coming from. The DFPlayer Pro has 128MB of storage, plenty of space for the MP3 file we’ll be using.

The DFPlayer Pro also provides dual-channel capability, which will allow us to use a couple of small speakers to spread the sound output that our OwlBot will produce.

The DFPlayer Pro has a very compact footprint, about an inch-square. It’s super easy to download a file to it; I just plugged a USB into it and into my computer, opened its file, dragged an MP3 file into its folder, and then I was done. It’s that simple!

To get the details on the PIR sensor and the Arduino Uno we’re using in this project, you can go to Part 1 of the OwlBot project here.


Alternative MP3 Player:

As an alternative to the DFRobot DFPlayer Pro Mini MP3 Player (DFR0768), you can use an older version of this family of MP3 players by DFRobot, and that’s the DFPlayer Mini MP3 Player (DFR0299). The DFPlayer Mini is a little cheaper than the DFPlayer Pro, but its configurations and hookups are a little different. I’ve provided some links here under “Programming the Arduino to Make Sounds” on our website page for this project, of people who have given excellent tutorials on how to use the DFPlayer Mini that’ll help you get setup for this project perfectly, if you choose to use the DFPlayer Mini.

Supplies

(This parts list is a continuation of the previous parts list here from Part 1 of the OwlBot project.)

Breadboard Prototyping Parts List

  1. DFRobot DFPlayer Pro Mini MP3 Player (DFR0768)
  2. 3 Watt – 8 Ohm Mini Speakers
  3. 1 kΩ Resistor
  4. USB Type-C to USB Type-A Data Transfer Cable
  5. Male-to-Male Jumper Wires


Tools Used in Project

  1. The Ultimate DIY 3220-Point Breadboard (Optional)
  2. Soldering Iron
  3. Solder
  4. Soldering Iron Tip Cleaner
  5. Mini Side Cutters


Previously, for Part 1 of the OwlBot prototype we successfully made all the connections needed for the Arduino Uno and HC-SR501 PIR sensor and created the code to detect motion. Now we need to add to this prototype the DFRobot DFPlayer Pro Mini MP3 player and speakers. We also need to update the code and add to it the functionality we need to get the MP3 player to play an MP3 file of owl sounds to the speakers when motion is detected by the PIR sensor.

Again, like I mentioned in Part 1 of this build, I will be using The Ultimate DIY 3220-Point Breadboard that was made from a separate project. I may refer to The Ultimate DIY 3220-Point Breadboard as “TUDIY” throughout this project to save me from having to say it every time.

DON’T WORRY! Even though I’ll be discussing how to make connections on TUDIY throughout the following prototyping steps, I’ll provide images of how to hook up items on a generic breadboard, so you can still follow along!


Soldering the Header Pins to the DFPlayer Pro

It’s possible that when you ordered your DFPlayer Pro Mini MP3 player that it came with its header pins not already soldered to the module board, like mine. So, we’ll have to solder the header pins to the board of the DFPlayer Pro before we can make any connections to it. To accomplish this, we’ll use the help of a breadboard to hold our header pins and DFPlayer Pro’s board in place, so that we can solder the pins to the board. We’re going to need the following:

  1. The DFPlayer Pro board and its provided header pins.
  2. A solderless breadboard.
  3. A soldering iron, soldering iron tip cleaner, and solder.


I’ve provided a video below that walks you through each of the following steps.

Trimming the Header Pins

First, take the header pins and place the shorter pin ends through the through holes from the bottom side of the DFPlayer Pro’s board. If you need to trim the header pins that were provided to you, you may do so using cutters. Just make sure that you’re trimming the header pins to match the amount of pins required to fit through all the through holes on your DFPlayer Pro board. In this case, I needed to trim the header pins down to six pins for each side of the DFPlayer Pro board.

Trick to Soldering Header Pins to the DFPlayer Pro

DFR0768_Top-Bottom-View.png

*Image Source (above): DFRobot

While holding the header pins in place in the through holes of the DFPlayer Pro board, press the longer pin ends that are facing down from the bottom side of the board into the points or holes of the breadboard. It doesn’t matter where you place the header pins into the holes on the breadboard, just make sure that your DFPlayer Pro board is positioned properly onto the header pins and that the top of the DFPlayer Pro board is facing up.

Soldering the Header Pins to the DFPlayer Pro

Trick to Soldering Header Pins to a PCB Module Board (DFPlayer Pro Mini MP3 Player)

Now all there’s left to do is to solder the pins to the board. Make sure you’re careful not to keep the tip of your solder iron onto the board for too long. You could damage the board’s copper contacts if too much heat is applied to them. Also, avoid making contact with anything else on the board with your solder iron, like the IC chips. Too much heat could damage them too.

Once you have the header pins soldered to the DFPlayer Pro board, it should be ready to accept files to be downloaded to it. We’ll do this in the proceeding steps. Above is a short video to walk you through the same steps listed above for soldering the header pins to the DFPlayer Pro.


Connecting the DFPlayer Pro for Sound

In the next steps we’ll seat the DFPlayer Pro onto the breadboard, make the proper connections, load an MP3 file onto it, and connect the speakers.

Seating the DFPlayer Pro Onto the Breadboard

Step-4_Seating-DFPlayer-Pro-Onto-Breadboard.JPG
Step 4 - Seating the DFPlayer Pro Onto the Breadboard.png

In Part 1, we connected our PIR sensor to the breadboard and its power rail, and to the Arduino. Now that we have the DFPlayer Pro ready, we can now place or seat the DFPlayer Pro Mini MP3 Player onto the breadboard and make connections to it using jumper wires. I’ve placed the DFPlayer Pro onto points b6 through b11 and points h6 through h11 onto TUDIY.

  1. Seat the DFPlayer Pro Mini MP3 Player onto points b6b11 and points h6h11 on the breadboard.

Connecting the DFPlayer Pro to Power

Step-5_Connecting-DFPlayer-Pro-to-Power.JPG
Step-5-Connecting-the-DFPlayer Pro-to-Power.png

Now that we’ve seated the DFPlayer Pro Mini MP3 Player to the breadboard, we now need to connect the MP3 player to the power rails. I’ll be using a red and black jumper wire to make the connections for power.

  1. Take a red jumper wire and place one end of the jumper wire in a point connecting it to the VIN pin of the DFPlayer Pro. Next, connect the other end of the red jumper wire to a point on the positive (+) power rail from the Arduino’s 5V supply of the breadboard we set up in Step 3 in Part 1 of the OwlBot project.
  2. Take a black jumper wire and place one end of the jumper wire in a point connecting it to the GND pin of the DFPlayer Pro. Next, connect the other end of the black jumper wire to a point on the negative (-) power rail from the Arduino’s ground supply of the breadboard we set up in Step 3 in Part 1 of the OwlBot project.

Connecting the DFPlayer Pro’s RX and TX Pins

Step-6_Connecting-DFPlayer-Pro-RX-TX-Pins_EDITED.png
Step-6_Connecting-Jumper-Wires.JPG
UPDATED_Step-6-Connecting-the-DFPlayer-Pros-RX-and-TX-Pins-to-the-Arduino.png

Next, let’s go ahead and get the DFPlayer Pro’s RX and TX pins connected to the Arduino Uno. The TX or transmission pin of the DFPlayer Pro transmits data from the MP3 player to the Arduino’s receiver pin. The RX or receiver pin of the DFPlayer Pro receives data from the Arduino’s transmission pin.


Potential Issue:

You could connect the DFPlayer Pro’s TX and RX pins to the Arduino’s RX and TX pins directly to send and receive data, but in doing so we run into an issue. The Arduino Uno only has one serial port; those are the RX and TX pins of the Arduino. This kinda presents a problem. The Arduino’s USB port and the serial port are tied together. This means that when you’re trying to compile code and upload it to the Arduino from its USB port, and you have the Arduino’s RX and TX pins (it’s serial port) connected to something else, you can run into issues when uploading your code. We’d have to remove the wires to the serial port each time we’d need to load code to the Arduino, then replace them again. Not fun.


Solution to the Issue:

To get around this issue, we’ll connect the jumper wires coming from the RX and TX pins of the DFPlayer Pro to pins 2 and 3 of the Arduino, respectively, then put into our code for those pins to be able to handle transmitting and receiving data, later when we get to that step. Much better.

I’ll be using male-to-male blue and orange jumper wires to make the connections from the Arduino to the DFPlayer Pro.

  1. Connect the male end of the blue wire to point a8, inline with the RX pin of the DFPlayer Pro Mini MP3 Player. Next connect the other male end of the same blue jumper wire to pin 2 of the Arduino.
  2. Connect the male end of the orange wire to pin 3 of the Arduino. Next, connect the other male end of the same orange jumper wire to the TX pin of the DFPlayer Pro Mini MP3 Player. In my case, point a9 is inline with the TX pin of the DFPlayer Pro on the breadboard.


Loading an MP3 File Onto the DFPlayer Pro

owl-folder-location-desktop.png
f-drive-folder-and-owl-folder.png
How to Load an MP3 File Onto a DFPlayer Pro Mini MP3 Player

Now that we have the DFPlayer Pro set on the breadboard and hooked up, let’s download an MP3 file onto it that contains some owl sounds. You can search the internet for all sorts of free owl sounds. I chose my owl sound off the website freesound.org, where I found this MP3 file for the owl sound that I ended up loading onto my DFPlayer Pro.

Once you’ve downloaded the MP3 file onto a dedicated folder onto your computer, loading the MP3 file onto the DFPlayer Pro Mini MP3 player is very easy. Let’s go through all the steps on what to do to get your DFPlayer Pro setup for the owl sounds from freesound.org:

  1. Create an account at freesound.org, if you don’t already have one.
  2. Go to the location of the owl MP3 file here.
  3. Download the MP3 file and save it to a dedicated folder on your computer. I made a folder called “Owl” on my desktop and saved the MP3 file there. So, my folder location looks something like the following:
  4. C:\Users\My_Computer\OneDrive\Desktop\Owl
  5. Get a USB Type-C to USB Type-A data transfer cable.
  6. Connect the USB Type-C end of the cable to your DFPlayer Pro Mini MP3 Player.
  7. Connect the USB Type-A end of the cable to your computer.
  8. Open the folder that has the downloaded MP3 file of the owl sounds you downloaded from freesound.org. In my case, I saved my MP3 file in a folder similar to the following file location:
  9. C:\Users\My_Computer\OneDrive\Desktop\Owl
  10. Open a second folder up on your computer of the DFPlayer Pro Mini MP3 Player’s drive location. The location of my DFPlayer Pro was under the USB Drive (F:). Yours may be different.


Changing MP3 File Name:

I ended up changing the MP3 file name from “92640__cgeffex__hoot-owl2” to “001__hoot-owl”, although this is not shown in the .gif image below. I did this in anticipation of possibly adding more files to my DFPlayer Pro later. You can have the DFPlayer Pro cycle through files when playing them and I figured that having a number system at the beginning of the file may help in that process. This is not necessary for this project though, so you can keep the name of the file or change it to whatever name you want it to be.

  1. Now all you need to do is drag-and-drop the MP3 file from the folder you downloaded it to, to the location of the DFPlayer Pro’s file. In my case, I moved my MP3 file from the Owl folder I created on the desktop to the F: drive where the DFPlayer Pro is located:
  2. FROM: ➡️ C:\Users\My_Computer\OneDrive\Desktop\Owl
  3. TO: ➡️ F:\
  4. Your MP3 file with the owl sound is now loaded to the DFPlayer Pro Mini MP3 Player and is ready to go! That’s it!
  5. You can now unplug the DFPlayer Pro from your computer.


Above is the video companion of this step to help those of whom are visual learners.

Connecting the Speakers to the DFPlayer Pro

speakers.JPG
UPDATED_Step-8-Connecting-the-Speakers -to-the-DFPlayer-Pro.png

Now we’re ready to connect the speakers to the DFPlayer Pro Mini MP3 Player. Let’s grab some male-to-male jumper wires and two 3W – 8Ω speakers to start making connections to the speakers and to the Arduino. First, let’s connect to the speakers. I’m using whatever color jumper wires I have available, so I’ll be using a yellow jumper wire and an orange jumper wire to make connections from the DFPlayer Pro to a speaker, for each speaker.

If your speaker wires are capable of connecting directly to the breadboard, then you don’t need to use jumper wires. You can just skip to the second bullet-point below to connect the red and black wires of the speakers directly to the breadboard. My speakers came equipped with a type of JST connector on the end of their wires, so I’m using jumper wires to make my connections from the speakers to the breadboard.

  1. Taking a speaker and your jumper wires, connect a yellow jumper wire to the black wire of the speaker and connect an orange jumper wire to the red wire of the speaker. Do this for both speakers.
  2. Take one speaker and connect the orange jumper wire that’s connected to the speaker’s red wire and connect it to the R+ pin of the DFPlayer Pro. This happens to be at point i9 on my breadboard. Next, connect the yellow jumper wire that’s connected to the speaker’s black wire and connect it to the R- pin of the DFPlayer Pro. This is at point i8 on my breadboard.
  3. Take your other speaker and connect the orange jumper wire that’s connected to the speaker’s red wire and connect it to the L+ pin of the DFPlayer Pro. This happens to be at point i11 on my breadboard. Next, connect the yellow jumper wire that’s connected to the speaker’s black wire and connect it to the L- pin of the DFPlayer Pro. This is at point i10 on my breadboard.

Programming the Arduino and More!

Now that you've assembled the second part of the OwlBot prototype, it's time to update the code we created in Part 1 of this project!

If you're interested in continuing this fun project and are ready to get the code for your Arduino for Part 2, then head over to our page and go to the section titled Programming the Arduino to Make Sounds here.

At our page titled "How to Make an OwlBot: The Bird Intimidator – Part 2: Making Sounds", you'll find a more detailed version for the steps of this prototype build, more close up images, and documents, as well as a more thorough parts list. You'll also find the steps and accompanying videos to instruct you to complete this project in its entirety.

Thanks for trying out this neat project. Hope you had fun! If you're ready, go to Part 3 for the OwlBot project, where we'll add the blinking red LED eyes to our OwlBot. Remember to keep at it and stay motivated!