Interactive Gift Box. Created by codingpro. Last updated on :47:40 AM UTC

Similar documents
Infinity Mirror Valentine's Candy Box

Interior Purse Light. Created by Becky Stern. Last updated on :41:08 PM UTC

Chirping Plush Owl Toy

Snake Charmer Box. Created by Dano Wall. Last updated on :07:25 PM UTC

Reindeer Mask with Animated Eyes

Light-Up Angler Fish Embroidery

Clockwork Goggles. Created by John Park. Last updated on :03:10 PM UTC

Crawling Animatronic Hand

Ping Pong Ball Launcher

Neon LED Signs. Created by John Park. Last updated on :11:09 PM UTC

NeoPixie Dust Bag with Circuit Playground Express

Circuit Playground Express Head-Tilt Ears

FLORA TV-B-Gone. Created by Becky Stern. Last updated on :32:57 PM UTC

Crawling Baby Sea Turtle Robot

NeoPixel Ring Bangle Bracelet

Crickit Dancing Marionette Kit Created by Dano Wall. Last updated on :03:11 PM UTC

Slider Crank Mechanism -- from Cardboard and Craft Sticks

Tent Lantern. Created by Timothy Reese. Last updated on :17:25 AM UTC

Arduino Lesson 6. Digital Inputs

Hammer Time Mini Golf Hazard with Crickit

Bunny Ears with MakeCode

CPX Mystery Dreidel. Created by Kathy Ceceri. Last updated on :51:40 PM UTC

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

NeoPixel Manicure. Created by Sophy Wong. Last updated on :50:38 PM UTC

Paper Airplane Launcher

i2c/spi LCD Backpack Created by lady ada Last updated on :11:04 PM UTC

Con Badge with Circuit Playground Express

Crickit Powered Holiday Diorama

Pushrod Garage. Created by John Park. Last updated on :07:30 PM UTC

Adafruit DRV2605 Haptic Controller Breakout

Guardian Shield+ Zelda Breath of the Wild

FLORA and GEMMA ICSP. Created by Becky Stern. Last updated on :42:16 PM UTC

Adafruit PowerBoost 500 Shield

Celebration Spectacles

Toy Car Speed Timer. Created by Kirby Griese. Last updated on :13:49 PM UTC

Adafruit APDS9960 breakout

Adafruit TPL5110 Power Timer Breakout

NeoPixel Fairy Crown. Created by Erin St Blaine. Last updated on :22:47 AM UTC

Learning with LEDs. Created by Rick Winscot. Last updated on :39:11 PM UTC

Trinket NeoPixel LED Longboard

Trinket-Powered Conference Room Occupancy Display

Adafruit IO Basics: Digital Output

Adafruit TPL5111 Reset Enable Timer Breakout

Getting Started with FLORA

Solar Boost Bag. Created by Becky Stern. Last updated on :44:55 PM UTC

Steven Universe Cosplay Shirt & Gem Created by Erin St Blaine. Last updated on :54:25 PM UTC

Android GBoard Morse Code Control with Circuit Playground Express

Adafruit IO Basics: Digital Input

'Sup Brows. Created by Kate Hartman. Last updated on :52:04 PM UTC

No-Sew LED Wristband. Created by Kathy Ceceri. Last updated on :23:40 PM UTC

Bike Wheel POV Display

Easy Sparkle Pocket T-Shirt

Data Logging with Feather and CircuitPython

Mystery Box: NeoMatrix Mk I

NeoMatrix 8x8 Word Clock

Trellis 3D Printed Enclosure

Adafruit AM2320 Sensor

Adafruit VL53L0X Time of Flight Micro-LIDAR Distance Sensor Breakout

Adafruit LED Sequins. Created by Becky Stern. Last updated on :02:00 AM UTC

3D Printed Camera LED Ring

Wind Blowing Emoji Prop

Adafruit Capacitive Touch Sensor Breakouts

Coffee Detonator: The TNT Plunger Grinder

FLORA and GEMMA ICSP. Created by Becky Stern. Last updated on :30:55 PM EST

