Introduction: Electromagnetic Locking Trash Can (Doggy-Proof)

Like many projects, this trash can was designed to fix a problem. That problem was a dog that loved trash... a dog that learned how to open the "heavy-duty" trash can we bought to keep him out of that trash... a dog named Wilson. The solution is the Wilson TUFF Electromagnetic Locking Trash Can.

Step 1: Tools and Materials


  • 3d Printer
  • Dremel (with cutting wheels for metal)
  • Electric Drill (with standard drill bits and step drill bit)
  • Wire Cutters/Strippers
  • Crimpers
  • Screwdriver, Pliers, etc.
  • File/Sandpaper


  • Metal Trash Can with hinged lid (I just used this trashcan I already owned)
  • Electromagnetic Lock (I used this)
  • Power Adapter (based on requirements of lock you use - I used this)
  • Female barrel connector to terminal screw adapter
  • Switch (I used this)
  • 3d printer filament (I used PLA)
  • Extra wire
  • Crimps/connectors
  • Screws, nuts, etc.
  • Electric tape

Step 2: Notes

I'll walk you through how I designed and put this together, including problems you may encounter. But keep in mind, you need to design and build the locking mechanism to fit the trash can that you are using. This Instructable is about how I built a locking trash can - not how I built a lock that goes on a trash can, if that distinction makes sense.

I designed this in Sketch Up. I didn't just take it off the print bed and plug it in to the trash can though. There was some sanding, bending, and a few mistakes I was able to get around but would change in a redesign. Here are the basics:

  • The electromagnetic lock consists of two parts, the locking mechanism and an armature plate.
  • When current runs through the locking mechanism, a magnetic field is created, turning the locking mechanism into a powerful magnet that, upon contact, will hold the armature plate with a strength capable of lifting 130 lbs.
  • They will only attach when they come into contact, so you don't have to worry about the lid slamming shut if the electromagnet is activated.
  • It is fail-safe, meaning that if you lose power, the lock will be unlocked.
  • The locking mechanism attaches to the main bin and the armature plate attaches to the lid.
  • The lock and the plate need to meet up as dead on as possible in order to ensure a secure lock.
  • To ensure an accurate fit and secure attachment to the trash can, I designed a top and bottom piece in CAD software that the locking mechanism and plate fit into.
  • I wired up a simple switch so it is easy to lock and unlock the trash can.

Step 3: Measurement and Design

The first step is developing a basic design for the top and bottom halves. I went with half of a sphere that would sit on the outside of the trash can. Putting the mechanism inside would have interfered with the normal usage of the trash can.


  • Measure everything first and draw out some basic plans. This includes any offsets between the lock and armature plate.
  • Always give yourself extra room when setting dimensions for fitting something like the armature plate or lock into the 3d print. This includes with depth. I found that I needed to put some cardboard between the 3d print and armature plate in the top half so that it protruded enough from the top half. It was easy to do that, but it wouldn't have been easy to sink the plate in the print deeper.
  • Make sure to leave room for wires when designing the bottom half.
  • For the bottom half, leave the back wall off the design so that the bracket the lock comes with can be screwed directly into the trash can. The bracket is also screwed directly into the 3d print and the lock attaches to the bracket with screws.
  • The trash can I used was curved, but I didn't have to factor that into my designs. The walls of the trash can can be warped a bit to get a snugger fit.
  • I've included the .stl files I used. Be warned that the bolt hole in the top half (for securing the armature plate to the print) is not big enough. Also, there is not adequate room in the bottom half for fitting the wires of the locking mechanism.
  • I printed with 20% infill, 0.2 mm layer resolution, 2 line thick walls, and I used supports. I also oriented the prints so that the layer lines would line up, giving the appearance of a single (half) sphere.

Step 4: Print and Fit Top Half of Lock

It's best to print and attach the top half first. Because it attaches to the lid, there isn't much room for adjustment up and down (z-axis) if the bottom is fixed in place.

The two halves also need to be flush along the y and x axis. On the trash can I used, the lid is longer than the main bin, meaning, if both halves were just fixed to the surface, it would result in an overbite between the two halves. To remedy this, I used the Dremel to cut a piece out of the front of the trash can lid, so the top half could be set back into the lid. Make sure to file and sand the sharp edges of the lid after the cut.

Fit the armature plate into the top half, using the accompanying hardware to secure it in place. The side with the button should face down.

Test fit the top half into the trash can lid. Use a combination of filing, bending (with pliers), and whatever else you can to get a relatively snug fit. When you're comfortable with the fit and placement, drill holes in the lid to match the holes on the top half. I just used a couple M-5 machine screws and nuts to secure it in place.

Step 5: Print and Fit Bottom Half of Lock

Make sure that the locking mechanism fits into the bottom half after it is printed. Secure the locking mechanism's bracket to the bottom half with screws. You will next align the bottom half along the x, y, and z axis so it is in line with the top half. You may need to "warp" the front of the main bin a bit to provide a flatter surface on which to affix the bottom half. I found that I needed to sand away some of the black rubber lip of the main bin to get a good alignment. The armature plate needs to hit the bottom locking mechanism straight on to ensure a good hold.

Once you've lined it up, you need to make seven holes. Make two holes for screws to attach the locking mechanism's bracket directly to the trashcan. Make four more holes for the screws to affix the bottom half to the trashcan. Use the step drill bit to make a hole where the wires will run from the locking mechanism into the trash can.

Attach the bottom half to the trash can. Insert the locking mechanism into the bottom half (putting the wires through the hole into the trash can) and secure it to its bracket with an allen wrench.

Use the drill to make a hole on the back of the trash can, so you can run wires into the trash can to power the locking mechanism.

Step 6: Wire Up Switch

The wiring of the switch is pretty straightforward. The power adapter attaches to the female barrel connector. Connect wires from the screw terminals of the barrel connector to terminals on the switch using crimped ring or fork connectors. Connect another set of wires from the switch (using ring/fork connectors) and run them through the hole in the back of the trash can. Use butt connectors to attach those wires to the wires of the locking mechanism.

Use tape to keep keep the wires inside the trash can against the sides so that they're out of the way of the removable inner trash bin.

Step 7: Final Adjustments and Future Plans

I simply attached the switch to an old cutting board for now. At first, the lock wouldn't always catch without manually pushing the lid down a little. It seems to have settled after being used for a bit and now locks and unlocks just as I planned. I want to make a few improvements in the future.

  • Create a more permanent solution for the switch, probably attaching it directly to the trashcan.
  • Better wire management.
  • Adding a light to indicate when it is "on" or "locked".
  • Redesigning and reprinting the top and bottom halves. Possibly printing it in ABS or some other material and applying some finishing to the final product.

Overall, it works better than I had hoped! It not only keeps Wilson out of the trash (the kitchen trash at least), it also creates a tight seal, keeping the trash smell away.

Pets Challenge

First Prize in the
Pets Challenge