Blog

Project Bindicator: Software

Welcome to the final post in my series on building my bindicator: the software. If you haven’t already read about the hardware I put together then that’s probably worth a read before you go too much futher.

The primary goal of the bindicator is fairly simple: on the evening when the garbage needs to go out, the bindicator should light up in the relevant colours. For the way I plan to use it, I have some additional requirements: I want the people in my household to have a way to dismiss the indication once it’s been dealt with, and I want the notification to time out after a certain amount of time even if nobody has dismissed it. I’d also love for the notification not to fire at all if we’re on vacation.

There’s probably any number of different ways we could go about achieving this with a combination of hardware and software, but in our house we already have Home Assistant installed and hooked in to any number of household devices and functions, running automations to control them and get them working together. As a result, my approach will be to keep all the logic in home assistant and make the bindicator device itself fairly dumb – all I want it to do is show up in home assistant as a light (actually three lights) that home assistant can control.

Enter ESPHome!

ESPHome is a sister project to home assistant intended to be installed on devices with a microcontroller (either commercial or home-made devices) to control the hardware. As you’d imagine, it integrates with home assistant really nicely and I believe there are a few different ways of doing that integration. I use MQTT.

You use a YAML configuration to specify what hardware components your device has and how they’re connected to the microcontroller. It then generates the firmware, and you upload it to the device. Simple!

I published my configuration in my git repository. It defines three lights – one that represents the entire bindicator (both halves), and one each that’s specific to the top and bottom segment of the bindicator. For each of those it adds a custom lighting effect that pulses the light on and off periodically, and then it makes the whole thing available to home assistant over the MQTT and provides some additional options that let me do things like OTA firmware updates.

On the home assistant side, I’m using a couple of key integrations. Recollect Waste and the HomeAssistant mobile app. I then built an automation that runs every day at 6pm and checks if there’s a garbage collection scheduled for the following morning. If there is it additionally checks if there’s one type of garabge being collected or two, and lights up either the whole bindicator in a single colour or each of the two segments independently as appropriate.

It also sends a notification to each of our phones telling us there’s garbage to go out, and watches for one of those notifications to be dismissed with a four hour timeout. When one of us dismisses a notification it then removes the notification for everyone else and turns the bindicator off.

Home assistant uses a nice friendly GUI to create and edit automations and they’re saved in YAML format behind the scenes. I’ve published my automation in YAML format.

What’s Next?

I don’t have many plans to evolve what I’ve built because it’s working pretty well. We already use a “home mode” selector in Home Assistant to change some of our home’s settings if we have houseguests or are on vacation, so the automation I’ve linked above already leverages that and skips taking any action if we’re not home to deal with it.

I have an idea of using our security cameras and computer vision (probaly leveraging frigate) to detect when we put the garbage out and react appropriately so we don’t need to manually acknowledge that it’s done (and also alert us if we accidentally put the wrong colour cart out, or perhaps even alert us once they’ve been emptied and we can take them back in).

Watch this space to see if I actually do any of that!

Blog

Project Bindicator: Final Assembly

Welcome back to my ongoing blog series about my bindicator build!

It’s been a few months since my last proper post about it, I’ve been to Spain and back in that time, done some other things in my life, and my bindicator has been set up and working well for at least the past month!

When last I wrote the parts had arrived and I’d begun modifying the STL files to fit them. That work is now complete and I’ve published it over on printables.com along with the source files in case you wanted to modify them further for your own application.

Starting with the original design by CopperLion, I designed a bracket to hold the microcontroller I’d chosen (an ESP32-C3 Zero), slightly enlarged the hole for the USB port to make it suitable for the USB-C plug that the ESP32 uses, and removed two of the three fins from the light baffle so that it would fit an offcut of addressable LED light strip that I had lying around.

From there I printed everything in white (waiting for my order of white filament was actually the biggest delay in the whole process, because Amazon lost it and I had to get a refund and order it again) and it was on to assembly!

First I soldered three wires from the microcontroller to the light strip – one to the 5v pin, one to ground, and one to GPIO pin for data. Next I peeled the backing off the light strip to reveal its adhesive and stuck it to the baffle, then I glued the microcontroller into its bracket with a little dab of superglue.

With the benefit of hindsight, starting by attaching the baffle was a mistake. The next step was to glue the microcontroller into the bottom of the wheelie bin, and this would have been much easier without the baffle attached. Nevertheless, I managed to get it done.

The baffle more or less sits in the right spot without any adhesion but I did put a little dab of glue on the back of it to hold it still, and then finally I glued on the lid. The lid is my least favourite part of the design because it simply rests on top of the bin. Once you’ve glued it in place it’s fine, but gluing it is not the easiest because there’s nothing to hold in place until the glue has set. If I were doing this over I’d like to add a little lip so that it could be inserted and friction-fitted into the top of the bin. On the other hand, that lip would make the top harder to print, so maybe it’s better how it is now? I’m not sure.

With everything working it was on to software, but that’s for a future post. Watch this space!

Shrapnel

…and another update – I’ve made the u-shaped bracket for the microcontroller that I talked about in my post yesterday.

I originally thought I’d need to adjust the hole in the garbage can model to move it upward, but actually the key was putting the microcontroller into the bin with the port facing down.

It does need to be very slightly wider than it currently is, but on my test piece I did that a file and it’s looking good!

Shrapnel

Prototype is alive!

I was worried that only having two LEDs instead of four would result in it not being bright enough, but I’m running it at half brightness with my example code and it seems great.

Next steps are to find a way to fit the tiny microcontroller I’m going to use into the bottom so the USB port lines up for power, and of course print the bin in white.

Blog

