How to Make an OwlBot: the Bird Intimidator – Part 5: Mechanical Movement

by Motbots in Circuits > Arduino

32 Views, 0 Favorites, 0 Comments

How to Make an OwlBot: the Bird Intimidator – Part 5: Mechanical Movement

OwlBot-Website-Banner-Part-5.png
Linear-Solenoid-with-specs.png
Solenoid Test: How to Make an OwlBot - Part 5: Mechanical Movement

In this part of the project we’re going to be performing the fifth 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 5

This is part five. This fifth part of the OwlBot project will involve setting up its ability to perform mechanical movements. We will be using a pair of solenoids to move wings we’ll design and make later in the build process, and a DC motor that will have a propeller attached to its shaft, which we’ll use as an extra form of movement on our rigid plastic owl that we’re using for the body of the OwlBot.

Goal of Part 5 of the OwlBot Project

Our goal at the end of this part of the project will be to have the Arduino Uno control the solenoids to activate on and off continuously, and to have the motor spin the propeller when motion is detected by the PIR sensor we added in Part 1 of the build. So, if everything works out, by the end of this part of the build, our OwlBot prototype should sense motion, which will communicate to the Arduino to perform the following actions:

  1. Play the MP3 file with owl sounds on it to the dual speakers we added to our prototype in Part 2 of the build.
  2. Flash both red LEDs that we’re using as the OwlBot’s flashing red eyes that we added to our prototype in Part 3 of the build.
  3. Activate the two solenoids and have the DC motor spin its propeller that we are adding to our prototype in this part of the build.


Solenoids

The type of solenoid that I’ll be using for this project is a 6V push-pull (linear) solenoid that, according to its technical specifications, has an electromagnetic push-pull force of 50g (1.76 ounces = 0.11 pounds). We’ll need two of them to control both faux wings of the OwlBot we’ll design later on in the project.

Solenoid Test

As previously stated, the technical specs of the solenoids I’m using have a push-pull force of 50g — which is equivalent to 1.76 ounces, or 0.11 lbs. This doesn’t sound like much force! Although, I did perform some very rough preliminary tests on how much force these particular solenoids of mine can pull, and I was pleased with their performance, based on what I’m using them for. I’ve provided a short video showing those tests above.

In the solenoid test video, I was able to get the solenoid to lift — without any assistance — a 9V battery with its snap connector, which is a combined weight of approximately 1.4 ounces, according to my measurements. I think that with what I have in mind on how we’ll make the wings and from what material we’ll be using, that this will work, but we’ll see what happens when we get to that part of the build at a later part in the OwlBot series.

DC Motor w/ Propeller

To add a little more motion than jumpy wings that the solenoids will probably provide, we’re going to add a small DC motor and propeller to the OwlBot. This may seem silly and even sound odd to put a propeller on our owl figure later in the build, but we’re pretty limited on how we can provide movement to our OwlBot. Having a motor with spinning propeller will help add motion to frighten critters away. Remember, that is the purpose of the OwlBot.

The DC motor I’m using is one that I had managed to scrap off some other device in the past, of which I do not remember what from, but any small DC motor with a shaft will do. Just make sure that you get a motor with a shaft long enough to hold a propeller. You can purchase hobby motor kits that come with several motors, propellers, and even motor mounts for pretty cheap. I’ve provided a link to one I’ve purchased in the past in the parts list below.

Supplies

ATMEGA328P-Microcontroller.png
ATmega328P_Absolute-Maximum-Ratings.png

Parts List

  1. 2x DC 6V Push Pull Solenoid
  2. 1 each DC Motor w/ Propeller
  3. Variety of Colors of Test Hook Clips to Breadboard Male Jumper Wires
  4. Various Colors and Sizes of Jumper Wires
  5. 2x RFP30N06 Logic Level N-Channel MOSFET
  6. 1x IRF840 Power MOSFET
  7. 3x 10kΩ Resistor
  8. 2x 1N4001 Diode
  9. 1x 0.1µF Capacitor


Tools Used in Project

  1. The Ultimate DIY 3220-Point Breadboard (Optional)
  2. Digital Multimeter


Prototyping the Circuit

Previously, for Part 3 of the OwlBot prototype we successfully made all the connections needed for the red LEDs we added to our circuit, and then created the code to have those LEDs flash when motion was detected by the PIR sensor. Now we need to add to this prototype a pair of solenoids and a DC motor that will provide mechanical movement for the OwlBot. We also need to update the code and add to it the functionality we need to get the solenoids to activate and motor to spin when motion is detected by the PIR sensor.

