loading

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).

Hello everyone and welcome to my tutorial on how to create a DJ Barnyard. Ever find that your party or get together just isn't good enough, you look around and people aren't have the time you thought they would? Well look no further, DJ Barnyard is the answer! DJ Barnyard is an autonomous moving teddy bear that plays music via Bluetooth. Perfect for hanging out with friends and having around at parties! This project takes about a day and a half to make, but is well worth it in the end! First, I'll make a list of all the materials necessary to make DJ Barnyard, they are as listed:

  • 1 medium sized teddy bear (described in step 1)
  • 2 pairs of kids/baby shoes
  • 1 baby/stuffed animal hat
  • Stuffed animal accessories (optional)
  • Two mini servos (hacked to have 360 degree rotation)
  • 3D printed parts (described in step 3)
  • Sewing supplies
  • 1 ft. of velcro and burr
  • 4 ft. of elastic strap
  • 1 Portable Bluetooth speaker
  • 1 Ultrasonic distance sensor (HC-SR04)
  • 1 Arduino Uno
  • 9 V battery and connector for the Arduino
  • Small breadboard and short wires
  • Super glue
  • Scissors
  • And a drive to party!

Step 1: Buy a Teddy Bear!

The first step for this project is to buy a teddy bear. For the best end results it is best to buy a teddy bear where the face of the bear is pointed at a 90 degree angle in reference to its legs. Many stuffed animals are oriented where their face is in line with their arms and feet; this will not work well with this project. The stuffed animal I used for this project was found on the following website: Bear/Pillow

Step 2: Buy Baby Shoes and Accessories!

Newborn baby shoes or shoes made by Build-a-Bear Work Shop will work well as the shoes and housing for the servo motors that will move DJ Barnyard. The bigger the shoes the better, until they start to touch each other while on the teddy bear. So try to get shoe size that's right in that sweet spot.

As for the other accessories, a hat should be bought for the teddy bear as well. This will be used to house the ultrasonic sensor to detect distance. As for my DJ Barnyard, I bought some cool shades as an extra feature to give him some more "swag." I encourage you to do the same or even more!

Step 3: Design and Create Your 3D Printed Parts!

I have created images of all the 3D parts necessary to have a functioning DJ Barnyard. No dimensions are given for these parts as they may be subject to change depending on the size of your teddy bear, the size of the Bluetooth speaker, the size of the breadboard used for the project, and how many electrical components you plan on storing inside of the "backpack."

The first two images are of the "backpack" that will house all of the electrical components except for the servos. The small slots in the second image are very important as they allow for the backpack to be strapped and held on to the teddy bear. The curved opening is the side that will rest on DJ Barnyard's back. The curvature of the opening serves to keep the backpack box stable. You can design the opening curvature to the way that best fits you teddy bear.

The next two images show the lid for the backpack box and the lid for the Bluetooth speaker housing. The lid for the main backpack box also serves as the housing of the Bluetooth speaker. The first four images should be a nice press fit with each other. Take notice of the extrusion made at the bottom of image four. It was made to press fit inside of the top opening of image 3. Image 3 has the same type of extrusion as image 4 but cannot be seen, but is also made to press fit into the top opening of the main backpack box.

The next two images (5 & 6) are the platforms for the front two shoes that will hold the mini servos and wheels. The reasoning for the tall extrusions from the platform on these and the ones for the back two shoes are to act as fenders protecting the movement of the wheels from the teddy bear's feet.

Image 7 is the wheel design for all four legs of DJ Barnyard. It is extremely important to size the wheels correctly. Be sure to account for the platform base and shoe sole width to have a sufficient amount of the wheel protrude from the bottom of the shoe so that it can move DJ Barnyard.

Image 8 is the platform for the two back shoe wheels. Just be sure to adjust the cutout for the wheel to be either on the left or right side depending on what shoe it will be put into.

The holes cut out in the platform in image 8 are for the parts in images 9 & 10 to fit loosely into. These two parts should snap together (press fit) and should be inserted first into a wheel hole and then into the platform holes. You should see that these two parts serve as the back two wheel axles.

This step is the most time consuming part as it may take may adjustments and re-configurations to your design to get all the parts to fit into one another correctly, so plan accordingly. For most of the parts a bit of sanding may be necessary in order to get the parts to press fit nicely, but who knows, you might get lucky!

Step 4: Hack the Mini Servos

This step is very important as normal mini servos do not rotate a full 360 degrees to allow for full rotation. You must hack two mini servos to able to use them as the front two wheels of DJ Barnyard. This step is within another instructable of its own and can be found here: Hack a mini servo!

Step 5: Sew and Cut!

Now it's time to start the assembly process. In this part you will need to gather about 4 ft. of elastic strap and about 1 ft. of velcro and burr. Start by cutting four 8 in. (can change depending on the size of your teddy bear) elastic straps and 4 1.5 in. velcro and burr pieces. Sew on the long strap onto the outside side of each shoe as shown in image 1. Then sew on the smaller strap pieces on the inside side of each shoe. Attach a velcro piece on the inside of the smaller strap pieces and a burr piece on the upper inside part of each foot of DJ Barnyard.

The next step is to cut two holes out of the front of the hat accessory for the signal transmitter and receiver of your HC-SR04 sensor. Start with small holes and make them larger as you keep comparing the holes with the sensor to be sure you make a nice and tight fit between the two. The fit should look like the the last image provided.

Step 6: Circuit Schematic and Code!

