Interactive IOT Stuffed Animal
by degrooty in Circuits > Microcontrollers
1559 Views, 10 Favorites, 0 Comments
Interactive IOT Stuffed Animal
![collage-2017-06-04.png](/proxy/?url=https://content.instructables.com/FCI/GG0U/J3KFGL48/FCIGG0UJ3KFGL48.png&filename=collage-2017-06-04.png)
![IOT Stuffed Animal](/proxy/?url=https://content.instructables.com/F9W/R89M/J3EPQ7TN/F9WR89MJ3EPQ7TN.jpg&filename=IOT Stuffed Animal)
![IOT Stuffed Animal](/proxy/?url=https://content.instructables.com/F89/PX67/J3EPQ8AR/F89PX67J3EPQ8AR.jpg&filename=IOT Stuffed Animal)
![IMG_4333.JPG](/proxy/?url=https://content.instructables.com/FYY/X2CT/J3KFGKGM/FYYX2CTJ3KFGKGM.jpg&filename=IMG_4333.JPG)
![IMG_4339.JPG](/proxy/?url=https://content.instructables.com/FDT/KKKK/J3KFGKGI/FDTKKKKJ3KFGKGI.jpg&filename=IMG_4339.JPG)
For my first project with Particles's Spark Core, I decided to make an internet-connected stuffed animal! After close consideration, I settled upon a blue and green alien to be the body of this project (see the above picture.) Powered by a Spark Core, this other-worldly being lights up and buzzes whenever my cousin receives an email from me and waves its arm when a discreet button on the back is pushed. I was very happy with the finished project, and I think Brody was too!
Let's get started!
Tools and Materials
You'll need the following things to complete this project
- Pushbutton
- Spark Core Microcontroller
- Jumper wires
- 180 Degree Servo
- Three 220 Ohm Resistors
- Piezoelectric Buzzer
- A Stuffed Animal -- one you're willing to sacrifice
- Compact Breadboard
- LED
- The mental strength to perform a highly sensitive surgery
- Soldering Iron and Solder
- IFTTT Account
- Sewing kit
- Hot glue
- Scissors
Create the Circuit
![Screen Shot 2017-06-03 at 11.21.45 PM.png](/proxy/?url=https://content.instructables.com/FIE/PTR5/J3EPP6BW/FIEPTR5J3EPP6BW.png&filename=Screen Shot 2017-06-03 at 11.21.45 PM.png)
![IMG_4656.JPG](/proxy/?url=https://content.instructables.com/F9F/E7EC/J3EPO2FH/F9FE7ECJ3EPO2FH.jpg&filename=IMG_4656.JPG)
![FullSizeRender (3).jpg](/proxy/?url=https://content.instructables.com/F1N/ACTE/J3EPO2CC/F1NACTEJ3EPO2CC.jpg&filename=FullSizeRender (3).jpg)
![FullSizeRender (4).jpg](/proxy/?url=https://content.instructables.com/FTR/DN3W/J3EPO2CD/FTRDN3WJ3EPO2CD.jpg&filename=FullSizeRender (4).jpg)
![IMG_4646.JPG](/proxy/?url=https://content.instructables.com/F1C/0GPY/J3EPO2FC/F1C0GPYJ3EPO2FC.jpg&filename=IMG_4646.JPG)
![IMG_4645.JPG](/proxy/?url=https://content.instructables.com/F8N/CTMU/J3EPO2EM/F8NCTMUJ3EPO2EM.jpg&filename=IMG_4645.JPG)
![IMG_4664.JPG](/proxy/?url=https://content.instructables.com/FVN/S863/J3EPO2HV/FVNS863J3EPO2HV.jpg&filename=IMG_4664.JPG)
![IMG_4665.JPG](/proxy/?url=https://content.instructables.com/F1V/GVMX/J3EPO2KQ/F1VGVMXJ3EPO2KQ.jpg&filename=IMG_4665.JPG)
Before you start laying out the circuit. You should solder the LED and the pushbutton to long jumper wires (see above photos.) These wires will allow the components to extend to different parts of the creature's body. After this is done, grab the breadboard and plug everything thing in according to the diagram shown above. I recognize that in the picture the board is an Arduino, but all the pins are the same so you can just ignore it -- when it says to plug something into D4 on the Arduino, you should plug it into D4 on the spark core. Lastly, adhere whatever you want to move from the stuffy to the servo horn. I cut off its arm and hot glued it on. Now it's time to move onto the software aspect of this project!
Set Up the IFTTT Event
![Screen Shot 2017-06-04 at 12.04.39 PM.png](/proxy/?url=https://content.instructables.com/FLZ/E2W1/J3EPPH5G/FLZE2W1J3EPPH5G.png&filename=Screen Shot 2017-06-04 at 12.04.39 PM.png)
![Screen Shot 2017-06-04 at 12.05.01 PM.png](/proxy/?url=https://content.instructables.com/FCX/99FJ/J3EPPH5N/FCX99FJJ3EPPH5N.png&filename=Screen Shot 2017-06-04 at 12.05.01 PM.png)
![Screen Shot 2017-06-04 at 12.05.20 PM.png](/proxy/?url=https://content.instructables.com/F6S/3CI4/J3EPPH5O/F6S3CI4J3EPPH5O.png&filename=Screen Shot 2017-06-04 at 12.05.20 PM.png)
![Screen Shot 2017-06-04 at 12.05.58 PM.png](/proxy/?url=https://content.instructables.com/F5L/PG4D/J3EPPH5S/F5LPG4DJ3EPPH5S.png&filename=Screen Shot 2017-06-04 at 12.05.58 PM.png)
![Screen Shot 2017-06-04 at 12.06.41 PM.png](/proxy/?url=https://content.instructables.com/FVW/LNFK/J3EPPH5W/FVWLNFKJ3EPPH5W.png&filename=Screen Shot 2017-06-04 at 12.06.41 PM.png)
![Screen Shot 2017-06-04 at 12.07.50 PM.png](/proxy/?url=https://content.instructables.com/F6Z/1NSQ/J3EPPH5Y/F6Z1NSQJ3EPPH5Y.png&filename=Screen Shot 2017-06-04 at 12.07.50 PM.png)
![Screen Shot 2017-06-04 at 12.08.12 PM.png](/proxy/?url=https://content.instructables.com/FWV/7EOS/J3EPPH62/FWV7EOSJ3EPPH62.png&filename=Screen Shot 2017-06-04 at 12.08.12 PM.png)
![Screen Shot 2017-06-04 at 12.08.23 PM.png](/proxy/?url=https://content.instructables.com/F8S/Y8DQ/J3EPPH66/F8SY8DQJ3EPPH66.png&filename=Screen Shot 2017-06-04 at 12.08.23 PM.png)
![Screen Shot 2017-06-04 at 12.09.47 PM.png](/proxy/?url=https://content.instructables.com/FP5/262Q/J3EPPH6A/FP5262QJ3EPPH6A.png&filename=Screen Shot 2017-06-04 at 12.09.47 PM.png)
![Screen Shot 2017-06-04 at 12.10.07 PM.png](/proxy/?url=https://content.instructables.com/FKA/3GN6/J3EPPH6E/FKA3GN6J3EPPH6E.png&filename=Screen Shot 2017-06-04 at 12.10.07 PM.png)
IFTTT is wonderful, free, and easy site for basic home automation. Let's create a simple applet for the Spark Core. Read these instructions and check out the pictures above to follow along.
1. Sign into your account, and go to your applets.
2. Create a new applet.
3. Click on this.
4. Search for and select Gmail as the service.
5. Select New email in inbox from as the trigger.
6. Enter the email address you want to be notified of.
7. Click on that.
8. Search for and select Particle as the service.
9. Select Publish an event as the action.
10. Fill in the form like the following:
Event Name: Button
The event includes (data): @UserName: Text
Is this a public or private event? Public
11. Select Finish and publish the applet!
Program the Spark Core
![download.png](/proxy/?url=https://content.instructables.com/FI4/VPTC/J3EPPJ5H/FI4VPTCJ3EPPJ5H.png&filename=download.png)
If you have never used a Spark Core, the process of uploading code is fairly simple. Follow these instructions to get it connected to your local wifi: particle.io.com. After this is complete, plug the device into your computer or a different power supply, and wait for the onboard LED to pulse blue. On your computer, sign into your account at build.particle.io. The website should automatically create a new document to work on. Title it, and paste the code below into the work area. Then press Flash in the upper left hand corner to upload the code to the board! The Spark Core should turn flash violet and then return to pulsing sky blue. If the LED is green, this means the Core is not connected to Wifi, and something is wrong -- check out the troubleshooting section on the particle.io site. If the machine is functional, test it out! In case you don't understand from the code comments below, this is essentially what it is doing:
Subscribe to the Gmail IFTTT Event
Check to see if the button is pressed:
- If pressed: rotate the servo 180 degrees and another 180 degrees back.
- If not pressed: stay dormant.
Check to see if the IFTTT Event has been activated:
- If activated: turn on LED and Buzzer for five seconds.
- If not: stay dormant.
To test it, first press the pushbutton, and the servo should start moving. Next, We need to test the email function. Send an email to the gmail account you specified in the last step. Then check to make sure the Core is plugged in a wait! The LED and Buzzer response is not instantaneous. I would approximate that the average delay is around seven minutes -- not bad considering the data is traveling to so many places. If you hear a loud "BZZZZ" and the LED is flashing then congrats! You're ready for the most fun part of the project!
HERE IS THE CODE:
//The pin you want to control. int led = D0; //This is the pin where the buzzer is connected. const int buzzer = D1; //This is where the servo button is connected to the core. const int buttonPin = D4; int buttonState = 0; //Prepare the servo. int servoPin = A0; Servo servo; int angle = 0; //This function is called after the Spark Core has started void setup(){ //We set the pin mode to output pinMode(led, OUTPUT); //We "Subscribe" to our IFTTT event called Button so that we get events for it Particle.subscribe("Button", myHandler); //The button is now ready to be activated pinMode(buttonPin, INPUT); pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output servo.attach(servoPin); } //The program loop, not sure if this has to be here for the program to run or not void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH and we must turn the servo on. if (buttonState == HIGH) { for(angle = 0; angle < 180; angle++) { servo.write(angle); delay(15); } // now scan back from 180 to 0 degrees for(angle = 180; angle > 0; angle--) { servo.write(angle); delay(15); } } } //The function that handles the event from IFTTT void myHandler(const char *event, const char *data){ // We'll turn the LED and the buzzer on. digitalWrite(led, HIGH); tone(buzzer, 1000); // We'll leave them on for 5 seconds... delay(30000); //Then we'll turn them off. digitalWrite(led, LOW); noTone(buzzer); }
Insert the Electronics Into the Patient
![IMG_4642.JPG](/proxy/?url=https://content.instructables.com/FTU/G6IT/J3EPO2D5/FTUG6ITJ3EPO2D5.jpg&filename=IMG_4642.JPG)
![IMG_4643.JPG](/proxy/?url=https://content.instructables.com/FT0/RJOU/J3EPO2DV/FT0RJOUJ3EPO2DV.jpg&filename=IMG_4643.JPG)
![IMG_4644.JPG](/proxy/?url=https://content.instructables.com/FWE/DMH8/J3EPO2DW/FWEDMH8J3EPO2DW.jpg&filename=IMG_4644.JPG)
![IMG_4647.JPG](/proxy/?url=https://content.instructables.com/FJ8/ZS33/J3EPO2FD/FJ8ZS33J3EPO2FD.jpg&filename=IMG_4647.JPG)
![IMG_4317.JPG](/proxy/?url=https://content.instructables.com/FJC/KD6F/J3EPPD8G/FJCKD6FJ3EPPD8G.jpg&filename=IMG_4317.JPG)
![IMG_4320.JPG](/proxy/?url=https://content.instructables.com/F94/S9LJ/J3EPPD8H/F94S9LJJ3EPPD8H.jpg&filename=IMG_4320.JPG)
![IMG_4321.JPG](/proxy/?url=https://content.instructables.com/FCY/X3ZS/J3EPPD8J/FCYX3ZSJ3EPPD8J.jpg&filename=IMG_4321.JPG)
![IMG_4323.JPG](/proxy/?url=https://content.instructables.com/FSP/TQXN/J3EPPD8N/FSPTQXNJ3EPPD8N.jpg&filename=IMG_4323.JPG)
![IMG_4309.JPG](/proxy/?url=https://content.instructables.com/FTC/HX07/J3EPPD81/FTCHX07J3EPPD81.jpg&filename=IMG_4309.JPG)
![IMG_4324.JPG](/proxy/?url=https://content.instructables.com/F94/P6NV/J3EPPD8Q/F94P6NVJ3EPPD8Q.jpg&filename=IMG_4324.JPG)
Follow these steps to perform the surgery:
1. Clean your trusty scissors, and make a 1.5 inch long incision along the spinal bone.
2. Remove around 50% of the bodily fluids (stuffing) through this hole. This is to make room for the Spark Core.
3. Delicately detach the pupil from the eye cavity.
4. Unplug the LED from the breadboard. Push both wires down the center of the eye until the resistance is too strong to continue. If you look in the pictures, I added a straw coming out of the eye. This is not necessary, but I added it for effect.
5. Make a second incision in the back of the head right behind the eye. Pull the wires from the LED through until they come out of this spot.
6. Push the LED leads under the skin farther so that they come out through the original cut on the spine.
7. Insert the Spark Core and breadboard into the spinal cavity. Connect the LED leads to their proper terminals (see step 2.)
8. Make a third incision next to the arm you removed step 2. Push the Servo into this hole, and line it up so that the motorized arm looks natural with the body. Finally, feed the servo wires back to the control board, and plug them in accordingly.
9. Cut out a very small square near the back of the neck. Squeeze the pushbutton into this hole, and send the wires back to the Spark Core to be plugged in.
10. Plug the power cord into the Spark core.
Now let's stitch him/her back up!
Sew the Patient Back Together
![IMG_4313.JPG](/proxy/?url=https://content.instructables.com/FFX/SJ0K/J3EPPD8D/FFXSJ0KJ3EPPD8D.jpg&filename=IMG_4313.JPG)
![IMG_4327.JPG](/proxy/?url=https://content.instructables.com/FNP/9EUB/J3EPPD8R/FNP9EUBJ3EPPD8R.jpg&filename=IMG_4327.JPG)
![IMG_4328.JPG](/proxy/?url=https://content.instructables.com/F6E/SMC6/J3EPPD8V/F6ESMC6J3EPPD8V.jpg&filename=IMG_4328.JPG)
![IMG_4329.JPG](/proxy/?url=https://content.instructables.com/F9F/0976/J3EPPD8Y/F9F0976J3EPPD8Y.jpg&filename=IMG_4329.JPG)
![IMG_4333.JPG](/proxy/?url=https://content.instructables.com/F1U/ZZ7O/J3EPPKH2/F1UZZ7OJ3EPPKH2.jpg&filename=IMG_4333.JPG)
![IMG_4339.JPG](/proxy/?url=https://content.instructables.com/FR5/NVI7/J3EPPKJC/FR5NVI7J3EPPKJC.jpg&filename=IMG_4339.JPG)
Secure some thread to the sewing needle. I would suggest using a color that blends in with the body -- I used green. Then, just start at the bottom of each hole and work your way up, closing all the gaps. I was very happy with the finished job!
Test Out the Finished Product!
![IOT Stuffed Animal](/proxy/?url=https://content.instructables.com/FKN/SR7Q/J3EPQ7DU/FKNSR7QJ3EPQ7DU.jpg&filename=IOT Stuffed Animal)
![IOT Stuffed Animal](/proxy/?url=https://content.instructables.com/FAX/4SNV/J3EPQ8DR/FAX4SNVJ3EPQ8DR.jpg&filename=IOT Stuffed Animal)
![IMG_4331.JPG](/proxy/?url=https://content.instructables.com/FFR/75BL/J3EPPKFX/FFR75BLJ3EPPKFX.jpg&filename=IMG_4331.JPG)
![IMG_4338.JPG](/proxy/?url=https://content.instructables.com/F01/ONGT/J3EPPKI8/F01ONGTJ3EPPKI8.jpg&filename=IMG_4338.JPG)
![IMG_4332.JPG](/proxy/?url=https://content.instructables.com/FSE/2LW1/J3EPPKG1/FSE2LW1J3EPPKG1.jpg&filename=IMG_4332.JPG)
![IMG_4334.JPG](/proxy/?url=https://content.instructables.com/F1T/O3C2/J3EPPKH6/F1TO3C2J3EPPKH6.jpg&filename=IMG_4334.JPG)
Plug your IOT animal into the wall, and send that email! In around ten minutes, it should buzz and light up. This project was a lot of fun, and I hope others will have fun building it too! In the future, I hope to build another model. One thing I think could be improved is the wiring; as time passes, I am afraid a wire may become disconnected from the breadboard. This problem would be very difficult to fix but could have been prevented by soldering everything from the start.
If you have any questions or concerns feel free to let me know in the comment section below. Also, remember to vote for me in the Internet of Things contest!