In Part 4 of the build, we upgraded — we actually modified — the power supply for our OwlBot prototype circuitry. To power the new power hungry devices we’re adding in this part of the build, we added another 9V battery supply made up of six AA batteries to our prototype. We’ll use this upgrade to power both the solenoids and the DC motor. Our original 9V battery supply we’re still using to power the Arduino and the devices we’ve connected to it, thus far in the build.

As mentioned in the previous parts 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!


Arduino Uno’s ATmega328P Absolute Max Ratings

Before we get started with anything for this part of the build, we first need to go over the Arduino Uno’s ATmega328P microcontroller, and its absolute maximum ratings to gain an understanding of what we need to do to hook up our components properly to prevent damage to the Arduino Uno and its microcontroller.

If we take a look at the table above, we see that the values within it are the absolute maximum ratings for the I/O (Input/Output) pins of the Arduino Uno’s ATmega328P microcontroller.

Looking at the values above, we can determine what we’re limited to, based on the microcontroller’s ratings. What we want to focus on are the following:

  1. DC Current per I/O Pin: 40mA
  2. DC Current VCC and GND Pins: 200mA

The datasheet is telling us that the DC current from each of the I/O pins, both analog and digital of the Arduino, is limited to 40mA. The DC current of the VCC and ground (GND) pins are limited to 200mA. The datasheet also states that stresses beyond these listed ratings may cause permanent damage to the device.


Using a USB to Power an Arduino Uno

There’s more to know though, about the power from an Arduino Uno. One thing to know is that the 5V pin of the Arduino is not connected through the microcontroller, so in theory, it could supply more power, however when powering the Arduino from the USB, this limits total power consumption to 500mA, which is shared among devices on the Arduino. This sharing means that available power will be less. As a safe bet, it’s best to keep the total power consumption to around 400mA, when powering the Arduino with a USB.

Using an External Power Supply to Power an Arduino Uno

In our case, we’re using an external power supply from a 9V battery. This 9V battery power supply is connected via a DC barrel jack to the Arduino board. This 9 volts is then lowered to 5V by the 5V regulator in the circuitry of the Arduino board. This regulated 5 volts is rated up to 1A, but is thermally limited, so when drawing power the regulator will heat up and shuts down temporarily when overheated. As a safe bet, it’s best to keep the total power consumption to around 900mA, when powering the Arduino with the 9V battery power supply.

Just to complete this analysis of the ratings of the Arduino and its microcontroller, the 9V battery power supply would also be lowered to 3.3V by the 3.3V regulator in the circuitry of the Arduino, making this supply available to the 3.3V pin. The 3.3V output is able to supply a maximum of 150mA, limited by the regulator onboard the Arduino.

Caveat for 3.3V Output of Arduino Uno

There is a caveat though for the 3.3V output, in that any power drawn from the 3.3V power rail also has to go through the 5V power rail. So, you must keep in mind that whatever current is being drawn from a device on the 3.3V output, you also need to consider it against the current being drawn from the 5V output. For example, say you have a device on the 3.3V output drawing 80mA, then you may want to limit any device on the 5V output to be around 300mA or so if powering the Arduino Uno with a USB, or around 800mA or so if powering the Arduino Uno with an external power supply.

Summary of Max Ratings for Arduino Uno

The following is a summary of the absolute maximum ratings for the Arduino Uno’s ATmega328P microcontroller and the Arduino Uno board mentioned above:

  1. Absolute Maximum Rating for DC Current per I/O Pin: 40mA
  2. Absolute Maximum Rating for Total Current From All I/O Pins: 200mA
  3. Maximum Current Rating From the 5V Output Pin:
  4. When Using a USB to Power the Arduino: 400mA
  5. When Using an External Power Supply to Power the Arduino: 900mA
  6. Maximum Current Rating From the 3.3V Output Pin: 150mA

Now that we know the absolute maximum ratings for the ATmega328P microcontroller on the Arduino Uno, we can now figure how we should connect the solenoids and DC motor properly to the Arduino itself.

Adding the Solenoids

Test-Hook-Clip.png
Solenoid #1.png
Solenoid #2.png
RFP30N06-MOSFET.png
OwlBot_Solenoids-Schematic.png
9V AA Battery Pack - Multimeter.png

Now that we have some of the preliminary stuff out of the way, let’s get to connecting the solenoids to our prototype circuit on the breadboard and to the Arduino. Each of the solenoids that I am using have two wires coming from the solenoid’s coil. To make the temporary connections from the solenoids to the breadboard, I chose to use test hook clips that are spring loaded to make secure connections to the wire ends of the solenoids. The opposite ends of the test hook clips have a male DuPont connector pin that allows me to easily place them into the points (holes) of the breadboard, as can be seen in the image above.


How to Control Solenoids with an Arduino