The photo above is the Fritzing circuit schematic of the electronics used to allow for the autonomous movement of DJ Barnyard. The only part missing from the schematic is the 9 V battery connection to the Arduino Uno. As can be seen from the schematic (and later in the code), the ultrasonic sensor will trigger the servos to move in either forward or backward rotation via the Arduino code. Take notice that the breadboard is only used for its power rail, therefore a very small breadboard can be used for this setup.

Below is the code I used for DJ Barnyard, it is fully commented and after it I will write a brief description of its functionality:

/******************************************
PURPOSE: DJ BarnYard code

Created by Chris Perilla

DATE: 4/11/2014

*******************************************/

#define echoPin 4 // This is the echo pin

#define triggerPin 2 // This is the trigger pin

#include //Include the servo library

Servo servoLeft; //left wheel

Servo servoRight; //right wheel

/************************set-up function******************************************************************/ void setup() {

pinMode(echoPin, INPUT);//set pinmodes

pinMode(triggerPin, OUTPUT);

servoLeft.attach(10); //signal to left servo will come from pin 10

servoRight.attach(9); //signal to right servo will come from pin 9

}

/*************************main loop************************************************************************/

void loop() {

servoLeft.write(105); //run at med speed as to run at same speed as vilros servo

servoRight.write(0); // run at full speed in the same direction

digitalWrite(triggerPin, HIGH); // make a 10usec pulse

delayMicroseconds(10);

digitalWrite(triggerPin, LOW);

int distance = pulseIn(echoPin,HIGH); //now read the pulse that is sent back by the sensor //pulseIn returns the pulse length in usec

float distance1 = distance/58; //distnace in cm

if (distance1 < 25){ //if an object is detected

servoLeft.write(90); //both motors stop

servoRight.write(90);

delay(1000); //wait one sec

servoLeft.write(20); //set both servos to full speed in opposite direction

servoRight.write(180);

delay(1000); //wait another second

servoLeft.write(180); //then only the left servo to rotates so that DJBarnYard turns

delay(1500); //then it will loop back and repeat

}

}

Code Description:

For the preliminary code I define the echo and trigger pins of the sensor and the left and right servos. I include the servo library as well.

Within the void setup I set the pin modes for the Arduino including the servos using the the .attach servo function found in the Servo library.

As for the void loop section we start with the code telling the Arduino to have the servos rotate so that DJ Barnyard is moving in the forward direction. It can be seen in the commented part that one servo is running slower than the other, this is because I was using two different brands of servos. Hopefully, you don't have this problem, which will make your code a little bit more consistent. Next, we use digitalWrite, delayMicroseconds, and pulseIn to create a 10 usec pulse from the ultrasonic sensor and the pulse that is received. We then convert the pulse length to distance in cm. The if statement begins, if an obstacle is detected 25 cm or less away then the following will happen; both motors will stop, reverse, and one wheel (servo) will rotate to turn DJ Barnyard. After this if statement is completed the main loop will repeat. So, if there is no obstacle within 25 cm of DJ Barnyard after the if statement then he will move forward until such an obstacle does arise.

Step 7: Buy a Portable Bluetooth Speaker!

The reason this step is located in this part of the instructable is because as far as the electrical system for DJ Barnyard it stands alone, but is an integral part of DJ Barnyard as a whole. Any portable Bluetooth speaker is fine, just be sure that it is small enough so that it can fit on or in the 3D printed box backpack. Also, be sure you modify the backpack box lid so that it can house the speaker nicely. For my DJ Barnyard I choose this NewBee portable Bluetooth speaker: NB Speeker

Step 8: Put It All Together!

The best way to put DJ Barnyard together is by starting with his motorized shoes. Start by cutting out a space in each shoe sole for the 3D printed wheels to protrude out of. Images 1 & 2 show how the slots should look. Once this is done super glue two 3D printed wheels onto each of your hacked mini servos, then super glue each servo to its respective platform as shown in images 3-5.

You can now attach the velcro and burr together on the inside of each shoe to start to attach the shoes to the teddy bear. Next, pull the long straps of each shoe trough the bottom four holes in the backpack box. Make sure the shoes are on nice and snug. The servo wires should be tucked away under the straps so that they are not visible. Now hook up all your electrical components as shown in the Fritzing schematic earlier and place them into the backpack box. Up to this point, DJ Barnyard should look like images 6 & 7.

Now place your Bluetooth speaker inside it's compartment, put the lid on, and place that whole apparatus on the backpack box. Image 8 shows the Bluetooth spear fit and the lid above it.

Finally, place the ultrasonic sensor inside DJ Barnyards hat and fit the hat onto his head. Hint: Depending on the hat you have, the ears of your teddy bear may be able to fit through slots in the hat, this helps to stabilize the hat on its head. Add any additional accessories and VOILA! Your DJ Barnyard is ready to party! The end results should look like the last two images provided.

Step 9: Time to Party!!!

Hopefully, no major issues where encountered while making DJ Barnyard. My biggest issue was hacking the servos, some of them are very difficult to hack due to their small size. If you made it to the finished product, you'll have one mean looking party machine! Time to celebrate and jam with DJ Barnyard! The last image shows the transformation from a regular teddy bear to an awesome DJ Barnyard! Enjoy and don't party too hard!

<p>Fun! I would love to see a video of the bear working!</p>

About This Instructable

462views

3favorites

License:

More by ChrisP29:How to Make a DJ Barnyard!!! 
Add instructable to: