Introduction: Arduino Growling Baby Dragon Purse

For this project you will need all of the following:

  • Arduino microcontroller
  • Soldering Kit (Soldering Gun, Solder, something to clean the solder off with, and possibly some helping hands).
  • Single-wire solid wire
  • Hot glue gun
  • Sewing supplies to make and/or gut a stuffed animal. (I have a loose pattern if you would prefer to make the dragon I made) If you are making one yourself you will need the additional supplies below, but you will need 1-2 cheap 7-9" zippers regardless for the purse portion.
    • Muslin and/or final fabrics
    • Thread (one to match your fabric and one for decoration)
    • Polyfil stuffing
    • Jewelry Wire (for the wings)
    • Scrap fabric or something for the eyes
    • Needle(s)
    • Scissors

Stuffed animal can be put together however you wish, with either fabric or nylon straps for the purse portion

Step 1: Select a Pattern or Stuffed Animal

I drafted the pattern above myself and the above is the only guide I had for creating my dragon. There are many free and purchasable patterns online for free that you can adapt for this project pretty easily with the instructions following. Or, if you so choose you can gut a stuffed animal, add a purse pouch, and add the Arduino kit into it.

I will lightly touch on the Purse Pouch after the electronics if you need assistance implementing it.

If you plan on gutting a stuffed animal you can go ahead and skip to step 3. I do not have instructions for doing that option, though. The basics is to use a seam ripper or some scissors and to gently remove the thread holding two pieces of the body together, about the length of the zipper you’ve obtained.

Step 2: Making My Chromatic Dragon Pattern

Above are the tracings I did on muslin to trace out my pattern. The sketch was all I really had and I used what I wanted to relatively measure the limbs and such. My plan started with making the total body about 4ft long, roughly. From there I took the circles from the sketch and used those to measure how long I wanted the legs to be (as you can see on the paper in the previous step).

I used nearly 3 yds of muslin fabric (close in texture to cotton), which is a relatively thin material. If you pick a thicker material, you likely want to thicken it up a little as the seams will be naturally more thick.

>>Some changes I wanted to add after I finished the dragon/mistakes I made: I feel I made the legs quite too skinny and lengthy, the body a bit too large, and the head possibly too small. Also, the foot pieces ended up being a bit too large when I drew them out (I drew them out to have the same length of the foot line). Lastly, the leg holes were quite too large for the legs themselves, and I ended up pinching the legs and it warped the body. (After all, this is supposed to be a very cute baby dragon). If you need to skip to the end of the tutorial and determine for yourself if the final product is to your liking. If you need it a bit cuter, I would suggest implementing these changes.

Additionally, I will link the two dA examples that helped me build the pattern, so you will be able to understand the pattern a little better. For the face centerpiece I created a long rectangle shape about 2in or so wide and maybe a ft long, and I trimmed and placed it where necessary to create the snout and the back of the head. I originally accidentally sewed too much towards the bottom of the face, so try to leave some room for the neck so your dragon can properly face forward and not be looking straight up (I mean, unless that’s what you prefer.)

Link 1

Link 2

After cutting your materials, go ahead and sew starting with the legs. Leave some room at the bottom for the feet, and then you will close up the rest of the leg after the feet are attached. After you sew all four legs together properly, you can move onto the face or body.

The body is pretty simple. Similar to the face I added a long rectangle (about the height of the shortest part of the body pieces, and I altered the length as I placed it) for the stomach. When sewing the stomach, leave an open area on one side about the length of your zipper (maybe a little bit longer just incase. This will be where your purse pouch will be located later.

After most everything else was done I made the wings with some stuffing and jewelry wire. The pattern I drew does not turn out to very nice looking wings, but I did not have time to tweak them. I stuffed them before attaching and added some wire so they retain shape. After stuffing I went back with thread and pulled them along the seams in order to make the wings look like they had more specific sections instead of looking like a fat pillow.

Step 3: Test Out Your Components and Programs

Pictured above is a test of the Ultrasonic sensor according to the instructions below.

It won't matter if you build the entire project correctly if none of your electronic components work. I will link some tutorials below that will help you test your components before proceeding with the larger project:

Here are the necessary Libraries in order to finish your program:

If you know all of your components are working, then you can proceed to build your circuit. My final circuit diagram and code will be available later on in this tutorial.

Audio Converter for WAV files

Convert files to: 16000 Hz/Mono/PCM unsigned 8-bit

*As for the speaker and SD card Reader, I had trouble finding an obvious/easy to follow tutorial for it. I linked one that was helpful but I will show a diagram in the next step that should help you understanding how it's set up.

Step 4: Testing the Speaker

#include "SD.h"

#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"


TMRpcm tmrpcm;

void setup(){
tmrpcm.speakerPin = 8;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}


tmrpcm.setVolume(6);
tmrpcm.play("02.wav");
}

void loop(){  }

The above test program plays the sound 02, which was converted to the proper WAV type file (if you missed that part, return to step 3 for a link to a converter and the parameters) and is played at volume 6, the highest possible volume before things start dramatically messing up. It plays it in setup, so it only plays once each time it's reset. If you want to test multiple sounds or place the sound in the void loop, make sure you add a delay after each sound, as the sounds will stack and sound like a rattling noise otherwise.

Note: The second image where it says "I want to hurl myself into the sun"? Ignore the setup in that one. The third picture is an accurate depiction of the properly wired circuit, which corresponds to the diagram also above.

SETUP (As seen in the diagram):

SD Card Reader:

  • CS - Pin 4
  • SCK -Pin 13
  • MOSI - Pin 11
  • MISO - Pin 12
  • VCC - 5v Power (NOT 3.3v)
  • GND - GND

Pin 9 connects to a resistor which connects to the center line of the transistor (The base pin). If you're looking at the half circle transistor as if it's the sunrise, the left connected to the ground and the right connected to the speaker (the blackwire/ grnd), and the power (redwire/+) of the speaker connects back to 5V.

Also Note: If you set the volume any higher than 6 in the program, the sound will come out as a popping noise that vaguely resembles your audio instead of your actual audio!!

Step 5: Testing Out Your Circuit / Building the Final Circuit

Above is the diagram I Drew out of the final. There are some slight changes as I opted not to include LEDS in my build and added the button after I had already soldered everything to the Shield.

As you can see, with the shield you can just garbage–group the entirety of the GND and 5V wires in a blob in two different places on the board. (Third Image)

So the Pins:

SD Reader is placed just like before:

  • CS to Pin 4
  • SCK to Pin 13
  • MOSI to Pin 11
  • MISO to Pin 12
  • VCC - 5v
  • GND - GND

Ultrasonic Sensor:

  • GND - GND
  • VCC - 5v
  • Echo - 6
  • Trigger - 7

Button:

  • Top Left: No connection
  • Top right: Pin 2
  • Bottom Left: 5V
  • Bottom Right: Resistor > Ground

And for the Speaker, as before:
Pin 9 connects to a resistor which connects to the center line of the transistor (The base pin). If you're looking at the half circle transistor as if it's the sunrise, the left is connected to the ground and the right connected to the speaker (the blackwire/ grnd of the speaker/-), and the power (redwire/+) of the speaker connects back to 5V.

Step 6: Final Program

#include <NewPing.h>

<p>#define TRIGGER_PIN  7  // Arduino pin tied to trigger pin on the ultrasonic sensor.<br>#define ECHO_PIN     6  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 500 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
const int ledPin =8;
const int buttonPin = 2; //pin assignment const bc won't change</p><p>NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.</p><p>//libraries and defs for SD card</p><p>#include "SD.h"                      // need to include the SD library<br>#define SD_ChipSelectPin 4 //using digital pin 4 on arduino nano 328
#include "TMRpcm.h"           //  also need to include this library...</p><p>TMRpcm tmrpcm;   // create an object for use in this sketch<br>int buttonState = 0;
//end libraries and defs for SD card</p><p>void setup() {<br>     pinMode(ledPin, OUTPUT); //for LED setup
     pinMode(buttonPin, INPUT); //button setup
     Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.</p><p>     tmrpcm.speakerPin = 9;</p><p>if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:<br>                Serial.println("SD fail");  
                return;
        }
tmrpcm.setVolume (6);
  
}</p><p>void loop() {<br>         delay(500);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
         unsigned int distanceRead = sonar.ping(); // Send ping, get ping time in microseconds (uS).
         Serial.print("Ping: ");
         Serial.print(distanceRead / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
         Serial.println("cm");
         int tooClose = (distanceRead / US_ROUNDTRIP_CM); //settign distance interger and button state for reaction
         buttonState = digitalRead(buttonPin);
          if(buttonState == HIGH){
                  if(tooClose > 100 && tooClose < 150){   //if they are at a certain distance</p><p>                            
                             
                                      tmrpcm.play("04.wav");
                                      delay(3500);
                                     tmrpcm.play("03.wav");
                                    
                               
                           
                          delay(5000); //there is a delay no matter which noise is made.</p><p>}</p><p>} else { //beginning of mode 2/nicemode > no LED Reactions<br>                  if(tooClose > 100 && tooClose < 150)
                        {</p><p>                             
                               tmrpcm.play("01.wav");
                               delay(4500);
                               tmrpcm.play("02.wav");
                               
                      
                             // LED Code if necessary
                              digitalWrite(ledPin, HIGH);
                              delay(5000);
                              digitalWrite(ledPin, LOW);</p><p>                             
        
                          }
}
}</p>

Step 7: Some Notes on Soldering to a Shield

  • Before you Solder, and after you breadboard: I suggest making sure you can get the program to run properly first.
  • Start by trimming down the pins to as many as you need and then soldering your necessary pins to your shield. Do this lightly just to hold it in place (not while it's on the Arduino, please), as you'll be adding more solder later when you're putting things in place.
  • DO NOT SOLDER WHILE ITS PLUGGED IN TO POWER/YOUR COMPUTER. PLEASE.
  • You see the sketch above where Solder is mis-spelled and it's pointing to a blob that transcends two different holes of the shield to lead a connection from where a pin is to my resistor on the board? That's a Bridge. This will be the main method of connection, especially for the elements on your Shield. You can lay them out any way you truly desire on your shield.
  • Do not Solder to the Shield/pins while the shield is on the Arduino, you will risk shorting something out!
  • You do not need a separate battery grnd/5v connection. The Arduino has it's own power regulation and all you will need is a small, simple battery adaptor. (You know the plug that almost resembles an audio jack? It's that.)
  • You can run wire to/from the Shield to have your sensor, for example, far from the Arduino base if you prefer. I preferred, and I did that. You can see in the image above the green wire Running from 4 and to the SD card reader. You especially want to run wire to the Ultrasonic sensor, since you want it to be placed conveniently towards the front of the stuffed animal (or whichever side you decide to detect people from). Make sure the wire is solid core (it's not a requirement but it will make your life a thousand times easier).
  • After Soldering make sure you check all of your connections to make sure they're bridged correctly! You may also have cold connections if you have not reached the correct heat with the soldering gun. If you have a cold connection, it will look significantly less shiny than the proper connections and look very blobby. Some proper connections can sometimes look blobby when there's just a lot of Solder, so mainly look at the texture. If your Arduino is not running
  • Try to not accidentally cross the connections. You can cause a short, or at worst... an explosion. If you think you've crossed some connections you can always reheat the solder and try to remove it/redirect it. Make sure you check both the top and the bottom for loose or incorrect connections, as this can happen on either side of the shield board.
  • Sometimes when trying to form a bridge, you will end up with lots of excess solder on the other side of the board. This can create cross connections so watch out. After you've finished a connection, check both sides of the board. You can always reheat and remove these sections or even cut them off with wire or flush cutters.
  • After you're done with a long or pokey wire that has been soldered and connected, cut off the excess. You don't want anything poking out and prodding the Arduino improperly. You can cause a cross connection or a short that way as well.

Step 8: Reinforcing Your Electronics and Placing Them

After you've proven that it works, smother it with hot glue. You can even do this while it's plugged into it's power source. Just do this so the thing does not perish as soon as you're shoving it in the animal.

Step 9: Gutting/Purse Pouch

"Right side":

Right side to right side: Fabric will often have a "right side." Often this is the side with the pattern proper. If the sides are the same color/texture, then it is less dire to make sure the right side is the correct right side. It's just normal practice with sewing so that the seams face safely inwards to avoid further unraveling.

For the purse portion, you need a rectangle, or really any shape you want the purse to be. I made one that was sort of rectangular but not very even at all, so the shape isn’t super important. You need to put one of your zipper on the inside towards the neck, this is for turning inside–out easy and for accessing the electronics if the code needs to be fixed or the Arduino repurposed easily. Two of the other sides should be sewn, and the last side should be sewn a little on the sides, but remember to leave room for the final outer–zipper when you attach it. (Image 1, the pouch by itself)

If the animal is particularly furry, you won't have to worry as much about the seam facing the proper side apart from the seams being safer and in correct practice.

When attaching the purse, treat it a if it were another limb. Put right sides to right sides, and simply flip it inside out when you’re done. (Image 2 shows it all inside out with the pouch attached) You can either attach the zipper at the same time, or attach it after the pouch (which was honestly easier for me to figure out). (Image 3, after flipping it right side out the final zipper was added).

After this, if you were making your stuffed animal, you can proceed to stuffing it with the plastic poly–fill.

Whether gutting or creating your stuffed animal, this is where you would create a hole for the ultrasonic sensor to pop out. You can either create an inner holder to see it in place, with circles on the outside to create openings, or the simpler route that I took: just cut two slits using the sensor as a guide. The slits should line up ideally with the diameters of the circles. Fold the slits inwards (if the stuffed animal is right side out, as it should be), just so the edges won’t be fraying. Sew with whatever stitch you prefer, and you can poke the electronics through. Of course, at this point everything should be soldered together and reinforced with hot glue.

While placing the electronics, pay close attention to where you are placing the button and speaker. You want to be able to easily reach the button, but not have it squished up against the edge. The speaker placement is not as dire, but it would make more sense to have it up towards the throat of the stuffed animal.

Step 10: Done!

That's it, you're done. You can easily open the zippers to check on or alter your electronics later. It's pretty easy to change out the battery, but I don't suggest storing it in there when you're not using it.

Arduino Contest 2017

Participated in the
Arduino Contest 2017