When using devices, like solenoids, on low power devices, like an Arduino, we can’t just hook up the wires of the solenoids directly to the pins of the Arduino and expect everything to work. Solenoids require higher voltages and currents than a microcontroller alone can provide.

The solenoids that I’m using for this OwlBot project are a generic brand that was ordered from the rainforest store online. There was not a lot of info about the solenoids, except for the supposed push-pull force that they had (see Solenoids above) and their voltage requirements. Here’s what I care to know about them at this point:

  1. 6V Push-Pull Solonoids (x2)
  2. A pull force of approximately 1.4 ounces, as was tested previously under the Solenoids heading, above.

In order to find out how much resistance the solenoids have across their terminals, I took my multimeter and made a reading across each solenoid’s wire terminals using the 200Ω setting on my multimeter. We’ll need this information later to measure about how much current draw the solenoids will have. The following are the readings I obtained from each solenoid:

  1. Solenoid #1: 6.3Ω
  2. Solenoid #2: 6.2Ω


So, with this information, how do we control the solenoids with an Arduino Uno? We need a way to control the on/off switching of the solenoids, and we want to control this with the use of the Arduino we’re using for our project, but we can’t just connect the solenoids to the pins of the Arduino because solenoids require higher voltages and currents than a microcontroller alone can provide.

To control the solenoids using the Arduino, we need to incorporate some extra components to our circuitry to allow us to perform the tasks we ask the Arduino to do, like switching on and off the two solenoids we’re using for the OwlBot project. But what do we need to do to make all this work?

This looks like a job for… MOSFETs!


Using MOSFETs to Control Solenoids

To give the Arduino the capability to control the solenoids with its I/O pins, we will use the help of the RFP30N06 MOSFET. The RFP30N06 is a logic-level, N-channel, power MOSFET, designed for low voltage and low current applications. The great thing about logic-level MOSFETs is that their gate can be fully turned on with lower gate voltages of around 5V or less, which is perfect for us since we’re using the Arduino’s I/O pins to send pulsed DC signals to turn the solenoids on and off.

The schematic and details shown above explains how we’re going to make our connections to the Arduino Uno and solenoids using the RFP30N06 logic-level, N-channel, enhancement mode power MOSFET.

The schematic above shows both solenoids used for this OwlBot project — Solenoid 1 (X1), and Solenoid 2 (X2). Each solenoid is connected across a diode (D1 and D2) that acts as a flyback diode, and each of those diodes are placed in reverse-bias through from the +9V battery supply to the drain (D) pin of the RFP30N06 MOSFETs (Q1 and Q2). The flyback diodes are essential for protecting the circuit from voltage spikes generated when the solenoids are turned off.

For the source (S) terminal of the RFP30N06 MOSFET, we’re just going to tie it straight to the negative supply or common ground of the circuit.

The gates (G) of Q1 and Q2 are tied to the digital pins of the Arduino Uno — pin 7 and pin 8, respectively. Digital pins 7 and 8 of the Arduino will provide the voltage we need to turn the gate of each MOSFET on. When motion is detected by the PIR sensor we added in Part 1 of the OwlBot project, we’ll tell the Arduino in code later to activate the solenoids, pulsing them on and off continuously for an amount of time.

Resistors R1 and R2 are both valued at 10KΩ — both are tied from the gate to ground, and both act as pull-down resistors to discharge the gate of each MOSFET when no voltage is applied to the gate. The gate of a MOSFET acts as a capacitor. If we don’t have a path to ground to discharge the gates, then the MOSFETs (Q1 and Q2) may not turn off completely, so having a pull-down resistor at the gate of the MOSFET ensures that the MOSFETs (Q1 and Q2) turn off. You can learn more about how MOSFETs work and their applications here.


Calculating Solenoid Current Draw

Earlier, I mentioned that I took some resistance readings across the terminals of each solenoid that I’m using for this OwlBot project. I also took a voltage reading of the 9V battery pack made up of six AA batteries we added to our prototype circuit in Part 4 of the build series — using the multimeter — and obtained a reading of 9.48V. The readings I obtained from my multimeter for each solenoid and the 9V battery pack made up of six AA batteries were:

  1. Solenoid #1: 6.3Ω
  2. Solenoid #2: 6.2Ω
  3. 9V AA Battery Pack: 9.48V


I’ll take the average of the two resistance readings earlier from the solenoids to make a general calculation, which is:

(6.3Ω + 6.2Ω)/2 = 6.25Ω

So, with this information, we have a resistance reading and a voltage reading we’ll use for both solenoids:

  1. Solenoid Resistance: 6.25Ω
  2. Voltage Across Solenoid: 9.48V


