Introduction: The Soda Locker - Vending Machine

About: 17 year old who loves to build things in his free time!

Lockers just aren't what they used to be. With so many schools moving to electronic devices for books, lockers become less of a space for your books, and more of a question of: "What am I going to do with this?"

What if you could use that space for your own vending machine? In this Instructable, I'll tell you how I came up with the idea, how I designed it, how I solved a few problems along the way, and how it all turned out! So pop open a can of your favorite drink and come along!

Step 1: The Talk

A little less than a year ago, on the way back from lunch to U.S History class, I looked at one of the lockers and thought "how cool would it be to have a vending machine fit entirely inside of a locker?" Shortly after, I mentioned the idea to a few class mates at my table. We then talked about it for a while as a joke, but the further we went on, to me, the idea seemed entirely possible!

I began drawing up rough sketches to the side of whatever assignment we had in front of us. Before going any further, the next day, I brought a measuring tape to the school, and during lunch, I went to the locker to get every measurement I could. A few days later, school was out for the summer.

Step 2: Programming the Control Panel

With any project, I find it works best to get the electronic side of things working first. Over the summer, I started by buying an Arduino, coin acceptor, an LCD screen and a magnetic reed switch. I also had quite a few arcade buttons laying around from a previous project. I then mounted everything inside of a shoe box and wired it all using jumper cables to make connections. It was helpful to have a breadboard to mount a common ground to. The coin acceptor required 12 volts, while the Arduino uses 5v, so for now, I powered the coin acceptor with a 12-volt DC power adapter.

Programming was a learning process. I worked one device out at a time, starting with the screen. The amazon comments section was helpful for this step. Somebody had already posted working code for the screen. After playing around with a few variables, I moved on to the coin acceptor.

For the coin acceptor, a simple google search lead me to Skipped's instructable: https://www.instructables.com/id/Make-Money-with-Ar...

The coin acceptor works by pulsing a programmed number of pulses to the Arduino. Then, the Arduino multiplies the pulses by $0.05 to give an accurate representation as to the amount of money put in. As long as your greatest common factor between coins is 5 cents, this works great! I programmed the coin acceptor to output 1 pulse for nickels, two pulses for dimes, and 5 pulses for a quarter. I didn't want to have to give change, so I left dollar coins out. I also left half dollars out, given that they didn't fit into the coin acceptor. I combined this with the screen once I had figured the acceptor out.

After that, I was on a roll. I decided to sell two different kinds of pop in order to fit the machine into the locker. I hooked up two arcade buttons to buy the pop, 2 servos, and added the reed switch to give myself an admin access page. Here I listed the number of cans sold, the current stock, total revenue. While being in the current stock page, you can press and hold either of the arcade buttons to indicate more stock being put in.

Then, after making sure everything worked, I bought a deep cycle 12-volt battery from amazon. I connected the battery straight to the coin acceptor, and broke down a USB car adapter to run in parallel with the battery for the Arduino. The car charger had a 2 Amp, and 1 Amp port, so I powered the screen and Arduino with the 1 Amp, and the servos with 2 Amps. Using a voltage divider circuit, I was able to display the battery voltage on the admin page as well.

Step 3: Creating the Control Panel - Thanks to the School Laser Engraver

You can't make a vending machine out of a Nike shoe box. Lately, I've been taking advantage of our school's new Epilogue Mini 24-inch laser cutter. I decided to use black acrylic for the front face of the vending machine. It cuts nicely, and it looks pretty clean as well. After programming the control panel, each component needed a home. I had to make sure nothing ran into anything else from the back side, given that things like the coin acceptor and battery take up a substantial amount of space.

I did a quick mock-up in Photoshop before drawing the panel in CorelDRAW. This is a great time to name the machine! I liked "The Soda Locker." I ended up liking the engraved grid look in the background with rounded rectangle borders. I cut a few holes for the button, keyhole, screen, logo displays, and coin acceptor. Then I mounted everything in its designated spot. I also put two pieces of clear acrylic to cover the logo displays.

Everything was looking great so far!

Step 4: Theft Protection

One of the key features the control panel had to have was theft protection. I didn't want others removing the control panel from the locker. The front of the locker has a lip where the door rests into. I cut two boards with the same thickness as this lip and cut slots in each board which would allow for a key driven arm to be pushed into when in use. Once locked, the control panel is "too big" to be pulled out. Then all I have to do to get the control panel out is turn the key and pull forward.

Step 5: Encasing the Control Panel

Once the control panel itself was finished, I encased everything into an acrylic box. The box would fit into the lunch box shelf inside the locker. I built supports to hold the battery in place, away from anything else. The back panel is held on by cabinet magnets so I can access the inside anytime. It includes a few holes for a power switch, which can be turned to "charge mode" connects two screw terminals directly to the battery. This makes charging much easier, as I don't have to open the machine up to charge it. Underneath the coin acceptor, I included a hole for a drawer which catches any coins put in. On the top of the box, I used the micro-switch from another arcade button as a cutoff switch for the battery. I didn't want the vending machine to be on while the locker door was closed, so as the locker door shuts, it hits the switch, turning the vending machine off.

Step 6: Money Cheat?

It didn't take long for me to realize there would occasionally be an extra 5 cents in the machine after being a while. This was NOT good. After trying to diagnose the problem, I found that after pulling a blanket over my head, touching a quarter to the front face of the coin acceptor would activate a pulse or two giving you 5 cents, just for static electricity! I'm not an electrician, but I assumed that grounding everything, including the front plate would fix the problem. However, the lockers are painted. I didn't want to modify the locker at all, so grounding wasn't going to work. I decided to fix the problem with a bit of programming.

I started by measuring the distance of time between each pulse for a coin. It ends up being about 130ms apart, as long as you use the fast setting on the coin adapter. Then I modified the coin program sketch to check to see if each pulse is 130ms apart from the last pulse. If this is true, then one 5 cent pulse is added to the coin value. But, if you think about it, the very first pulse from any coin has a greater distance of time from it's last pulse. The last pulse was the coin inputted before. So, for instance, putting a quarter in counts for 4 pulses, giving you 20 cents. Nickels didn't even work, because one pulse couldn't possibly be 130ms apart from the last, unless you put two nickels in that quickly.

To solve this, I just reprogrammed the coin acceptor to pulse twice for nickels, three times for dimes, and six times for quarters.

What did all of this gibberish do? Now, unless you can shock the coin acceptor with static electricity at least two times, exactly 130ms apart, then there is no way static electricity will ever count for a coin.

Here's the code for anyone interested!

Step 7: Dispenser Design

After getting the electronic aspect out of the way, I moved on to the dispenser boxes. These would go at the very bottom of the locker. I designed a laser cut ready box on Autodesk Inventor. After laser cutting, I fit it together a few times before gluing with wood glue. They ended up being pretty strong when finished! Each box holds 6 cans of a certain type. The Boxes were mirrored images of each other, so leaving the last leg out creates a nice opening at the bottom to grab your can. The hole on the side of the box served to hold a C shaped channel that turns 90 degrees and back each time a can is sold. This prevents all cans from being dispensed, while dispensing on at a time. I added a bit of length at the bottom for the can to roll before dropping to prevent people from messing with the C channel.

Step 8: Dispenser Mechanism

The dispenser wouldn't work without a C shaped channel for the cans to fall into. Before moving to 3D-printing, I made a few prototype dispenser channels. I started with cardboard wrapped around two acrylic disks with a couple of acrylic gears. While there is no mechanical advantage to gearing it 1:1, I did this to keep the dispenser low profile by mounting the servo on the inside of the box. It wasn't perfect, but the cardboard worked pretty well. I tried replacing the cardboard with a thin sheet of heat-warped acrylic but it ended up turning out worse.

I came up with a final design in Fusion 360 and had it printed from the https://www.makexyz.com/ service. If you haven't gone through MakeXYZ, I highly recommend it! It was fairly cheap for the quality parts I received. It's also very quick.

In the last picture, you see a piece clamped on to the back wall of the box. I glued a few stoppers that fit into the slots of the 3D-printed piece which serve to keep the part from sliding out of the box. Once the stopper is glued, you can't take the part out anymore.

Then I mounted the servo from the inside of the box, placed a laser cut gear on the outside, and tested it out after wiring it to the control panel.

Step 9: One Tight Fit!

After getting this much done, I figured I would take everything I had to school to test it out! School had started back up by this point, so I was able to have my friend help me bring it into the building.

Getting the dispensers to fit was a trick! To do so, I put the left dispenser in and slid it over. Then, to get the right side in, I put it in over the other dispenser, moved it to the right, and lowered it into place beside the left dispenser. Then I slid a half inch board in between the two dispensers to put them outwards into the sides of the locker. The board rests on a lip I included when designing the boxes.

