An Over Engineered Trash Can Lock

This is Murdoc. He is a Golden Doodle with an appetite for Nerf darts, Nerf balls and … trash.

Murdoc After Surgery

This picture above is after his surgery to remove a couple of Nerf balls from his intestinal tract. They had completely blocked his output, preventing any input. I hope I don’t need to paint a more vivid picture.

In addition to admonishing the grandkids to NOT leave their Nerfdarts and balls liberally sprinkled throughout the yard, we also had to teach them to always lock the trash can. Why? One day we came home to find, without any prior behavioral change, Murdoc sitting in the middle of all the trash from the kitchen trash can feasting on unknown substances. He was perfectly happy. We were not. Surgeries are expensive, and they are very hard on the dog. He lost a section of his intestine from the previous adventure. He couldn’t afford another loss, and neither could we.

We tried the manual lock on the trash can, but we consistently found that “someone” forgot to latch it, usually when we heard Murdoc lift the lid with his nose and it slipped and slammed alerting us to his transgression. A better solution, not prone to human error was needed. This sent me searching for trash cans with electronic locks. Most were “touchless” and used simple infrared sensors to open the lid. Even those that were touted to be “dog proof” were prone to tip-overs and pillage. Murdoc weighed 80 lbs, so a normal kitchen trashcan is no match for perseverance.

If you can’t buy it, build it, right? So that is what I did. I had a very basic set of requirements.

  • I want a latch, not a lift. I still want a second motion to open the trash can completely separate from the locking/unlocking action.
  • It needs a specific gesture with a human hand to unlock the trash can. Not just a “warm body” passing over or near the sensor.
  • It needs to sense if the lid is left open (such as when it is overfilled) and alarm when left open.
  • It must relock automatically once the lid is closed.

The First Prototype

I started very simply. A ball tilt sensor, an infrared motion sensor and a servo to open and close the lock. I tried a linear servo, but it just didn’t have enough newtons to reliably unlock/lock the lid. The hardest part of this first prototype was the locking mechanism. After some research I settled on a scotch yoke (pictured below) to translate the circular motion of a standard servo to a liner motion for a locking pin. Using the pin was needed to ensure the lid stayed locked even in the event of a tip over.

Scotch Yoke

The scotch yoke has the advantage that even if power is lost it remains in its previous position, either locked, or most importantly locked. If something fails it can be forced open by applying steady pressure on the end of the pin.

I tested everything using a breadboard. It looks like my typical mess. The IR sensor is pictured at the top. The tilt sensor is off to the left. The piezo speaker is at the bottom, and the servo is off to the right. I programmed the IR sensor so that it needed three distinct motions within a 5-second period. This was so someone casually passing by (like Murdoc) wouldn’t trigger the open routine. The code relocks the trash can after 10 seconds as long as the sensor idicates that the lid is closed. Otherwise, it alarms until the problem is corrected.

First Prototype
First Prototype

Of course, everything worked like a champion on the desk. But what about in practice? Not so well. The IR sensor was easily confused by changing background light levels. I tried a number of libraries that were supposed to compensate for these changes, but none worked well in my environment. Also, I was not able to get the alignment exactly right for the ball sensor so that it was sensitive enough to alarm if the lid was left cracked (preventing the lid from locking), without being so sensitive as to give false alarms if the trash can was shifted slightly when part of the base was in a low point on the floor tile. The one thing that worked flawlessly was the scotch yoke yoke.

Given the operational data and feedback from my users (my wife and grandkids), I was off to improve the sensors.

Prototype 2

After some research, I decided to go full overkill with a PAJ7620U2 Gesture Recognition Sensor to lock and unlock the trashcan, and a GY-521 MPU-6050 3 Axis Accelerometer as my tilt sensor. You can see the sensor package below along with the main microcontroller board and the servo to control the scotch yoke.

Sensor and Lock

Sensor Package

Both worked extremely well. The accelerometer uses some tricky math to translate linear acceleration into an angle by “measuring how the Earth’s gravity distributes across its three axes.” Fortunately for me, all of the calculations are done internally in the library. I coded the accelerometer to set the zero position when power is applied. This means that even if the floor is unlevel the sensor will still sense that the lid is open and alarm.

I did find the gesture sensor slightly fiddly. It can detect 9 basic gestures. They are Move Up, Move Down, Move Left, Move Right, Move Forward, Move Backward, Circle Counter-Clockwise, Circle Clockwise, and Wave. I wrote some code to just print out what gesture was sensed, and more often than not, a Move Up or a Move Down would register my hand as moving either Forward (toward the sensor) or Backward (away from the sensor). I had to keep a very steady hand to get the other gestures to be consistently recognized. Since the Forward and Backward motions were the most easily performed and recognized, I decided to use a sequence of these motions in a set period of time as my trigger to unlock the trash can. All of my “testers” were able to easily use this motion set to operate the trash can.

Solder Wrap Technique

I use a “solder wrap” technique for my prototyping. The bottom of the main board with the microcontroller is shown above. For those connections that have the standard, square wire wrap pins I just use the standard wire wrap technique; strip back the insulation and use a wire wrap tool to secure it to the pin. For through-hole components I do the same thing, except I leave the leads long and once all of the connections are made to a particular lead, I solder the group to the pin for a secure electrical connection. Cheap and cheerful.

The Final Result

Completed Unit

completed unit
Completed Unit