Each solenoid is powered by the 9V battery pack made up of six AA batteries we added in Part 4 of the build series, yet controlled by the Arduino and an RFP30N06 MOSFET for each solenoid. With this information, we can use Ohm’s Law to calculate the current we should be seeing through the solenoids and through the drain and source of the MOSFETs.

V = IR

I = V/R

I = 9.48V/6.25Ω

I = 1.5A

With a current this large, there’s no way we could have controlled the solenoids by just hooking them up directly to the Arduino. We must use the MOSFETs!

Adding the DC Motor W/ Propeller

IRF840.png
OwlBot_DC-Motor-Schematic.png

The reason why I am including a DC motor with a propeller on its shaft to the OwlBot project is solely to add more movement to the finished product. Once we have everything in place on the OwlBot body — the plastic great-horned owl figure — the only thing that moves other than the propeller on the motor shaft is the owl’s wings via the solenoids.

The large owl figure, the owl sounds, the flashing red LED eyes, and moving wings are great and all, but I really want to make sure I’m scaring off critters, like the mockingbird, so I’m adding the propeller too. If you don’t want to include the DC motor with propeller on your OwlBot, then by-all-means, don’t feel like you have to. Just omit this part of the project if you’d like. Otherwise, let’s continue with how to control a DC motor with an Ardunio.


How to Control a DC Motor with an Arduino

Like the solenoids we’re using in our OwlBot prototype circuit, to add a motor to the circuit and connect it to the Arduino we’re going to have to incorporate some extra components to our circuitry to allow us to perform the tasks we ask the Arduino to do, like switching on and off the DC motor.

Again, this looks like a job for another MOSFET!


Using a MOSFET to Control the DC Motor

When using a device, like a DC motor, on a low power device, like an Arduino, we can’t just hook up the wires of the DC motor directly to the pins of the Arduino and expect it to work. DC motors require higher voltages and currents than a microcontroller alone can provide.

The DC motor that I’m using for the OwlBot project was hacked off some other device, that I don’t recall off what anymore, years ago. The only thing that I know about my DC motor is that it is a Mabuchi Motor and that it’s made in China. I’m guessing that it’s a 12V motor. Running it off the 9V AA battery pack supply for seconds at a time is totally doable though, for this project.

The schematic and details shown above explains how we’re going to make our connections to the Arduino Uno and DC motor using the IRF840 N-channel, enhancement mode MOSFET.

The schematic above shows the DC motor (M1) used for this OwlBot project. One terminal of the DC motor is tied to the positive 9V AA battery pack supply, and the other terminal of the DC motor is tied to the drain (D) terminal of the IRF840 MOSFET (Q3).

The DC motor being used for this OwlBot project is a brushed DC motor, so I’ve placed a 100 nano-farad (0.1µF) shunt capacitor (C1) across the terminals of the DC motor for a few important reasons:

  1. To improve the overall power factor of the system. The power factor is a measure of how effectively electrical power is being converted into useful work output.
  2. To stabilize the voltage across the DC motor terminals. This can lead to smoother operation.
  3. To filter out certain harmonic frequencies that may be present in the system, which leads to cleaner power and improved efficiency.

Adding a capacitor across the terminals of a brushed DC motor is good practice!


For the source (S) terminal of the IRF840 MOSFET, we’re just going to tie it straight to the negative supply or common ground of the circuit.

The gate of Q3 is tied to pin 9 of the Arduino Uno. Digital pin 9 of the Arduino will provide the voltage we need to turn the gate of the MOSFET on. When motion is detected by the PIR sensor we added in Part 1 of the OwlBot project, we’ll tell the Arduino in code later to activate the DC motor, pulsing it on and off continuously — and simultaneously with the solenoids — for an amount of time.

Resistor R3, is valued at 10KΩ, and is tied from the gate to ground. This resistor acts as a pull-down resistor to discharge the gate of the MOSFET when no voltage is applied to the gate. The gate of a MOSFET acts as a capacitor. If we don’t have a path to ground to discharge the gate, then the MOSFET (Q3) may not turn off completely, so having a pull-down resistor at the gate of the MOSFET ensures that it turns off. You can learn more about how MOSFETs work and their applications here.

Solenoids and DC Motor Connections

OwlBot - Part 5 - Solenoids and DC Motor Connections_UPDATED.png

Programming the Arduino to Activate the Solenoids and Spin the Motor

Now that we’ve properly made our connections for the solenoids and DC motor on the breadboard, we can now update our code from Part 3 to get the Arduino Uno to activate them when motion is detected by the PIR sensor.

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

At our page titled "How to Make an OwlBot: The Bird Intimidator – Part 5: Mechanical Movement", 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! Stay tuned for Part 6 of this project, COMING SOON! You can check back in at our profile page here, or at the website on our OwlBot Project Series page here. Remember to keep at it and stay motivated!