Project Bindicator, Part 2: The Parts Arrive

A few weeks after my initial post about my Bindicator project, the microcontroller has arrived in the mail from China and it’s time to get assembling.

Although I’m sticking fairly closely to the original design, there will be a couple of differences that inevitably are going to require modification.

Firstly, the microcontroller itself. The original uses a Wemos D1 Mini which, as I understand it, the garbage can 3D model is designed around and it fits perfectly into the bottom of the bin. I’m using an ESP32-C3 Zero which is quite a bit smaller.

My plan here is to simply print a U-shaped support for the ESP32 that holds it in place, although I also already know that I’m going to need to to raise the cutout for the USB plug very slightly in order for it to align properly. It’s close already, and happily the hole is already an appropriate size for the USB-C connect my ESP32 uses despite having been designed for micro USB. I’m thinking that shouldn’t be too difficult to achieve, though.

The second change I hope to make is to the light source, although I’m not yet sure if my plan for that is flawed. The original design uses four individual RGB LED pixels. I’d prefer to use an offcut of an LED strip I already have lying around, but the problem is that the LEDs are much too far apart.

That said, the original design also divides the bin into four quadrants for the UK’s many different types of garbage, but where I live in Calgary there are only three garbage categories (general, recycling and organic waste) and at most two of those are collected on the same day. I’m therefore going to modify the light baffle from the original design and remove two of the three fins, splitting the bin into two chambers instead of the original four.

I’ve already done this part and made a quick modification to the original STL in Tinkercad, available here.

It remains to be seen if halving the number of LEDs will give me the level of brightness I want, but now that I have a modified baffle printed that’s the next part of the adventure, as I assemble a prototype. If it’s bright enough for my blue test print then it’ll definitely be bright enough for the finished product that I’ll be printing in white.

Watch this space for more to come!

Blog

Project RetroConsole: Complete

As I mentioned at the start of the week, I have – or rather had – an spare mini PC lying around and an idea to turn it into a retro gaming console with Batocera. Well, I did it!

When we left of I’d managed to install Batocera on the internal SSD, but I really wanted to add WiFi and Bluetooth to the computer so I didn’t have to rely on ethernet and could use a wireless controller. I picked up an inexpensive M.2 WiFi card from Amazon and go to work installing it. Installing the card was incredibly straight forward – you remove the 2.5″ SSD, remove the tray the SSD sits on, and install the card in the slot you’ll find underneath. Installing the wireless antennae that I also bought was much more challenging: the computer has two cutouts where the antennae are supposed to go, but I have no idea how you’re supposed to use the one in the third picture because the CPU cooler is in the way.

Whatever, one’s enough.

At first boot after installing the card it didn’t work and I was initially concerned that there may be a hardware compatibility issue. Perhaps I should have sourced a model of WiFi card that would have originally come with the PC? Actually no – I just needed to go into the BIOS and enable M.2 WiFi and Bluetooth.

The next challenge was pairing my Xbox controller. I spent half an hour trying to pair the controller, then unpair and re-pair, but it just wasn’t working. When paired it would rapidly connect then disconnect then reconnect then disconnect, filling the screen with notifications. I spent a bit of time doing some Google-based research but all I discovered was that I shouldn’t be experiencing any problems, so I put it aside and instead paired another Bluetooth game controller I had lying around, an Evoretro switch pro controller. This one worked great.

That evening as I was lying in bed the thought occurred to me that I should maybe try changing the batteries in the Xbox controller so the next morning I gave that a go and it fixed all my issues. I did take 10 minutes to plug the controller into my PC and update the firmware on it too, for good measure.

Everything else has been smooth sailing! Batocera automatically shares its storage over Samba so I connected to it using my Windows PC and copied over the game backups I have. The folder structure is important, but also pretty intuitive. I read a headline that indicated that it may be possible to store the games on a network share, which in this house would give me a potential 30TB of game storage. For now I’m sticking to the SSD in the PC.

By default games run in their native aspect ratio (4:3 for most of the ones I’m playing). Generally they look just fine if you stretch them to 16:9, so that’s what I’ve done, and I turned off the bezel artwork by disabling “decoration” under the game options in the main menu.

And it’s as easy as that! I spent a pleasant Friday afternoon hour playing GoldenEye N64.

The only question that remains is where do I put this thing? Right now I have it hooked up to the TV in my office but I want a more comfortable environment. Should it go in the family room under the main TV, or should it go in the basement hooked to the projector? Let me know!

Parts List:

Blog

Mini PC Console

While I await a few parts (specifically the microcontroller) for my bindicator project, I’ve kicked off another project that’s been on my to-do list for some time – turning a spare mini PC I have sitting around into a retro gaming and emulation machine.

Until the end of last year I was using this HP EliteDesk 800 G2 in the workshop half of my home office, but I’ve since shuffled things around a little bit and it’s been sitting idle for a couple of months.

I’ve installed Batocera on it which was a chore, because there is no installer – I had to write the disk image to a USB stick, boot from that, then re-download and re-write the same disk image to the internal drive.

The version of the PC I have doesn’t have WiFi or Bluetooth but it does have a M.2 slot available for a card that provides both so I’ve ordered one of those, necessary partly because I want to use an Xbox controller with this setup and partly because I’m not sure exactly where I’ll be putting it and whether there’ll be ethernet there.

My plan is to backup a whole bunch of my old console games and use the emulators from Batocera to play them on them. I’d really like it if I’m able to get some cloud game streaming working on this so I can play some Xbox cloud games. I have no idea if that’s doable, but we’ll find out together.

This is my first time trying out Batocera, so if you have any hints, tips or advice (or alternative OSes I should be using instead) let me know!