Audio Prank Gift Box. Created by Becky Stern. Last updated on :46:15 PM UTC

Crickit Carnival Bumper Bot

Adabot Operation Game

Getting Started with FLORA

Adafruit MMA8451 Accelerometer Breakout

3D Printed LED Buckle

Adafruit DRV2605 Haptic Controller Breakout

Lie Ren's Stormflower Gun Blade

Adafruit Si7021 Temperature + Humidity Sensor

FLORA Pixel Brooch. Created by Becky Stern. Last updated on :19:07 PM EST

NeoPixel LED Cortana Costume

Jewel Hair Stick. Created by Leslie Birch. Last updated on :47:17 PM UTC

Adafruit I2C FRAM Breakout

Adafruit Color Sensors

LED Eyes. Created by Ruiz Brothers. Last updated on :50:55 AM UTC

Luminous LED Flowers. Created by Becky Stern. Last updated on :47:44 PM UTC

Trash Panda. Created by Dano Wall. Last updated on :30:46 AM UTC

Adafruit IO Basics: Analog Input

Adafruit HUZZAH32 - ESP32 Feather

Circuit Playground Combadge

Adafruit IO Basics: ESP Arduino

Adafruit LED Sequins. Created by Becky Stern. Last updated on :00:06 PM EST

FeatherWing Proto, Doubler and Tripler

Getting Started with FLORA

Magical Mistletoe. Created by Leslie Birch. Last updated on :45:29 PM UTC

Mad Science Test Tube Rack

Adafruit CCS811 Air Quality Sensor

Sewable NeoPixels. Created by Becky Stern. Last updated on :50:14 PM EDT

Adafruit 8x16 LED Matrix FeatherWing

Adafruit Si5351 Clock Generator Breakout

Morning Star POV Double Staffs

Adafruit AMG8833 8x8 Thermal Camera Sensor

MLX90393 Wide-Range 3-Axis Magnetometer

Adafruit Mini TFT " 160x80

Circuit Playground Digital Input

Alohamora Bottle. Created by Erin St Blaine. Last updated on :58:53 PM UTC

Transcription:

Interactive Gift Box Created by codingpro Last updated on 2018-01-10 01:47:40 AM UTC

Guide Contents Guide Contents Overview Adafruit GEMMA M0 - Miniature wearable electronic platform Lithium Ion Polymer Battery - 3.7v 100mAh Piezo Buzzer Medium Vibration Sensor Switch Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25 Through-Hole Resistors - 220 ohm 5% 1/4W - Pack of 25 Step 1: Get a template Step 2: Print Step 3: Make the box Step 4: Electronics Step 5: The Code FAQ Will this also work on other trinket boards like the Gemma? Credits! 2 3 3 3 4 4 4 4 6 7 8 9 12 15 15 16 Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 2 of 16

Overview If you know someone who loves electronics, this is an awesome gift box for them! In this guide, you will make a homemade box that plays music and lights up when it is shaken. Here is what you will need: Your browser does not support the video tag. Adafruit GEMMA M0 - Miniature wearable electronic platform PRODUCT ID: 3501 https://adafru.it/ytb $9.95 IN STOCK Lithium Ion Polymer Battery - 3.7v 100mAh PRODUCT ID: 1570 https://adafru.it/daq $5.95 IN STOCK Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 3 of 16

Piezo Buzzer PRODUCT ID: 160 https://adafru.it/dcd $1.50 IN STOCK Medium Vibration Sensor Switch PRODUCT ID: 2384 https://adafru.it/uf4 $0.95 IN STOCK Through-Hole Resistors - 10K ohm 5% 1/4W - Pack of 25 PRODUCT ID: 2784 https://adafru.it/xfm $0.75 IN STOCK Through-Hole Resistors - 220 ohm 5% 1/4W - Pack of 25 PRODUCT ID: 2780 https://adafru.it/x5e $0.75 IN STOCK 1 x Wire! About a yard or two of wire Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 4 of 16