How did it turn out? It worked extremely well. You can see the completed unit above. Since I was carrying the I2C signals from the sensor box to the main lock box (which has the microcontroller) over a long distance I used Cat5 cable, with SDA and SCL lines each in a separate grounded pair to help with noise immunity.

The main components I used are:

If you are interested in building this, or a derivative project you can find the source code, schematic and 3D design files on my TrashControl GitHub website.

Postscript

I didn’t want to bum you out at the start of this post, but unfortunately Murdoc did not survive his major trash feast incident. He seemed fine at first, but he started having gastrointestinal issues while I was working on this project. At first, they were mild and recovery was easy. Right when we thought we were out of the woods (weeks went by with no issues) he started having major issues which warranted a visit to the vet. She found 6 major intestinal blockages, distributed throughout his intestines that were just too complicated for surgery. Unfortunately, we lost Murdoc. I decided to complete this post in the hopes that if you have a Murdoc you may find it useful to prevent your dog or cat from suffering a similar fate.

In Memory of Murdoc, our joyful, faithful friend. We still miss you.

73, Greg, KM5GT

My POTA/Go-Kit

Complete go-kit
My Go-Kit

It all started at Hamvention in 2025. I was looking through the list of presenters, and I noticed that Vince, VE6LK, was in the last slot on the last day. Not an enviable position for any presenter. I’m a fan of Ham Radio Workbench, so I decided to attend just to help put some numbers in the room.

As it turned out, he didn’t need my “help.” The room was adequately filled with enthusiastic people who were interested in his approach for A Fresh Approach to Go-Kit Design. In what I have come to know through the podcast as his typical, well-thought-out approach, Vince passed on what he described as cornerstone principles for building a go-kit. At the top level they are:

  1. What’s Your Purpose? Set your goals. Build towards them.
  2. Define your electrical requirements. Include operating time.
  3. Define your mechanical requirements. How do you plan on transporting it?

Simple, right? Well, as the original saying goes, “God is in the details,” so let’s get to them.

My Purpose: My goal was to build something for HF POTA and as a go-kit to take on vacation. My transport is a car or truck, so the whole kit needs to be “luggable”, but not ultra-light. I want to operate both voice and FT8/FT4 with an output power of up to 50W. I plan on using an external antenna tuner when I use a non-resonant antenna. I don’t want to rely on the 3:1 tuner in my radio. Which brings me to my other requirement. One of my maxims is, “Use what you can, buy what you must.” I want to use my now-retired 1st generation IC-7300 as the radio.

Electrical Requirements: The power requirements are modest. I want to be able to operate for around 1 hour, which should be adequate time to get in a POTA activation. The IC-7300 consumes the most power with receive around 12W and transmit, operating at 50W, up to 180W maximum. The USB-C for recharging the battery in the antenna tuner and for an external light, charging my phone, etc., is specified at 78W maximum, but in operation it will be more like 35W. All of this looks something like the following:

DeviceWattsHoursDuty CycleWatt-Hours
IC-7300
Transmit-180150%-90
Receive-12150%-6
USB-C-351100%-35
Subtotal-131
Battery
Bioenno BLF1215A1801180
Spare Capacity49
Go-Kit Power Consumption

The Bioenno BLF-1215A looks ideal since it will easily cover my worst-case scenario, and it will give me much more headroom when most of the activation is via SSB. Also, most of the time I will operate on less than 50W, so even with demanding modes like FT8, I will not hit the battery capacity.

Mechanical Requirements: Since I will be transporting the radio and gear in the trunk of a car or the back of the truck, I want a ruggedized case for the sensitive electronics. I also want to be able to hand-transport the whole kit and caboodle in one trip for at least 100 yards. I chose a Harbor Freight Apache 3800 to transport the sensitive electronics and a simple over-the-shoulder camera tripod bag for the antenna and necessary cables.

The Final Go-Kit

You can see the final product below. I used a Powerpole distribution block to connect all of the 12VDC together. This makes it easy to plug and unplug the battery for charging. I also designed a battery fixture that I could 3D print to keep everything nice and tidy. I will post a link to this later. Although I don’t leave the battery in the case when stored, it is nice to be able to open the case and make one connection to get everything going.

go-kit brackets
Battery and USB Charger Brackets (prototypes)
go-kit rear
Rear View

go-kit front
Front View

The components I chose are:

Everything is mounted to a nylon cutting board, so I can easily slip the working bits out of the Apache case and easily access and use the radio.

The End Result

I am generally happy with the result. Setup is quick. Connect the battery, lay out the antenna, hook up the coaxial cable, and the microphone and I’m on the air. The one column I wish I had added to my spreadsheet is weight. The Apache 3800, with everything included is right around 22 lbs. Still luggable, even with the antenna and coax over my shoulder, but in retrospect my mental target for everything was under 20 lbs.

Still, a good first attempt. I am after all a ham, and we never leave things alone. I will be looking at other lighter radios, lighter, but still rugged carrying cases in the future to lighten my load but not dent my fun.

You will find the design files (FreeCAD and .3MF) for the brackets used in this project at my IC7300GoKit GitHub site.

I highly recommend you watch Vince’s video as I have only glossed over the surface of the gems he discusses in making your selections. Things like fresh socks, coffee, water, and all of the other essentials are discussed. Vince’s complete talk can be found here.

73, Greg, KM5GT