Step 10: Creating the Bottom Dispenser Cover

Laser cut wood, while it may look pretty in some cases, it doesn't make for a very professional looking vending machine front. To keep the theme, I laser cut a panel from some more black acrylic, using the same grid pattern from before. I cut an opening just big enough to reach in and grab a can when it's dispensed.

After a bit of testing, I ended up adding an acrylic wedge shaped piece that the cans could roll onto rather than fall directly on the metal floor of the locker. It was pretty loud otherwise!

Step 11: Creating the Access Door

Because each dispenser held only 6 cans, I needed an area to store extra stock. Conveniently, the vending machine is in a locker, made for storage! I made a panel to cover up the top half of the locker where the backpack hook is located. It consisted of a frame, a couple of hinges, and an inside panel with a key lock. Again, this kept the grid theme to match the rest of the machine.

Step 12: Jam It in Place

To keep the bottom half of the machine from being stolen or tampered with, I made a set of jams and spacers to hold it all in place. Remember the lip at the front of the locker where the door sits? I placed two spacers on each side, made from 3/4-inch melamine covered MDF. These served to push the vending machine panels far enough back to avoid being hit by the combination lock on the locker door when closed. Then, I opened the access door, and from the inside, jammed a few poplar boards behind the frame and bottom cover. This locked the panels by pushing them up against the spacers, which were pushed into the lip at the front. The only way to steal anything from the vending machine would be to open it from the inside and remove these wooden jams. Or you could probably kick the front in, but let’s keep that a secret!

Step 13: Cable Management - Thanks to Special Holes

Before I left for summer, I noted the backpack hook could easily be unscrewed, which would make a perfect hole to run wires through from the dispensers to the control panel. One goal with the Soda Locker was to avoid any modifications to the locker whatsoever. To me, this was pushing it. Fortunately, when I got to this step, I realized that there were two randomly placed holes at the back of the locker. These worked much better, as they were bigger, and already there!

Step 14: Keep It Closed! - Spring Loading the Door

The actual vending machine was entirely finished at this point! The next step was preventing the locker from ever being left open. I went to my local yard store and picked up a 15-inch tension spring. Again, the locker had another convenient feature. There was a small divot at the top of the back of the locker. I hooked the spring to this using a paper clip, bending it through several times. Then, again, thanks to another hole, I ran a bolt through the top edge of the door close to the hinge. Then it was a simple as hooking the spring to the bolt. I could have increased the tension by placing the bolt in another hole, further from the hinge, but I'm not willing to have my fingers chopped off in a door slam!

Step 15: Open to Business!

After securing the door with a spring, it was time to jam the combination lock open! Just like any middle-schooler with a new locker, I input the combination once, and while holding the latch open, I shoved a pencil through the back side. I also taped it in place to keep it a little more secure. Now the locker was open to anyone. Conveniently, the locker still latched when closed, requiring you to at least pull up before opening the door. If I ever need to close the Soda Locker for maintenance, I can easily pull the pencil out and the machine is locked again. Nobody will ever need to know my combo.

Step 16: The First Buy... "Prom?"

The last step? Ask your girlfriend to prom! After finishing the Soda Locker, I was so excited to show it to her. With prom around the corner, what better way to ask her than having the first buy drop a can for her to pick up asking her to prom? Pretty sure nobody's been asked this way before!

After day one, the vending machine was a hit! On average, 6 cans are sold in just one passing period. Although to me, it was far more rewarding to hear "Dude, have you checked out locker 808 yet?" as students passed each other in the hallway.

This project has taught me so many things including Laser cutting skills, new programming techniques, and put my mechanical engineering abilities to a test. With this being my last semester of senior year, I'd like to eventually buy a locker of the same style and keep the Soda Locker with me in the future. Then when somebody at a reunion asks "Remember locker 808?" I can say I've kept it all along.

Whether you build your own Soda Locker or not, I hope you're inspired to build whatever odd project you've come up with! While your here, I'd really appreciate a vote! Thanks!

Epilog Contest 8

First Prize in the
Epilog Contest 8

Arduino Contest 2016

First Prize in the
Arduino Contest 2016

Design Now: 3D Design Contest 2016

Participated in the
Design Now: 3D Design Contest 2016