3 x Multi-Colored LEDs Some LEDs for the blinky tree. 1 x Cardboard A fairly sized piece of cardboard for making a box out of. 1 x Paint Paint for the box. Can be any color. (Optional) 1 x Solder Some solder for the components. 1 x Soldering Iron For soldering the components 1 x Hot Glue Gun Use to glue the box together + glue things to the box! Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 5 of 16

Step 1: Get a template If you already have a box, skip the next 2 pages If you already have a box, you won't need this step, but if you don't, this is how to make one. First, head over to http://templatemaker.nl and find a box template that fits your creative imagination! There are a lot to choose from, but for this guide, I will be using the box-with-lid. It will give us space to put in our electronics, while also being easy to make. Choose the size. I chose a 6x3x6 inch box with a 6x1 inch lid. My clearance was 0.125. Choose download and click create. Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 6 of 16

Step 2: Print Printing the image is one of the hardest parts because the image would be resized when you print it, or it won't fit on the page you are using. To do this, I used Adobe Illustrator and put the image into 2 tabloid-sized documents. Here is how: 1. Open the PDF in preview or whatever you open the image. Take the two slides and drag each one to your desktop 2. Open the box bottom template in Illustrator and select all. Then go to edit-copy, or use the copy keybind. 3. Open a new page (Command/Control-N), and make sure it's size is tabloid. 4. Paste (Command/Control-V), and make sure that the image is half on the sheet, as shown above. 5. Go to File-Print (Command/Control-P) and click Page Setup. It should take you to a new window. Change the print size to letter and click OK. Then press print. 6. Repeat step 5, but with the box template on the other side. 7. Open your box top template into an image editor (Not Adobe Illustrator, something like Preview). 8. Print it on to a tabloid-sized sheet of paper Whew! complicated. Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 7 of 16

