Arduino Secret Stash Chocolate Box With Easyvr3 and Servos
by Kevr102 in Circuits > Arduino
1736 Views, 17 Favorites, 0 Comments
Arduino Secret Stash Chocolate Box With Easyvr3 and Servos
In this Instructable I would like to show you how I made a chocolate/Candy box into a Smart box with a voice activated secret flap which reveals a secret stash of chocolate for emergencies:)
All too often when fancying something sweet I would go to the box only to find it had been pillaged and all that remained was a sad face Emoji staring back at me, so I needed a plan and fast!
The box in question is quite a fancy little box, and rigid enough to convert into a smart box.
The flap movement would come from Servos driven by an Arduino Nano with a servo shield and the voice commands and sounds would be from an Easyvr3 module, and the best thing is this, the box will only work with my voice :))
I want the flap opening to sound authentic so I include some free creaking door opening and closing sound clips.
It's time to box clever!
Supplies
2no 0-180 Servo's 996 type.
Arduino Nano
Arduino Nano Servo Shield
EasyVR3 Stand alone(Without Shield)
Box of some description, this particular one is Hardboard.
9v Battery Connector
9v Battery(Rechargeable)
Alternatively just a USB Cable or 2A 5V Power supply.
1mm Steel Rod
Hot Glue
CA Glue and Activator
Double sided tape
Craft Knife
Soldering Iron and Lead free Solder.
Cutting the Box to Make a Flap
I measured from the top edge of the box downwards 70mm and marked off both sides, I didn't want a pencil line the full width of the box in case it would be seen after cutting so I clamped a straight edge in position and then very carefully using a craft knife started to cut through the box, it took several passes to cut through the hardboard and then finally made cuts down each side again taking care and several passes with the blade and that left us with a flap.
I had been thinking of some type of hinge for the flap but as luck would have it it wasn't needed as a natural hinge occurred after cutting, just bending backwards and forwards did the trick and took the stiffness out of it.
After cutting the flap it left the upper part of the box a bit flimsy, so I braced it with a small wooden slat across the span, this did the trick.
With the flap taken care of it was time to move onto Servo Installation:
Servo Installation and Connecting Rods
I wasn't sure where to place the Servo's initially but after some thought opted for them to have the Servo arm facing the sides of the box one on each side, I will use some 1mm steel rod to make connector rod's much the same as in RC planes Ailerons and Rudder Servo fitments.
I made one end off on the wire, it looks like a mini cranking handle when done, this was achieved using long nosed pliers and then got one of the Servo arms, the one with 2 arms opposite each other and cut one of the arms off with some snips, I didn't know what the orientation of the Servo's was going to be at this point so I never secured the horn, will do some trials prior to securing Servos.
I fitted the made end of the first connecting rod to a Servo and roughly held it up and marked where I needed to cut the wire to make off the other end which would be identical on both sides, the fasteners on the flap door was made up with another of the Servo horns, the 4 way Horn, I cut 2 off, One for each side of the flap, these were sanded and using CA Glue I could glue these into position.
With both control arms made I could now see where the 2 Servos needed to be, Initially I would hold these in place with hot glue, this was a bad choice as I needed to adjust the Servos later:(
With Both Servos in situ and connected to the flap it was time to sort the Electronics out.
Secret Box Electronics
The Electronics are an Arduino Nano with Nano Servo Shield, I really like this set up, the shield is relatively small and makes it easy to install Servo's and the Shield also has 5v and Gnd pins as well which is very handy.
ServoL will go in Pin 11 and ServoR in Pin 10 the TX and RX on the Easyvr Module are connected to pins 12 and 13 on the Arduino the EasyVR Module needs 5V and Gnd and these are connected to 5v and Gnd on the Shield and that's the Electrical side of things take care of, I will finalise positions of these componets later, when the Servos are secured in place.
We can now move onto the code.
Secret Stash Box Software
I wanted to have a squeaky door noise incorporated within the box, its just a bit of fun and adding a squeak would be cool I think, I looked online and listened to various free door and trapdoor squeaks and opted for a slow door squeaky MP3 You can choose any noise you want really, but this will be fine for this purpose.
Easyvr uses WAV files and they have to be in a certain format, the format is 8000hz and 16bit PCM I cover how to import MP3 files into Audacity and Convert them into the correct format and then convert the mp3 into WAV files in a Previous Wall-e Robot Instructable, all the Information is there on getting the sounds onto the Easyvr Commander Sofware and from there Generating an Arduino code.
Once we have that basic EasyVR code we can then add the Servos to it and the Door noise is already in there, we just provide code to make it play with a Voice command.
In EasyVR3 Commander I went for very basic commands, Box Wake Up is the trigger, and basic Open command to make thebox open.
Any issues please look up my Wall e Robot project, It covers everything there how to use the EasyVR commander software, How to use Audacity, how to get the sounds onto the Commander and how to Generate the Arduino code.
Now to position everything and fasten in position, Generate some code and Tweak Servo positions, and see if the system works and will actually open the flap.
The Final Steps
With the Servos removed from the box I could now position where I wanted the Servo horns to initially open the flap and then close it, I could adjust the code and get Servo movement to where it needed to be.
This entails making changes to Servo degrees of Angle within the code and uploading, after a few goes I was happy with the outcome, I'd put the Squeak Initially at the front of the code but ended up with it after the Servo's this worked ok,
The Servos were stuck in position using double sided tape, as was the Nano And Shield and also the EasyVR3 then spots of Hot glue to keep cables tidy etc, I made a hole in the bottom of the box for the microphone and speaker, and again used small amounts of hot glue to secure, the hot glue I'm using isn't very strong and can easily be removed if needed.
I cut 4 wooden feet for the box off a Broom shaft off-cut and secured with hot glue.
I then cut out a small square hole in the bottom for the microphone and used a tiny amount of Hot glue on the cable to hold in place, I made a larger square hole for the Speaker, and couple of dab's of hot glue to hold in place, Later during testing I turned the speaker upside down as it amplified the sound that much that it sounded as though it was a door in a real castle!
I needed to make a false bottom for the box, all I had was a piece of mdf about 8mm it was too thick really but I used it anyway, I marked it off against the outline of the box and cut it on the bandsaw, Using the same Sheet of MDF I then cut some little supports for the false bottom to sit on, I measured down 60mm from the top of the box and marked 4 positions, the front support came from bracing which I had installed earlier, finally I had an A4 adhesive backed sheet, I trimmed this to fit and stuck it down on the up side of the MDF
I uploaded the code at this point and checked that everything worked as it should, the flap doesn't open fully, but its enough to get a hand in and retrieve the spoils:)
Initially with the code It was Box Wake Up for the Trigger, then say open, to open the flap and then say close to close the flap, I forgot to say close on occasion thus giving the game away, so I opted for a Delay of 4 Seconds on Saying Open instead, this gave ample time to retrieve the spoils and it then closes automatically.
That concludes this Instructable, I hope you enjoyed it and as always thanks for looking.