Step 3: Make the box If you already have a box, you can skip these steps. Step 1: Take the template papers you cut out and tape them together, so that it would look like one image (shown on the right). Then cut it out. Step 2: Place your template on some cardboard and cut out the shape. First, score the cuts, then remove the paper, and make the scores deeper. Step 3: Turn the cardboard over and score, which is cutting halfway through the cardboard, the folds (marked with - - - - on the template). Step 4: Take your Hot Glue Gun and glue the sides of your box together, as seen in the gif on the right. (You may have to click the image to see it. Step 5: Cut out the template for the box top. Once again, ignore the flaps. Step 6: Cut along the template you made on the cardboard. Step 7: Score the folds like you did a few steps ago. Remember that the side you score on will be the outside of the box. Step 8: Glue the edges of the box together. This can be hard, so you may want to tape the parts together when it is drying. Step 9: Paint your box a solid color. I chose dark grey because it would make the lights of the tree show up well. Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 8 of 16

Step 4: Electronics PresentBox.fzz https://adafru.it/al- Now it's time to make the box work! Follow these steps carefully, and it should work. You will need: 1x Gemma M0 1x Lithium Ion Polymer Battery 1x Piezo 3x LEDs 3x 220 Ω Resistor (Red, Red, Brown, Gold) 1x 10k Ω Resistor (Brown, Black, Orange, Gold) 1x Medium Vibration Sensor 2 yards of insulated wire Something to make holes with! Take the top of your box and poke holes where you want the LEDs to come through. Make sure that you use the tree to measure where you want the LEDs. Put the tree on to the box, and poke holes through it so that the LEDs can go through. In other words, poke holes in the tree even to the holes you poked into the box. Put the LEDs through the holes on the box top. make sure to mark which side is positive and which is negative. Because of our layout, please put the positive side of the Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 9 of 16

Because of our layout, please put the positive side of the LEDs on the right. Warm up your hot-glue gun and put glue on the back of the tree. Place it carefully on the box, making sure the LEDs go through the holes. Connect the positive wire on the LED to a 220 Ω resistor. Then, solder the two together. Connect the resistors together. If needed, solder a wire to one of them so it can be extended. Now, solder all of the resistors together. You may need a lot of solder to do so. Cut a 1 ½ inch wire, and strip both ends. Then, connect one side to the resistors you just soldered. Touch your soldering iron to the solder joint you just made, and add your new wire to it. Take the wire you just soldered and make a hook on the other side. Attach that to pin D0 on the gemma, and solder it. Next, we are going to solder the negative sides of the LEDs to the gemma. Cut 3 1 inch piece of wire and strip it. Then, solder them to the negative side of the LEDs. Solder the 3 wires together, as shown in the picture. Cut another 1 inch wire and solder it to the LED's negative wires. Then solder the wire to the Gemma's Gnd pin. Get your vibration sensor out and connect the copper wire to a 1 ½ inch wire as shown in the picture. Take out your 10k Ω resistor and cut a inch long wire and connect them both to the middle wire. Then, solder them together. Take the first wire you soldered to the sensor and connect it to the 3vo pin on your Gemma. Then, solder it on. Solder the resistor to Gnd on the Gemma board. Solder the last wire to D1 on the Gemma board. Now it's time to set up the music! Cut a 1 ½ inch long piece of wire and solder it to your already used Gnd pin. To do so, place the tip of the iron onto the Gnd pin, and place the new wire onto the solder joint. Take off the Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 10 of 16

place the new wire onto the solder joint. Take off the soldering iron, and the joint will be complete! Connect the other side of the wire to any pin on the piezo and solder it on. Take another wire, about the same size, and solder it onto the other pin on the piezo. Take that wire and connect it to pin D2 on the Gemma M0. Then, solder it on. You're done with the hardware! Now let's open up Arduino and start coding! Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 11 of 16

Step 5: The Code Now let's get the board to work! Let's setup Arduino. If you don't already have the Gemma M0 board driver installed, check out this link: Using with Arduino IDE - Adafruit Gemma M0 https://adafru.it/aln After you have that installed, we need to put the Gemma M0 into Bootloader Mode. To do so, press the reset button twice, and the red LED should start flashing. Make sure that your board selection is right (tools-board-gemma M0) and so is your port (tools-port), and then upload this code: Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 12 of 16

/* Interactive Gift Box When you shake the box, it will light up the tree and play music! */ int speakerpin = 2; int buttonpin = 1; int ledspin = 0; int length = 26; int buttonstate = 0; char notes[] = "eeeeeeegcde fffffeeeeddedg"; int beats[] = { 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2; int tempo = 200; void playtone(int tone, int duration) { for (long i = 0; i < duration * 1000L; i += tone * 2) { digitalwrite(speakerpin, HIGH); delaymicroseconds(tone); digitalwrite(speakerpin, LOW); delaymicroseconds(tone); void playnote(char note, int duration) { char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' ; int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 ; for (int i = 0; i < 8; i++) { if (names[i] == note) { playtone(tones[i], duration); void setup() { pinmode(speakerpin, OUTPUT); pinmode(ledspin, OUTPUT); pinmode(buttonpin, INPUT); void loop() { buttonstate = digitalread(buttonpin); if (buttonstate == HIGH) { digitalwrite(ledspin, HIGH); for (int i = 0; i < length; i++) { if (notes[i] == ' ') { delay(beats[i] * tempo); else { playnote(notes[i], beats[i] * tempo); delay(tempo / 2); digitalwrite(ledspin, LOW); delay(1000); Press the upload arrow and the light on the board should turn purple! Hit it on the side, and it should light up and play Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 13 of 16

music! Now you have an awesome gift box! Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 14 of 16

FAQ Have questions? Click the 'Feedback? Corrections?' link on the left. Will this also work on other trinket boards like the Gemma? Yes, but you might have to solder it differently and change the code. Adafruit Industries https://learn.adafruit.com/interactive-custom-gift-box Page 15 of 16

Credits! You may not know it, but there are some people behind the scenes who helped me get this guide up! I'd like to thank Mr. Lady Ada (Phillip) and Kelly for letting me make a guide! I'd also like to thank @Dan Halbert, @cater, and @nis for helping me get my Gemma M0 to work in the Adafruit Discord. Adafruit Industries Last Updated: 2018-01-10 01:47:39 AM UTC Page 16 of 16